2020-08-03 23:41:48 +03:00
|
|
|
/**
|
|
|
|
* Copyright 2018 Google Inc. All rights reserved.
|
|
|
|
* Modifications copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2020-08-20 07:32:12 +03:00
|
|
|
import { options } from './playwright.fixtures';
|
2020-08-03 23:41:48 +03:00
|
|
|
|
2020-08-28 14:20:29 +03:00
|
|
|
it.skip(options.FIREFOX)('should work', async ({playwright, browser, server}) => {
|
2020-08-03 23:41:48 +03:00
|
|
|
const iPhone = playwright.devices['iPhone 6'];
|
|
|
|
const context = await browser.newContext({ ...iPhone });
|
|
|
|
const page = await context.newPage();
|
|
|
|
await page.goto(server.PREFIX + '/mobile.html');
|
|
|
|
expect(await page.evaluate(() => window.innerWidth)).toBe(375);
|
|
|
|
expect(await page.evaluate(() => navigator.userAgent)).toContain('iPhone');
|
|
|
|
await context.close();
|
|
|
|
});
|
|
|
|
|
2020-08-28 14:20:29 +03:00
|
|
|
it.skip(options.FIREFOX)('should support clicking', async ({playwright, browser, server}) => {
|
2020-08-03 23:41:48 +03:00
|
|
|
const iPhone = playwright.devices['iPhone 6'];
|
|
|
|
const context = await browser.newContext({ ...iPhone });
|
|
|
|
const page = await context.newPage();
|
|
|
|
await page.goto(server.PREFIX + '/input/button.html');
|
|
|
|
const button = await page.$('button');
|
|
|
|
await page.evaluate(button => button.style.marginTop = '200px', button);
|
|
|
|
await button.click();
|
2020-08-06 18:27:00 +03:00
|
|
|
expect(await page.evaluate('result')).toBe('Clicked');
|
2020-08-03 23:41:48 +03:00
|
|
|
await context.close();
|
|
|
|
});
|
|
|
|
|
2020-08-28 14:20:29 +03:00
|
|
|
it.skip(options.FIREFOX)('should scroll to click', async ({browser, server}) => {
|
2020-08-03 23:41:48 +03:00
|
|
|
const context = await browser.newContext({
|
|
|
|
viewport: {
|
|
|
|
width: 400,
|
|
|
|
height: 400,
|
|
|
|
},
|
|
|
|
deviceScaleFactor: 1,
|
|
|
|
isMobile: true
|
|
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
await page.goto(server.PREFIX + '/input/scrollable.html');
|
|
|
|
const element = await page.$('#button-91');
|
|
|
|
await element.click();
|
|
|
|
expect(await element.textContent()).toBe('clicked');
|
|
|
|
await context.close();
|
|
|
|
});
|