mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-07 11:46:42 +03:00
test(android): run selected page tests on android (2) (#5882)
This commit is contained in:
parent
ad5c028f37
commit
1f1c8b74cd
@ -67,9 +67,9 @@ it('should dispose context on cross-origin navigation', (test, { mode }) => {
|
|||||||
it('should execute after cross-site navigation', async ({ page, server }) => {
|
it('should execute after cross-site navigation', async ({ page, server }) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const mainFrame = page.mainFrame();
|
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');
|
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 }) => {
|
it('should not allow cross-frame js handles', async ({ page, server }) => {
|
||||||
|
1
test/page/README.md
Normal file
1
test/page/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Put tests that are scoped to a page and can run on Chrome for Android, WebView, Electron, etc.
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from '../utils';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should have a nice preview', async ({ page, server }) => {
|
it('should have a nice preview', async ({ page, server }) => {
|
||||||
await page.goto(`${server.PREFIX}/dom.html`);
|
await page.goto(`${server.PREFIX}/dom.html`);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({page, server}) => {
|
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>');
|
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should hover', async ({ page, server }) => {
|
it('should hover', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
await page.goto(server.PREFIX + '/input/scrollable.html');
|
@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from '../utils';
|
||||||
|
|
||||||
it('should work', async ({ page, server }) => {
|
it('should work', async ({ page, server }) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page }) => {
|
it('should work', async ({ page }) => {
|
||||||
await page.setContent(`<input type='text' />`);
|
await page.setContent(`<input type='text' />`);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should query existing element', async ({page, server}) => {
|
it('should query existing element', async ({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/playground.html');
|
await page.goto(server.PREFIX + '/playground.html');
|
@ -15,9 +15,11 @@
|
|||||||
* limitations under the License.
|
* 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');
|
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||||
for (let i = 0; i < 11; ++i) {
|
for (let i = 0; i < 11; ++i) {
|
||||||
const button = await page.$('#btn' + i);
|
const button = await page.$('#btn' + i);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should select textarea', async ({ page, server, isFirefox }) => {
|
it('should select textarea', async ({ page, server, isFirefox }) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({ page }) => {
|
it('should work', async ({ page }) => {
|
||||||
await page.setContent(`<input type='text' />`);
|
await page.setContent(`<input type='text' />`);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
async function giveItAChanceToResolve(page) {
|
async function giveItAChanceToResolve(page) {
|
||||||
for (let i = 0; i < 5; i++)
|
for (let i = 0; i < 5; i++)
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work with css selector', async ({page, server}) => {
|
it('should work with css selector', async ({page, server}) => {
|
||||||
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work with css selector', async ({page, server}) => {
|
it('should work with css selector', async ({page, server}) => {
|
||||||
await page.setContent('<section id="testAttribute">43543</section>');
|
await page.setContent('<section id="testAttribute">43543</section>');
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => document.body);
|
const aHandle = await page.evaluateHandle(() => document.body);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work with function', async ({page}) => {
|
it('should work with function', async ({page}) => {
|
||||||
const windowHandle = await page.evaluateHandle(() => {
|
const windowHandle = await page.evaluateHandle(() => {
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));
|
const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));
|
@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
import type { ElementHandle } from '..';
|
import type { ElementHandle } from '../..';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const aHandle = await page.evaluateHandle(() => ({
|
const aHandle = await page.evaluateHandle(() => ({
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work for primitives', async ({page}) => {
|
it('should work for primitives', async ({page}) => {
|
||||||
const numberHandle = await page.evaluateHandle(() => 2);
|
const numberHandle = await page.evaluateHandle(() => 2);
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect, describe } from './fixtures';
|
import { it, expect, describe } from '../fixtures';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
|
||||||
function crash(page, toImpl, browserName) {
|
function crash(page, toImpl, browserName) {
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('Page.Events.Request', async ({page, server}) => {
|
it('Page.Events.Request', async ({page, server}) => {
|
||||||
const requests = [];
|
const requests = [];
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should fire', async ({page, server, isWebKit}) => {
|
it('should fire', async ({page, server, isWebKit}) => {
|
||||||
const [error] = await Promise.all([
|
const [error] = await Promise.all([
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
|
|
||||||
it('should work', async ({page}) => {
|
it('should work', async ({page}) => {
|
||||||
const [popup] = await Promise.all([
|
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);
|
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit for immediately closed popups', async ({browser}) => {
|
it('should emit for immediately closed popups', async ({page}) => {
|
||||||
const context = await browser.newContext();
|
|
||||||
const page = await context.newPage();
|
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
page.waitForEvent('popup'),
|
page.waitForEvent('popup'),
|
||||||
page.evaluate(() => {
|
page.evaluate(() => {
|
||||||
@ -46,7 +44,6 @@ it('should emit for immediately closed popups', async ({browser}) => {
|
|||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
expect(popup).toBeTruthy();
|
expect(popup).toBeTruthy();
|
||||||
await context.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should emit for immediately closed popups 2', (test, {browserName, video}) => {
|
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();
|
expect(popup).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to capture alert', async ({browser}) => {
|
it('should be able to capture alert', async ({page}) => {
|
||||||
const context = await browser.newContext();
|
|
||||||
const page = await context.newPage();
|
|
||||||
const evaluatePromise = page.evaluate(() => {
|
const evaluatePromise = page.evaluate(() => {
|
||||||
const win = window.open('');
|
const win = window.open('');
|
||||||
win.alert('hello');
|
win.alert('hello');
|
||||||
@ -75,7 +70,6 @@ it('should be able to capture alert', async ({browser}) => {
|
|||||||
expect(dialog.message()).toBe('hello');
|
expect(dialog.message()).toBe('hello');
|
||||||
await dialog.dismiss();
|
await dialog.dismiss();
|
||||||
await evaluatePromise;
|
await evaluatePromise;
|
||||||
await context.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work with empty url', async ({page}) => {
|
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);
|
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not treat navigations as new popups', async ({context, server}) => {
|
it('should not treat navigations as new popups', async ({page, server}) => {
|
||||||
const page = await context.newPage();
|
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
|
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
@ -161,6 +154,6 @@ it('should not treat navigations as new popups', async ({context, server}) => {
|
|||||||
let badSecondPopup = false;
|
let badSecondPopup = false;
|
||||||
page.on('popup', () => badSecondPopup = true);
|
page.on('popup', () => badSecondPopup = true);
|
||||||
await popup.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
|
await popup.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
|
||||||
await context.close();
|
await page.close();
|
||||||
expect(badSecondPopup).toBe(false);
|
expect(badSecondPopup).toBe(false);
|
||||||
});
|
});
|
@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { it, expect } from './fixtures';
|
import { it, expect } from '../fixtures';
|
||||||
import { attachFrame } from './utils';
|
import { attachFrame } from '../utils';
|
||||||
|
|
||||||
it('should fire for navigation requests', async ({page, server}) => {
|
it('should fire for navigation requests', async ({page, server}) => {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
@ -41,7 +41,9 @@ it('should fire for fetches', async ({page, server}) => {
|
|||||||
expect(requests.length).toBe(2);
|
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.goto(server.PREFIX + '/serviceworkers/fetchdummy/sw.html');
|
||||||
await page.evaluate(() => window['activationPromise']);
|
await page.evaluate(() => window['activationPromise']);
|
||||||
const [swResponse, request] = await Promise.all([
|
const [swResponse, request] = await Promise.all([
|
Loading…
Reference in New Issue
Block a user