codeceptjs / codeceptjs/CodeceptJS

Parameter restart not working in CodeceptJs with Playwright

未關閉
#2,992 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
playwright
主要語言
JavaScript
星號
4.2k
分支
757
平均合併
2 天 9 小時
30 天內合併 PR
16

描述

#### 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
}
}
}
```

貢獻指南

開啟貢獻指南

研究方向

該 issue 提供了 Playwright helper 設定,但沒有指定來源檔案或測試。首先在回報中的 CodeceptJS、Node.js 和 Playwright 版本上使用 restart:false 和 keepBrowserState:true 重現該情境;完成的標準是解釋並修正瀏覽器反覆重新啟動的問題,並為重新啟動行為加入回歸涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, node.js, playwright
領域
testing
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
32/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。