Skip to content

Commit 7acf0a4

Browse files
committed
update to async/await style
1 parent 24b9b9b commit 7acf0a4

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

lib/helper/WebDriver.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ class WebDriver extends Helper {
619619
this.browser.capabilities.platformName = this.browser.capabilities.platformName.toLowerCase()
620620
}
621621

622+
this.browser.on('dialog', () => {})
622623
return this.browser
623624
}
624625

test/helper/WebDriver_test.js

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ describe('WebDriver', function () {
5252
beforeEach(async () => {
5353
webApiTests.init({ I: wd, siteUrl })
5454
this.wdBrowser = await wd._before()
55-
this.wdBrowser.on('dialog', dialog => {})
5655
return this.wdBrowser
5756
})
5857

@@ -695,47 +694,39 @@ describe('WebDriver', function () {
695694
})
696695
})
697696

698-
// TO-DO: those tests are flaky so skipping them for now
699697
describe('popup : #acceptPopup, #seeInPopup, #cancelPopup', async () => {
700698
it('should accept popup window', async () => {
701699
await wd.amOnPage('/form/popup')
702-
await wd.waitForText('Confirm', 5)
703700
await wd.click('Confirm')
704701
await wd.acceptPopup()
705-
await wd.waitForElement({ css: '#result' }, 5)
706702
await wd.see('Yes', '#result')
707703
})
708704

709705
it('should cancel popup', async () => {
710706
await wd.amOnPage('/form/popup')
711-
await wd.waitForText('Confirm', 5)
712707
await wd.click('Confirm')
713708
await wd.cancelPopup()
714-
await wd.waitForElement({ css: '#result' }, 5)
715709
await wd.see('No', '#result')
716710
})
717711

718-
it('should check text in popup', () => {
719-
return wd
720-
.amOnPage('/form/popup')
721-
.then(() => wd.click('Alert'))
722-
.then(() => wd.seeInPopup('Really?'))
723-
.then(() => wd.cancelPopup())
712+
it('should check text in popup', async () => {
713+
await wd.amOnPage('/form/popup')
714+
await wd.click('Alert')
715+
await wd.seeInPopup('Really?')
716+
await wd.cancelPopup()
724717
})
725718

726-
it('should grab text from popup', () => {
727-
return wd
728-
.amOnPage('/form/popup')
729-
.then(() => wd.click('Alert'))
730-
.then(() => wd.grabPopupText())
731-
.then(text => assert.equal(text, 'Really?'))
719+
it('should grab text from popup', async () => {
720+
await wd.amOnPage('/form/popup')
721+
await wd.click('Alert')
722+
const text = await wd.grabPopupText()
723+
assert.equal(text, 'Really?')
732724
})
733725

734-
it('should return null if no popup is visible (do not throw an error)', () => {
735-
return wd
736-
.amOnPage('/form/popup')
737-
.then(() => wd.grabPopupText())
738-
.then(text => assert.equal(text, null))
726+
it('should return null if no popup is visible (do not throw an error)', async () => {
727+
await wd.amOnPage('/form/popup')
728+
const text = await wd.grabPopupText()
729+
assert.equal(text, null)
739730
})
740731
})
741732

0 commit comments

Comments
 (0)