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(android): run selected page tests on android (2) (#5882)
Pavel Feldman1f1c8b74cdb8
diff --git a/test/frame-evaluate.spec.ts b/test/frame-evaluate.spec.tsindex 720f5cfc1a..1ffe8ddc76 100644--- a/test/frame-evaluate.spec.ts+++ b/test/frame-evaluate.spec.ts@@ -67,9 +67,9 @@ it('should dispose context on cross-origin navigation', (test, { mode }) => {it('should execute after cross-site navigation', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);const mainFrame = page.mainFrame();- expect(await mainFrame.evaluate(() => window.location.href)).toContain('localhost');+ expect(await mainFrame.evaluate(() => window.location.href)).toContain(server.EMPTY_PAGE);await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');- expect(await mainFrame.evaluate(() => window.location.href)).toContain('127');+ expect(await mainFrame.evaluate(() => window.location.href)).toContain(server.CROSS_PROCESS_PREFIX);});it('should not allow cross-frame js handles', async ({ page, server }) => {diff --git a/test/page/README.md b/test/page/README.mdnew file mode 100644index 0000000000..38e7463716--- /dev/null+++ b/test/page/README.md@@ -0,0 +1 @@+Put tests that are scoped to a page and can run on Chrome for Android, WebView, Electron, etc.\ No newline at end of filediff --git a/test/elementhandle-click.spec.ts b/test/page/elementhandle-click.spec.tssimilarity index 98%rename from test/elementhandle-click.spec.tsrename to test/page/elementhandle-click.spec.tsindex 31a5d4d3e2..0434b2acd3 100644--- a/test/elementhandle-click.spec.ts+++ b/test/page/elementhandle-click.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({ page, server }) => {await page.goto(server.PREFIX + '/input/button.html');diff --git a/test/elementhandle-content-frame.spec.ts b/test/page/elementhandle-content-frame.spec.tssimilarity index 96%rename from test/elementhandle-content-frame.spec.tsrename to test/page/elementhandle-content-frame.spec.tsindex 3c8df59bbf..afeb3ee989 100644--- a/test/elementhandle-content-frame.spec.ts+++ b/test/page/elementhandle-content-frame.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { it, expect } from './fixtures';-import { attachFrame } from './utils';+import { it, expect } from '../fixtures';+import { attachFrame } from '../utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/test/elementhandle-convenience.spec.ts b/test/page/elementhandle-convenience.spec.tssimilarity index 99%rename from test/elementhandle-convenience.spec.tsrename to test/page/elementhandle-convenience.spec.tsindex 98836a2778..a5379cc9ed 100644--- a/test/elementhandle-convenience.spec.ts+++ b/test/page/elementhandle-convenience.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should have a nice preview', async ({ page, server }) => {await page.goto(`${server.PREFIX}/dom.html`);diff --git a/test/elementhandle-eval-on-selector.spec.ts b/test/page/elementhandle-eval-on-selector.spec.tssimilarity index 98%rename from test/elementhandle-eval-on-selector.spec.tsrename to test/page/elementhandle-eval-on-selector.spec.tsindex 008a53164d..94a7c6cdcf 100644--- a/test/elementhandle-eval-on-selector.spec.ts+++ b/test/page/elementhandle-eval-on-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({page, server}) => {await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');diff --git a/test/elementhandle-misc.spec.ts b/test/page/elementhandle-misc.spec.tssimilarity index 98%rename from test/elementhandle-misc.spec.tsrename to test/page/elementhandle-misc.spec.tsindex e343e5aeaf..63b51efb5e 100644--- a/test/elementhandle-misc.spec.ts+++ b/test/page/elementhandle-misc.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should hover', async ({ page, server }) => {await page.goto(server.PREFIX + '/input/scrollable.html');diff --git a/test/elementhandle-owner-frame.spec.ts b/test/page/elementhandle-owner-frame.spec.tssimilarity index 97%rename from test/elementhandle-owner-frame.spec.tsrename to test/page/elementhandle-owner-frame.spec.tsindex 7578339b75..51557888ed 100644--- a/test/elementhandle-owner-frame.spec.ts+++ b/test/page/elementhandle-owner-frame.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { it, expect } from './fixtures';-import { attachFrame } from './utils';+import { it, expect } from '../fixtures';+import { attachFrame } from '../utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/test/elementhandle-press.spec.ts b/test/page/elementhandle-press.spec.tssimilarity index 98%rename from test/elementhandle-press.spec.tsrename to test/page/elementhandle-press.spec.tsindex e85558d459..b5cffde123 100644--- a/test/elementhandle-press.spec.ts+++ b/test/page/elementhandle-press.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({ page }) => {await page.setContent(`<input type='text' />`);diff --git a/test/elementhandle-query-selector.spec.ts b/test/page/elementhandle-query-selector.spec.tssimilarity index 98%rename from test/elementhandle-query-selector.spec.tsrename to test/page/elementhandle-query-selector.spec.tsindex bf64349abf..c606cc2754 100644--- a/test/elementhandle-query-selector.spec.ts+++ b/test/page/elementhandle-query-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should query existing element', async ({page, server}) => {await page.goto(server.PREFIX + '/playground.html');diff --git a/test/elementhandle-scroll-into-view.spec.ts b/test/page/elementhandle-scroll-into-view.spec.tssimilarity index 96%rename from test/elementhandle-scroll-into-view.spec.tsrename to test/page/elementhandle-scroll-into-view.spec.tsindex b354f6c2fd..11c65581ad 100644--- a/test/elementhandle-scroll-into-view.spec.ts+++ b/test/page/elementhandle-scroll-into-view.spec.ts@@ -15,9 +15,11 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';-it('should work', async ({ page, server }) => {+it('should work', test => {+ test.fixme(process.env.PW_ANDROID_TESTS);+}, async ({ page, server }) => {await page.goto(server.PREFIX + '/offscreenbuttons.html');for (let i = 0; i < 11; ++i) {const button = await page.$('#btn' + i);diff --git a/test/elementhandle-select-text.spec.ts b/test/page/elementhandle-select-text.spec.tssimilarity index 98%rename from test/elementhandle-select-text.spec.tsrename to test/page/elementhandle-select-text.spec.tsindex c750e1d039..018912fac2 100644--- a/test/elementhandle-select-text.spec.ts+++ b/test/page/elementhandle-select-text.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should select textarea', async ({ page, server, isFirefox }) => {await page.goto(server.PREFIX + '/input/textarea.html');diff --git a/test/elementhandle-type.spec.ts b/test/page/elementhandle-type.spec.tssimilarity index 98%rename from test/elementhandle-type.spec.tsrename to test/page/elementhandle-type.spec.tsindex cd0ffabc12..44e9fa8f93 100644--- a/test/elementhandle-type.spec.ts+++ b/test/page/elementhandle-type.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({ page }) => {await page.setContent(`<input type='text' />`);diff --git a/test/elementhandle-wait-for-element-state.spec.ts b/test/page/elementhandle-wait-for-element-state.spec.tssimilarity index 99%rename from test/elementhandle-wait-for-element-state.spec.tsrename to test/page/elementhandle-wait-for-element-state.spec.tsindex 45ea44a40d..7d255406a4 100644--- a/test/elementhandle-wait-for-element-state.spec.ts+++ b/test/page/elementhandle-wait-for-element-state.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';async function giveItAChanceToResolve(page) {for (let i = 0; i < 5; i++)diff --git a/test/eval-on-selector-all.spec.ts b/test/page/eval-on-selector-all.spec.tssimilarity index 98%rename from test/eval-on-selector-all.spec.tsrename to test/page/eval-on-selector-all.spec.tsindex 24f4e1bc21..564c19e71a 100644--- a/test/eval-on-selector-all.spec.ts+++ b/test/page/eval-on-selector-all.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work with css selector', async ({page, server}) => {await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');diff --git a/test/eval-on-selector.spec.ts b/test/page/eval-on-selector.spec.tssimilarity index 99%rename from test/eval-on-selector.spec.tsrename to test/page/eval-on-selector.spec.tsindex cfaf725d25..47fd64794e 100644--- a/test/eval-on-selector.spec.ts+++ b/test/page/eval-on-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work with css selector', async ({page, server}) => {await page.setContent('<section id="testAttribute">43543</section>');diff --git a/test/jshandle-as-element.spec.ts b/test/page/jshandle-as-element.spec.tssimilarity index 97%rename from test/jshandle-as-element.spec.tsrename to test/page/jshandle-as-element.spec.tsindex d86e6d65af..e6f1f2c7b3 100644--- a/test/jshandle-as-element.spec.ts+++ b/test/page/jshandle-as-element.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => document.body);diff --git a/test/jshandle-evaluate.spec.ts b/test/page/jshandle-evaluate.spec.tssimilarity index 96%rename from test/jshandle-evaluate.spec.tsrename to test/page/jshandle-evaluate.spec.tsindex d820b4dc77..ac5755b3d1 100644--- a/test/jshandle-evaluate.spec.ts+++ b/test/page/jshandle-evaluate.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work with function', async ({page}) => {const windowHandle = await page.evaluateHandle(() => {diff --git a/test/jshandle-json-value.spec.ts b/test/page/jshandle-json-value.spec.tssimilarity index 97%rename from test/jshandle-json-value.spec.tsrename to test/page/jshandle-json-value.spec.tsindex 09e9f8a2f2..f9af18643d 100644--- a/test/jshandle-json-value.spec.ts+++ b/test/page/jshandle-json-value.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));diff --git a/test/jshandle-properties.spec.ts b/test/page/jshandle-properties.spec.tssimilarity index 97%rename from test/jshandle-properties.spec.tsrename to test/page/jshandle-properties.spec.tsindex fcf161d3c0..46b77a8f49 100644--- a/test/jshandle-properties.spec.ts+++ b/test/page/jshandle-properties.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { it, expect } from './fixtures';-import type { ElementHandle } from '..';+import { it, expect } from '../fixtures';+import type { ElementHandle } from '../..';it('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => ({diff --git a/test/jshandle-to-string.spec.ts b/test/page/jshandle-to-string.spec.tssimilarity index 98%rename from test/jshandle-to-string.spec.tsrename to test/page/jshandle-to-string.spec.tsindex 2f5b1027d8..e99ae218cb 100644--- a/test/jshandle-to-string.spec.ts+++ b/test/page/jshandle-to-string.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work for primitives', async ({page}) => {const numberHandle = await page.evaluateHandle(() => 2);diff --git a/test/page-event-console.spec.ts b/test/page/page-event-console.spec.tssimilarity index 99%rename from test/page-event-console.spec.tsrename to test/page/page-event-console.spec.tsindex ba916d256a..7413b01c76 100644--- a/test/page-event-console.spec.ts+++ b/test/page/page-event-console.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';import util from 'util';it('should work', async ({page}) => {diff --git a/test/page-event-crash.spec.ts b/test/page/page-event-crash.spec.tssimilarity index 98%rename from test/page-event-crash.spec.tsrename to test/page/page-event-crash.spec.tsindex 1d0bb4d1ff..ed5bb811b2 100644--- a/test/page-event-crash.spec.ts+++ b/test/page/page-event-crash.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect, describe } from './fixtures';+import { it, expect, describe } from '../fixtures';import * as os from 'os';function crash(page, toImpl, browserName) {diff --git a/test/page-event-network.spec.ts b/test/page/page-event-network.spec.tssimilarity index 99%rename from test/page-event-network.spec.tsrename to test/page/page-event-network.spec.tsindex 6b20a8bb4d..cfde05383b 100644--- a/test/page-event-network.spec.ts+++ b/test/page/page-event-network.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('Page.Events.Request', async ({page, server}) => {const requests = [];diff --git a/test/page-event-pageerror.spec.ts b/test/page/page-event-pageerror.spec.tssimilarity index 98%rename from test/page-event-pageerror.spec.tsrename to test/page/page-event-pageerror.spec.tsindex a0fb027103..3022029462 100644--- a/test/page-event-pageerror.spec.ts+++ b/test/page/page-event-pageerror.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should fire', async ({page, server, isWebKit}) => {const [error] = await Promise.all([diff --git a/test/page-event-popup.spec.ts b/test/page/page-event-popup.spec.tssimilarity index 91%rename from test/page-event-popup.spec.tsrename to test/page/page-event-popup.spec.tsindex ad391490e4..565a1f0c94 100644--- a/test/page-event-popup.spec.ts+++ b/test/page/page-event-popup.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { it, expect } from './fixtures';+import { it, expect } from '../fixtures';it('should work', async ({page}) => {const [popup] = await Promise.all([@@ -35,9 +35,7 @@ it('should work with window features', async ({page, server}) => {expect(await popup.evaluate(() => !!window.opener)).toBe(true);});-it('should emit for immediately closed popups', async ({browser}) => {- const context = await browser.newContext();- const page = await context.newPage();+it('should emit for immediately closed popups', async ({page}) => {const [popup] = await Promise.all([page.waitForEvent('popup'),page.evaluate(() => {@@ -46,7 +44,6 @@ it('should emit for immediately closed popups', async ({browser}) => {}),]);expect(popup).toBeTruthy();- await context.close();});it('should emit for immediately closed popups 2', (test, {browserName, video}) => {@@ -63,9 +60,7 @@ it('should emit for immediately closed popups 2', (test, {browserName, video}) =expect(popup).toBeTruthy();});-it('should be able to capture alert', async ({browser}) => {- const context = await browser.newContext();- const page = await context.newPage();+it('should be able to capture alert', async ({page}) => {const evaluatePromise = page.evaluate(() => {const win = window.open('');win.alert('hello');@@ -75,7 +70,6 @@ it('should be able to capture alert', async ({browser}) => {expect(dialog.message()).toBe('hello');await dialog.dismiss();await evaluatePromise;- await context.close();});it('should work with empty url', async ({page}) => {@@ -150,8 +144,7 @@ it('should work with clicking target=_blank and rel=noopener', async ({page, serexpect(await popup.evaluate(() => !!window.opener)).toBe(false);});-it('should not treat navigations as new popups', async ({context, server}) => {- const page = await context.newPage();+it('should not treat navigations as new popups', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');const [popup] = await Promise.all([@@ -161,6 +154,6 @@ it('should not treat navigations as new popups', async ({context, server}) => {let badSecondPopup = false;page.on('popup', () => badSecondPopup = true);await popup.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');- await context.close();+ await page.close();expect(badSecondPopup).toBe(false);});diff --git a/test/page-event-request.spec.ts b/test/page/page-event-request.spec.tssimilarity index 92%rename from test/page-event-request.spec.tsrename to test/page/page-event-request.spec.tsindex 86ce6b2a52..3d856c0109 100644--- a/test/page-event-request.spec.ts+++ b/test/page/page-event-request.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { it, expect } from './fixtures';-import { attachFrame } from './utils';+import { it, expect } from '../fixtures';+import { attachFrame } from '../utils';it('should fire for navigation requests', async ({page, server}) => {const requests = [];@@ -41,7 +41,9 @@ it('should fire for fetches', async ({page, server}) => {expect(requests.length).toBe(2);});-it('should report requests and responses handled by service worker', async ({page, server}) => {+it('should report requests and responses handled by service worker', test => {+ test.fixme(process.env.PW_ANDROID_TESTS);+}, async ({page, server}) => {await page.goto(server.PREFIX + '/serviceworkers/fetchdummy/sw.html');await page.evaluate(() => window['activationPromise']);const [swResponse, request] = await Promise.all([