Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ class Playwright extends Helper {
* ```
*/
async _locate(locator) {
const context = (await this.context) || (await this._getContext())
const context = await this._getContext()

if (this.frame) return findElements(this.frame, locator)

Expand All @@ -1300,7 +1300,7 @@ class Playwright extends Helper {
* ```
*/
async _locateElement(locator) {
const context = (await this.context) || (await this._getContext())
const context = await this._getContext()
return findElement(context, locator)
}

Expand Down Expand Up @@ -2737,7 +2737,7 @@ class Playwright extends Helper {
}

async _getContext() {
if (this.context && this.context.constructor.name === 'FrameLocator') {
if ((this.context && this.context.constructor.name === 'FrameLocator') || this.context) {
return this.context
}
return this.page
Expand Down
13 changes: 12 additions & 1 deletion test/helper/Playwright_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Playwright', function () {

I = new Playwright({
url: siteUrl,
windowSize: '500x700',
// windowSize: '500x700',
browser: process.env.BROWSER || 'chromium',
show: false,
waitForTimeout: 5000,
Expand Down Expand Up @@ -205,6 +205,17 @@ describe('Playwright', function () {

await I.waitToHide('h9')
})

it('should wait for invisible combined with dontseeElement', async () => {
await I.amOnPage('https://codecept.io/')
await I.waitForVisible('.frameworks')
await I.waitForVisible('[alt="React"]')
await I.waitForVisible('.mountains')
await I._withinBegin('.mountains', async () => {
await I.dontSeeElement('[alt="React"]')
await I.waitForInvisible('[alt="React"]', 2)
})
})
})

describe('#waitToHide', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/helper/Puppeteer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Puppeteer - BasicAuth', function () {

I = new Puppeteer({
url: siteUrl,
windowSize: '500x700',
// windowSize: '500x700',
show: false,
waitForTimeout: 5000,
waitForAction: 500,
Expand Down
Loading