Wrong window size is used in next tests after using I.resizeWindow()
What are you trying to achieve?
run tests on different viewports
What do you get instead?
I have several tests in my suit. most of them use window size set in codecept.conf.js. But in some tests in Before hook I have I.resizeWindow(375, 812). what I get is:
- firstly some tests with default viewport are executed
- then a test with
I.resizeWindow(375, 812)is executed - after this ALL tests (even without I.resizeWindow() command) are executed on (375, 812) window size.
I was only able to stop this behavior with restart: true,
Details
- CodeceptJS version: 2.6.8
- NodeJS Version: 12.6.3
- Operating System: Mac OS Mojave / Ubuntu
- Playwright 1.3.0
- Configuration file:
const { setHeadlessWhen } = require("@codeceptjs/configure")
// turn on headless mode when running with HEADLESS=true environment variable
// HEADLESS=true npx codecept run
setHeadlessWhen(process.env.HEADLESS)
exports.config = {
tests: "./tests/*.js",
output: "./output",
helpers: {
Playwright: {
url: process.env.URL || "https://some.url",
browser: "chromium",
show: true,
restart: true,
windowSize: "1440x900",
chromium: {
args: [
"--no-sandbox",
"--disable-dev-shm-usage",
],
defaultViewport: {
width: 1440,
height: 900,
},
},
waitForAction: 200,
waitForNavigation: "load",
getPageTimeout: 30000,
waitForTimeout: 5000,
},
ChaiWrapper: {
require: "codeceptjs-chai",
},
ifElementExists: {
require: "./helpers/ifElementExists.js",
},
extendWithPlaywright: {
require: "./helpers/accessPlaywright.js",
},
REST: {
// endpoint: config.url,
},
},
multiple: {
basic: {
browsers: ["chromium"],
},
firefox: {
grep: "@firefox",
browsers: ["firefox"],
},
},
include: {
// some files here
},
bootstrap: null,
mocha: {},
name: "web-app-tests",
plugins: {
retryFailedStep: {
retries: 3,
enabled: true,
defaultIgnoredSteps: ["amOnPage", "wait*"],
},
screenshotOnFail: {
enabled: true,
},
customLocator: {
enabled: true,
attribute: "data-testid",
},
},
}
same happens in v.3 and even if I set:
restart: false,
keepBrowserState: false
What about 3.1.0? still there?
@DavertMik I have the same issue with viewport when opened new tab. It resised to default value. It looks like the context is lost when opening a new tab. It ease to test - open any page in browser and click to add new tab.
my packages: playwright: 1.17.1 codeceptjs: 3.2.2
Closed for now! Feel free to reopen if you still encounter the issue with latest version and would be nice to provide a sample code to reproduce the issue.