Skip to content

Parameter restart not working in CodeceptJs with Playwright #2992

Open
@ghost

Description

What are you trying to achieve?

I am using CodeceptJS + Playwright

I'm looking for a before all solution to open browser e execute some steps before scenarios but can't find anyone in codeceptjs+playwright. BeforeSuite can't access browser.

What do you get instead?

I tried to use restart:false to run all scenarios in same browser window but the browser is always restarted before each scenario.

I could see something strange....when using restart:false and test finish, browser close and then another instance browser is opened but closes again and finally open another instance and continue the scenarios.

This not happen when restart:true, browser close and open ok between scenarios.

Provide test source code if related

Here is my helper with restart parameter:

helpers: {
    Playwright: {
      show: true,
      browser: 'chromium',
      windowSize: '1280x960',
      waitForNavigation: "networkidle0",
      restart: false,
      keepBrowserState: true
    },
  },

Details

  • CodeceptJS version: 3.1.1
  • NodeJS Version: 14.9.0
  • Operating System: Windows
  • Playwright version: 1.14.0
  • Configuration file:
const dotenv = require('dotenv').config();

exports.config = {
  tests: './specs/site/*.js',
  output: './reports/e2esitecc',
  helpers: {
    Playwright: {
      show: true,
      browser: 'chromium',
      windowSize: '1280x960',
      waitForNavigation: "networkidle0",
      restart: false,
      keepBrowserState: true
    },
  },
  include: {
    I: './steps_file.js',
    testePage: './pages/testePage.js',
    loginPage: './pages/login_po.js',
  },
  bootstrap: null,
  mocha: {},
  name: 'e2e-web-codeceptjs',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions