diff options
author | Zfilipin <zfilipin@wikimedia.org> | 2022-11-23 17:50:28 +0000 |
---|---|---|
committer | Zfilipin <zfilipin@wikimedia.org> | 2022-11-28 17:25:50 +0000 |
commit | fc8264ce14f8bed7eb6f8eb3f8ca7af57a25f5d2 (patch) | |
tree | 88692fbfd770fff7276f1359f2b625d5bbf95466 | |
parent | 5ea23a5b6edd6d668fe7f332bd16489005289b5d (diff) | |
download | mediawikicore-fc8264ce14f8bed7eb6f8eb3f8ca7af57a25f5d2.tar.gz mediawikicore-fc8264ce14f8bed7eb6f8eb3f8ca7af57a25f5d2.zip |
selenium: Fix failing tests
Tests were disabled for a long time because of 66e9dab5f51e8a50d787d6e5bbd15d333557aaf2
so nobody noticed they were failing.
Bug: T303737
Change-Id: I57d0cd39a582beb7720488f2ae2cb5b69d38714f
-rw-r--r-- | tests/selenium/pageobjects/delete.page.js | 8 | ||||
-rw-r--r-- | tests/selenium/pageobjects/edit.page.js | 16 | ||||
-rw-r--r-- | tests/selenium/pageobjects/protect.page.js | 10 | ||||
-rw-r--r-- | tests/selenium/pageobjects/restore.page.js | 8 | ||||
-rw-r--r-- | tests/selenium/pageobjects/undo.page.js | 6 | ||||
-rw-r--r-- | tests/selenium/pageobjects/watchable.page.js | 6 | ||||
-rw-r--r-- | tests/selenium/specs/page.js | 6 | ||||
-rw-r--r-- | tests/selenium/specs/watchlist.js | 4 |
8 files changed, 32 insertions, 32 deletions
diff --git a/tests/selenium/pageobjects/delete.page.js b/tests/selenium/pageobjects/delete.page.js index 6340dbd84798..053076f8fcef 100644 --- a/tests/selenium/pageobjects/delete.page.js +++ b/tests/selenium/pageobjects/delete.page.js @@ -12,10 +12,10 @@ class DeletePage extends Page { super.openTitle( title, { action: 'delete' } ); } - delete( title, reason ) { - this.open( title ); - this.reason.setValue( reason ); - this.submit.click(); + async delete( title, reason ) { + await this.open( title ); + await this.reason.setValue( reason ); + await this.submit.click(); } } diff --git a/tests/selenium/pageobjects/edit.page.js b/tests/selenium/pageobjects/edit.page.js index 008be2bf2bc8..15cc9cd935e9 100644 --- a/tests/selenium/pageobjects/edit.page.js +++ b/tests/selenium/pageobjects/edit.page.js @@ -14,16 +14,16 @@ class EditPage extends Page { super.openTitle( title, { action: 'edit', vehidebetadialog: 1, hidewelcomedialog: 1 } ); } - preview( name, content ) { - this.openForEditing( name ); - this.content.setValue( content ); - this.previewButton.click(); + async preview( name, content ) { + await this.openForEditing( name ); + await this.content.setValue( content ); + await this.previewButton.click(); } - edit( name, content ) { - this.openForEditing( name ); - this.content.setValue( content ); - this.save.click(); + async edit( name, content ) { + await this.openForEditing( name ); + await this.content.setValue( content ); + await this.save.click(); } } diff --git a/tests/selenium/pageobjects/protect.page.js b/tests/selenium/pageobjects/protect.page.js index 16780c6c46d8..7884ded487b7 100644 --- a/tests/selenium/pageobjects/protect.page.js +++ b/tests/selenium/pageobjects/protect.page.js @@ -11,11 +11,11 @@ class ProtectPage extends Page { super.openTitle( title, { action: 'protect' } ); } - protect( title, reason, editProtect ) { - this.open( title ); - this.reason.setValue( reason ); - this.editProtectSelect.selectByVisibleText( editProtect ); - this.submit.click(); + async protect( title, reason, editProtect ) { + await this.open( title ); + await this.reason.setValue( reason ); + await this.editProtectSelect.selectByVisibleText( editProtect ); + await this.submit.click(); } } diff --git a/tests/selenium/pageobjects/restore.page.js b/tests/selenium/pageobjects/restore.page.js index c92fa11526a6..4548224315c9 100644 --- a/tests/selenium/pageobjects/restore.page.js +++ b/tests/selenium/pageobjects/restore.page.js @@ -11,10 +11,10 @@ class RestorePage extends Page { super.openTitle( 'Special:Undelete/' + subject ); } - restore( subject, reason ) { - this.open( subject ); - this.reason.setValue( reason ); - this.submit.click(); + async restore( subject, reason ) { + await this.open( subject ); + await this.reason.setValue( reason ); + await this.submit.click(); } } diff --git a/tests/selenium/pageobjects/undo.page.js b/tests/selenium/pageobjects/undo.page.js index a926966935fa..cfc417df1400 100644 --- a/tests/selenium/pageobjects/undo.page.js +++ b/tests/selenium/pageobjects/undo.page.js @@ -6,15 +6,15 @@ class UndoPage extends Page { get save() { return $( '#wpSave' ); } - undo( title, previousRev, undoRev ) { - super.openTitle( title, { + async undo( title, previousRev, undoRev ) { + await super.openTitle( title, { action: 'edit', undoafter: previousRev, undo: undoRev, // T276783: suppress welcome dialog that would prevent save if VisualEditor is installed vehidebetadialog: 1 } ); - this.save.click(); + await this.save.click(); } } diff --git a/tests/selenium/pageobjects/watchable.page.js b/tests/selenium/pageobjects/watchable.page.js index 338a3ee8d0ce..65741c9a7e1c 100644 --- a/tests/selenium/pageobjects/watchable.page.js +++ b/tests/selenium/pageobjects/watchable.page.js @@ -6,9 +6,9 @@ class WatchablePage extends Page { get confirmWatch() { return $( '#mw-content-text button[type="submit"]' ); } - watch( title ) { - super.openTitle( title, { action: 'watch' } ); - this.confirmWatch.click(); + async watch( title ) { + await super.openTitle( title, { action: 'watch' } ); + await this.confirmWatch.click(); } } diff --git a/tests/selenium/specs/page.js b/tests/selenium/specs/page.js index 116861938a3c..3802809366f9 100644 --- a/tests/selenium/specs/page.js +++ b/tests/selenium/specs/page.js @@ -35,7 +35,7 @@ describe( 'Page', function () { 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' ); + 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' @@ -77,7 +77,7 @@ describe( 'Page', function () { // check assert.strictEqual( await EditPage.heading.getText(), name ); - assert( await EditPage.displayedContent.getText().includes( editContent ) ); + assert.match( await EditPage.displayedContent.getText(), new RegExp( editContent ) ); } ); it( 'should have history @daily', async function () { @@ -117,7 +117,7 @@ describe( 'Page', function () { await RestorePage.restore( name, 'restore reason' ); // check - assert.strictEqual( await 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 undeleted\n\nConsult the deletion log for a record of recent deletions and restorations.' ); } ); it( 'should be protectable', async function () { diff --git a/tests/selenium/specs/watchlist.js b/tests/selenium/specs/watchlist.js index 79280a07bd82..ccb621d4757b 100644 --- a/tests/selenium/specs/watchlist.js +++ b/tests/selenium/specs/watchlist.js @@ -15,8 +15,8 @@ describe( 'Special:Watchlist', function () { bot = await Api.bot(); } ); - beforeEach( function () { - LoginPage.loginAdmin(); + beforeEach( async function () { + await LoginPage.loginAdmin(); } ); it( 'should show page with new edit', async function () { |