diff --git a/test/frame-evaluate.spec.ts b/test/frame-evaluate.spec.ts
index 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.md
new file mode 100644
index 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 file
diff --git a/test/elementhandle-click.spec.ts b/test/page/elementhandle-click.spec.ts
similarity index 98%
rename from test/elementhandle-click.spec.ts
rename to test/page/elementhandle-click.spec.ts
index 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.ts
similarity index 96%
rename from test/elementhandle-content-frame.spec.ts
rename to test/page/elementhandle-content-frame.spec.ts
index 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.ts
similarity index 99%
rename from test/elementhandle-convenience.spec.ts
rename to test/page/elementhandle-convenience.spec.ts
index 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.ts
similarity index 98%
rename from test/elementhandle-eval-on-selector.spec.ts
rename to test/page/elementhandle-eval-on-selector.spec.ts
index 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('
');
diff --git a/test/elementhandle-misc.spec.ts b/test/page/elementhandle-misc.spec.ts
similarity index 98%
rename from test/elementhandle-misc.spec.ts
rename to test/page/elementhandle-misc.spec.ts
index 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.ts
similarity index 97%
rename from test/elementhandle-owner-frame.spec.ts
rename to test/page/elementhandle-owner-frame.spec.ts
index 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.ts
similarity index 98%
rename from test/elementhandle-press.spec.ts
rename to test/page/elementhandle-press.spec.ts
index 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(``);
diff --git a/test/elementhandle-query-selector.spec.ts b/test/page/elementhandle-query-selector.spec.ts
similarity index 98%
rename from test/elementhandle-query-selector.spec.ts
rename to test/page/elementhandle-query-selector.spec.ts
index 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.ts
similarity index 96%
rename from test/elementhandle-scroll-into-view.spec.ts
rename to test/page/elementhandle-scroll-into-view.spec.ts
index 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.ts
similarity index 98%
rename from test/elementhandle-select-text.spec.ts
rename to test/page/elementhandle-select-text.spec.ts
index 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.ts
similarity index 98%
rename from test/elementhandle-type.spec.ts
rename to test/page/elementhandle-type.spec.ts
index 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(``);
diff --git a/test/elementhandle-wait-for-element-state.spec.ts b/test/page/elementhandle-wait-for-element-state.spec.ts
similarity index 99%
rename from test/elementhandle-wait-for-element-state.spec.ts
rename to test/page/elementhandle-wait-for-element-state.spec.ts
index 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.ts
similarity index 98%
rename from test/eval-on-selector-all.spec.ts
rename to test/page/eval-on-selector-all.spec.ts
index 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('hello
beautiful
world!
');
diff --git a/test/eval-on-selector.spec.ts b/test/page/eval-on-selector.spec.ts
similarity index 99%
rename from test/eval-on-selector.spec.ts
rename to test/page/eval-on-selector.spec.ts
index 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('');
diff --git a/test/jshandle-as-element.spec.ts b/test/page/jshandle-as-element.spec.ts
similarity index 97%
rename from test/jshandle-as-element.spec.ts
rename to test/page/jshandle-as-element.spec.ts
index 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.ts
similarity index 96%
rename from test/jshandle-evaluate.spec.ts
rename to test/page/jshandle-evaluate.spec.ts
index 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.ts
similarity index 97%
rename from test/jshandle-json-value.spec.ts
rename to test/page/jshandle-json-value.spec.ts
index 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.ts
similarity index 97%
rename from test/jshandle-properties.spec.ts
rename to test/page/jshandle-properties.spec.ts
index 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.ts
similarity index 98%
rename from test/jshandle-to-string.spec.ts
rename to test/page/jshandle-to-string.spec.ts
index 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.ts
similarity index 99%
rename from test/page-event-console.spec.ts
rename to test/page/page-event-console.spec.ts
index 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.ts
similarity index 98%
rename from test/page-event-crash.spec.ts
rename to test/page/page-event-crash.spec.ts
index 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.ts
similarity index 99%
rename from test/page-event-network.spec.ts
rename to test/page/page-event-network.spec.ts
index 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.ts
similarity index 98%
rename from test/page-event-pageerror.spec.ts
rename to test/page/page-event-pageerror.spec.ts
index 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.ts
similarity index 91%
rename from test/page-event-popup.spec.ts
rename to test/page/page-event-popup.spec.ts
index 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, ser
expect(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('yo');
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.ts
similarity index 92%
rename from test/page-event-request.spec.ts
rename to test/page/page-event-request.spec.ts
index 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([