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: goto finishes on window.stop() (#10070)
Yury Semikhatsky15a8b2996107
diff --git a/tests/assets/window-stop.html b/tests/assets/window-stop.htmlnew file mode 100644index 0000000000..5a79328f19--- /dev/null+++ b/tests/assets/window-stop.html@@ -0,0 +1,4 @@+<script type="module" src="./module.js"></script>+<script>+ setTimeout(() => window.stop(), 100);+</script>diff --git a/tests/page/page-goto.spec.ts b/tests/page/page-goto.spec.tsindex 4d71d7e305..d5a4fee6e7 100644--- a/tests/page/page-goto.spec.ts+++ b/tests/page/page-goto.spec.ts@@ -629,6 +629,25 @@ it('should properly wait for load', async ({ page, server, browserName }) => {]);});+it('should properly report window.stop()', async ({ page, server, browserName }) => {+ server.setRoute('/module.js', async (req, res) => void 0);+ await page.goto(server.PREFIX + '/window-stop.html');+});++it('should return from goto if new navigation is started', async ({ page, server, browserName }) => {+ it.fixme(browserName === 'webkit', 'WebKit has a bug where Page.frameStoppedLoading is sent too early.');+ server.setRoute('/slow.js', async (req, res) => void 0);+ let finished = false;+ const navigation = page.goto(server.PREFIX + '/load-event/load-event.html').then(r => {+ finished = true;+ return r;+ });+ await new Promise(r => setTimeout(r, 500));+ expect(finished).toBeFalsy();+ await page.goto(server.EMPTY_PAGE);+ expect((await navigation).status()).toBe(200);+});+it('should return when navigation is committed if commit is specified', async ({ page, server }) => {server.setRoute('/empty.html', (req, res) => {res.writeHead(200, {