diff options
author | osamaahmed17 <osamaahmedtahir17@gmail.com> | 2022-01-29 04:00:51 +1100 |
---|---|---|
committer | osamaahmed17 <osamaahmedtahir17@gmail.com> | 2022-01-29 04:00:51 +1100 |
commit | ecd25500270e612a0565ff661e15a0221184947d (patch) | |
tree | 5ea78d1ea2c7cb13bff81340e89bd8c579acdfc2 /tests | |
parent | c4dfd730cd325685c022bf8a410e97a4b5113a45 (diff) | |
download | mediawikicore-ecd25500270e612a0565ff661e15a0221184947d.tar.gz mediawikicore-ecd25500270e612a0565ff661e15a0221184947d.zip |
selenium: Refactor WebdriverIO tests from sync to async mode
Adding missing await statements.
Bug: T293071
Change-Id: I2818d8a72d2ad1d0173e0ee284de3ad8c67c9e18
Diffstat (limited to 'tests')
-rw-r--r-- | tests/selenium/specs/page.js | 32 | ||||
-rw-r--r-- | tests/selenium/specs/recentchanges.js | 2 | ||||
-rw-r--r-- | tests/selenium/specs/user.js | 2 | ||||
-rw-r--r-- | tests/selenium/specs/watchlist.js | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/tests/selenium/specs/page.js b/tests/selenium/specs/page.js index 14fa62ad8016..d68bb2147898 100644 --- a/tests/selenium/specs/page.js +++ b/tests/selenium/specs/page.js @@ -32,10 +32,10 @@ describe( 'Page', function () { it( 'should be previewable', async function () { await EditPage.preview( name, content ); - assert.strictEqual( EditPage.heading.getText(), 'Creating ' + name ); - assert.strictEqual( EditPage.displayedContent.getText(), content ); - assert( EditPage.content.isDisplayed(), 'editor is still present' ); - assert( !EditPage.conflictingContent.isDisplayed(), 'no edit conflict happened' ); + assert.strictEqual( await EditPage.heading.getText(), 'Creating ' + name ); + assert.strictEqual( await EditPage.displayedContent.getText(), content ); + assert( await EditPage.content.isDisplayed(), 'editor is still present' ); + assert( await !EditPage.conflictingContent.isDisplayed(), 'no edit conflict happened' ); // T269566: Popup with text // 'Leave site? Changes that you made may not be saved. Cancel/Leave' @@ -48,8 +48,8 @@ describe( 'Page', function () { await EditPage.edit( name, content ); // check - assert.strictEqual( EditPage.heading.getText(), name ); - assert.strictEqual( EditPage.displayedContent.getText(), content ); + assert.strictEqual( await EditPage.heading.getText(), name ); + assert.strictEqual( await EditPage.displayedContent.getText(), content ); } ); it( 'should be re-creatable', async function () { @@ -63,8 +63,8 @@ describe( 'Page', function () { await EditPage.edit( name, content ); // check - assert.strictEqual( EditPage.heading.getText(), name ); - assert.strictEqual( EditPage.displayedContent.getText(), content ); + assert.strictEqual( await EditPage.heading.getText(), name ); + assert.strictEqual( await EditPage.displayedContent.getText(), content ); } ); it( 'should be editable @daily', async function () { @@ -76,8 +76,8 @@ describe( 'Page', function () { await EditPage.edit( name, editContent ); // check - assert.strictEqual( EditPage.heading.getText(), name ); - assert( EditPage.displayedContent.getText().includes( editContent ) ); + assert.strictEqual( await EditPage.heading.getText(), name ); + assert( await EditPage.displayedContent.getText().includes( editContent ) ); } ); it( 'should have history @daily', async function () { @@ -86,7 +86,7 @@ describe( 'Page', function () { // check await HistoryPage.open( name ); - assert.strictEqual( HistoryPage.comment.getText(), `created with "${content}"` ); + assert.strictEqual( await HistoryPage.comment.getText(), `created with "${content}"` ); } ); it( 'should be deletable', async function () { @@ -100,7 +100,7 @@ describe( 'Page', function () { // check assert.strictEqual( - DeletePage.displayedContent.getText(), + await DeletePage.displayedContent.getText(), '"' + name + '" has been deleted. See deletion log for a record of recent deletions.\n\nReturn to Main Page.' ); } ); @@ -117,7 +117,7 @@ describe( 'Page', function () { await RestorePage.restore( name, 'restore reason' ); // check - assert.strictEqual( RestorePage.displayedContent.getText(), name + ' has been restored\n\nConsult the deletion log for a record of recent deletions and restorations.' ); + assert.strictEqual( await RestorePage.displayedContent.getText(), name + ' has been restored\n\nConsult the deletion log for a record of recent deletions and restorations.' ); } ); it( 'should be protectable', async function () { @@ -138,8 +138,8 @@ describe( 'Page', function () { // Check that we can't edit the page anymore await EditPage.openForEditing( name ); - assert.strictEqual( EditPage.save.isExisting(), false ); - assert.strictEqual( EditPage.heading.getText(), 'View source for ' + name ); + assert.strictEqual( await EditPage.save.isExisting(), false ); + assert.strictEqual( await EditPage.heading.getText(), 'View source for ' + name ); } ); it.skip( 'should be undoable', async function () { @@ -154,7 +154,7 @@ describe( 'Page', function () { await UndoPage.undo( name, previousRev, undoRev ); - assert.strictEqual( EditPage.displayedContent.getText(), content ); + assert.strictEqual( await EditPage.displayedContent.getText(), content ); } ); } ); diff --git a/tests/selenium/specs/recentchanges.js b/tests/selenium/specs/recentchanges.js index 5b5e8ed1481d..c870808f627e 100644 --- a/tests/selenium/specs/recentchanges.js +++ b/tests/selenium/specs/recentchanges.js @@ -36,7 +36,7 @@ describe( 'Special:RecentChanges', function () { await RecentChangesPage.open(); - assert.strictEqual( RecentChangesPage.titles[ 0 ].getText(), name ); + assert.strictEqual( await RecentChangesPage.titles[ 0 ].getText(), name ); } ); } ); diff --git a/tests/selenium/specs/user.js b/tests/selenium/specs/user.js index 4618aaaf7c95..89c48aa0d6bd 100644 --- a/tests/selenium/specs/user.js +++ b/tests/selenium/specs/user.js @@ -38,6 +38,6 @@ describe( 'User', function () { const actualUsername = await browser.execute( async () => { return mw.config.get( 'wgUserName' ); } ); - assert.strictEqual( actualUsername, username ); + assert.strictEqual( await actualUsername, username ); } ); } ); diff --git a/tests/selenium/specs/watchlist.js b/tests/selenium/specs/watchlist.js index 4fe561a7ef4e..79280a07bd82 100644 --- a/tests/selenium/specs/watchlist.js +++ b/tests/selenium/specs/watchlist.js @@ -41,7 +41,7 @@ describe( 'Special:Watchlist', function () { // but by default Special:Watchlist includes both seen and unseen changes, so // it'll show up anyway. The title we just edited will be first because the edit // was the most recent. - assert.strictEqual( WatchlistPage.titles[ 0 ].getText(), title ); + assert.strictEqual( await WatchlistPage.titles[ 0 ].getText(), title ); } ); } ); |