Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit dd31e3d

Browse files
update e2e tests to check for compressed page responses
1 parent 9885900 commit dd31e3d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/e2e-tests/next-app/cypress/integration/pages.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ describe("Pages Tests", () => {
1818
(method) => {
1919
it(`allows HTTP method for path ${path}: ${method}`, () => {
2020
cy.request({ url: path, method: method }).then((response) => {
21+
if (method !== "HEAD") {
22+
cy.verifyResponseIsCompressed(response);
23+
}
2124
expect(response.status).to.equal(200);
2225
});
2326
});
@@ -46,6 +49,9 @@ describe("Pages Tests", () => {
4649
(method) => {
4750
it(`allows HTTP method for path ${path}: ${method}`, () => {
4851
cy.request({ url: path, method: method }).then((response) => {
52+
if (method !== "HEAD") {
53+
cy.verifyResponseIsCompressed(response);
54+
}
4955
expect(response.status).to.equal(200);
5056
});
5157
});

packages/e2e-tests/test-utils/cypress/custom-commands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ declare namespace Cypress {
4444
response: Cypress.Response,
4545
shouldBeCached: boolean
4646
) => Cypress.Chainable<JQuery>;
47+
verifyResponseIsCompressed: (
48+
response: Cypress.Response
49+
) => Cypress.Chainable<JQuery>;
4750
}
4851
}
4952

@@ -140,3 +143,10 @@ Cypress.Commands.add(
140143
}
141144
}
142145
);
146+
147+
Cypress.Commands.add(
148+
"verifyResponseIsCompressed",
149+
(response: Cypress.Response) => {
150+
expect(response.headers["content-encoding"]).to.equal("gzip");
151+
}
152+
);

0 commit comments

Comments
 (0)