Skip to content

Commit 773ba14

Browse files
authored
fix(playwright): relaunch browser correctly with restart: 'session' in run-workers --by pool (#5118)
* fix: Reset browser context and state on close * test: add acceptance tests
1 parent 07a58e5 commit 773ba14

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/playwright.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ jobs:
4848
run: './bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug'
4949
- name: run chromium with restart==browser tests
5050
run: 'BROWSER_RESTART=browser ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug'
51-
- name: run chromium with restart==session tests
51+
- name: run chromium with restart==session tests on 2 workers split by pool
52+
run: 'BROWSER_RESTART=session ./bin/codecept.js run-workers 2 -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug --by=pool'
53+
- name: run chromium with restart==session tests and
5254
run: 'BROWSER_RESTART=session ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug'
5355
- name: run firefox tests
5456
run: 'BROWSER=firefox node ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug'

lib/helper/Playwright.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,10 @@ class Playwright extends Helper {
10311031
this.frame = null
10321032
popupStore.clear()
10331033
if (this.options.recordHar) await this.browserContext.close()
1034+
this.browserContext = null
10341035
await this.browser.close()
1036+
this.browser = null
1037+
this.isRunning = false
10351038
}
10361039

10371040
async _evaluateHandeInContext(...args) {

0 commit comments

Comments
 (0)