-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correctly generate test x request id for each test in one browser #825
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,6 @@ module.exports = class ExistingBrowser extends Browser { | |
|
||
quit() { | ||
this._meta = this._initMeta(); | ||
this._state = { isBroken: false }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вот это бесполезная строка была. Решил удалить ее. |
||
} | ||
|
||
async prepareScreenshot(selectors, opts = {}) { | ||
|
@@ -169,7 +168,7 @@ module.exports = class ExistingBrowser extends Browser { | |
return { | ||
pid: process.pid, | ||
browserVersion: this.version, | ||
testXReqId: this.testXReqId, | ||
testXReqId: this.state.testXReqId, | ||
...this._config.meta, | ||
}; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ module.exports = class RegularTestRunner extends Runner { | |
sessionCaps: this._browser.capabilities, | ||
sessionOpts: this._browser.publicAPI.options, | ||
file: this._test.file, | ||
testXReqId: this._browser.testXReqId, | ||
state: this._browser.state, | ||
}); | ||
} | ||
|
||
|
@@ -82,7 +82,15 @@ module.exports = class RegularTestRunner extends Runner { | |
|
||
async _getBrowser() { | ||
try { | ||
this._browser = await this._browserAgent.getBrowser({ testXReqId: crypto.randomUUID() }); | ||
const state = { testXReqId: crypto.randomUUID() }; | ||
|
||
this._browser = await this._browserAgent.getBrowser({ state }); | ||
|
||
// use correct state for cached browsers | ||
if (this._browser.state.testXReqId !== state.testXReqId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Бага исправляется за счет этого куска кода. Сюда из браузер пулов может прилететь закешированный браузер в котором находится свой Мне этот There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а как эти testXReqId-ы вообще могут совпасть, если ты в state-е его новый генеришь? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Они не совпадают. Проблема возникает когда используется 1 инстанс браузера на N тестов. В первом тесте выполняется генерация Как вариант можно выполнять |
||
this._browser.applyState(state); | ||
} | ||
|
||
this._test.sessionId = this._browser.sessionId; | ||
|
||
return this._browser; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поле теперь прокидываю в
state
. Посчитал, что нет необходимости в отдельном поле.