Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: page.reload should return 304 status (#28881)
Yury Semikhatsky1617779f3ec1
diff --git a/tests/page/page-network-request.spec.ts b/tests/page/page-network-request.spec.tsindex 0636370923..e915ffa3d3 100644--- a/tests/page/page-network-request.spec.ts+++ b/tests/page/page-network-request.spec.ts@@ -448,3 +448,31 @@ it('should not allow to access frame on popup main request', async ({ page, servawait popupPromise;await clicked;});++it('page.reload return 304 status code', async ({ page, server, browserName }) => {+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28779' });+ it.fixme(browserName === 'chromium', 'Returns 200 instead of 304');+ it.fixme(browserName === 'firefox', 'Does not send second request');+ let requestNumber = 0;+ server.setRoute('/test.html', (req, res) => {+ ++requestNumber;+ const headers = {+ 'cf-cache-status': 'DYNAMIC',+ 'Content-Type': 'text/html;charset=UTF-8',+ 'Last-Modified': 'Fri, 05 Jan 2024 01:56:20 GMT',+ 'Vary': 'Access-Control-Request-Headers',+ };+ if (requestNumber === 1)+ res.writeHead(200, headers);+ else+ res.writeHead(304, 'Not Modified', headers);+ res.write(`<div>Test</div>`);+ res.end();+ });+ const response1 = await page.goto(server.PREFIX + '/test.html');+ expect(response1.status()).toBe(200);+ const response2 = await page.reload();+ expect(requestNumber).toBe(2);+ expect(response2.status()).toBe(304);+ expect(response2.statusText()).toBe('Not Modified');+});