'Playwright - won't launch full screen
I am launching my text execution with the new playwright test runner. Unfortunately I can't get it to start in a full screen mode.
I am using the following code:
const { test, expect } = require('@playwright/test');
const { HomePage } = require('../lib/Homepages');
const playwright = require('@playwright/test');
test.describe('Home Test Suite', () => {
let homePage;
test.beforeAll(async () => {
const browser = await playwright.chromium.launch({ args: ['--start-maximized'] });
const context = await browser.newContext({ viewport: null });
const page = await context.newPage();
homePage = new HomePage(page);
await homePage.loadapp();
});
test.afterAll(async ({ browser }) => {
await browser.close();
});
test.describe('test1', () => {
test('test', async () => {
expect(await homepage.x()).toBeTruthy();
// Act
await homePage.dosomething('Word');
// Assert
expect(await homePage.isItCorrect()).toBeTruthy;
});
});
});
After running npm run test. I receive the following error:
browser.newContext: "deviceScaleFactor" option is not supported with null "viewport"
Any idea how to get it to work?
Solution 1:[1]
The error was caused by the playwright.config.js.
I had the following code:
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
]
Commenting out the 'use' has fixed the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mateusz K |
