chore(jest): convert browser tests to jest (#3000)

This commit is contained in:
Joel Einbinder 2020-07-17 08:22:39 -07:00 committed by GitHub
parent 1c0504ae28
commit df8b27069e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 20 deletions

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
const {FFOX, CHROMIUM, WEBKIT} = require('./utils').testOptions(browserType);
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
describe('Browser.newPage', function() {
it('should create new page', async function({browser}) {

View file

@ -16,7 +16,8 @@
*/
const utils = require('./utils');
const {FFOX, CHROMIUM, WEBKIT, MAC, CHANNEL} = utils.testOptions(browserType);
const {FFOX, CHROMIUM, WEBKIT, MAC, CHANNEL, HEADLESS} = testOptions;
const {devices} = require('..');
describe('BrowserContext', function() {
it('should create new context', async function({browser}) {
@ -194,7 +195,7 @@ describe('BrowserContext({userAgent})', function() {
await context.close();
}
{
const context = await browser.newContext({ userAgent: playwright.devices['iPhone 6'].userAgent });
const context = await browser.newContext({ userAgent: devices['iPhone 6'].userAgent });
const page = await context.newPage();
await page.goto(server.PREFIX + '/mobile.html');
expect(await page.evaluate(() => navigator.userAgent)).toContain('iPhone');

View file

@ -15,7 +15,7 @@
* limitations under the License.
*/
const { FFOX, CHROMIUM, WEBKIT, WIN, CHANNEL } = require('./utils').testOptions(browserType);
const { FFOX, CHROMIUM, WEBKIT, WIN, CHANNEL } = testOptions;
describe.skip(!CHANNEL)('Channels', function() {
it('should work', async({browser}) => {

View file

@ -15,7 +15,7 @@
* limitations under the License.
*/
const {FFOX, CHROMIUM, WEBKIT, MAC} = require('./utils').testOptions(browserType);
const {FFOX, CHROMIUM, WEBKIT, MAC} = testOptions;
describe('ignoreHTTPSErrors', function() {
it('should work', async({browser, httpsServer}) => {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
const {FFOX, CHROMIUM, WEBKIT, MAC} = require('./utils').testOptions(browserType);
const {FFOX, CHROMIUM, WEBKIT, MAC} = testOptions;
describe('Link navigation', function() {
it('should inherit user agent from browser context', async function({browser, server}) {

View file

@ -99,17 +99,6 @@ module.exports = {
environments: [customEnvironment, 'page'],
},
{
files: [
'./browser.spec.js',
'./browsercontext.spec.js',
'./channels.spec.js',
'./ignorehttpserrors.spec.js',
'./popup.spec.js',
],
environments: [customEnvironment, 'browser'],
},
{
files: [
'./defaultbrowsercontext.spec.js',

View file

@ -127,9 +127,7 @@ function collect(browserNames) {
const skip = spec.browsers && !spec.browsers.includes(browserName);
(skip ? xdescribe : describe)(spec.title || '', () => {
for (const e of spec.environments || ['page']) {
if (e === 'browser') {
testRunner.collector().useEnvironment(browserEnvironment);
} else if (e === 'page') {
if (e === 'page') {
testRunner.collector().useEnvironment(browserEnvironment);
testRunner.collector().useEnvironment(pageEnvironment);
} else {