selenium: Add EditPage.saveComplete()

Add new check for page saving.

Bug: T296187
Change-Id: I07639c58377f6f285df1bfeccfb5e037a3e619d5
This commit is contained in:
Esther Akinloose 2022-06-08 15:56:24 +01:00
parent bffaab97fb
commit 3e93410e68
3 changed files with 11 additions and 2 deletions

View file

@ -4,6 +4,7 @@
"wikimedia/selenium" "wikimedia/selenium"
], ],
"globals": { "globals": {
"mw": "readonly" "mw": "readonly",
"ve": "readonly"
} }
} }

View file

@ -25,5 +25,13 @@ class EditPage extends Page {
} ); } );
} }
saveComplete() {
return browser.executeAsync( function ( done ) {
ve.init.target.on( 'save', function () {
done();
} );
} );
}
} }
module.exports = new EditPage(); module.exports = new EditPage();

View file

@ -54,7 +54,7 @@ describe( 'Content Editable', function () {
await EditPage.savePage.waitForClickable(); await EditPage.savePage.waitForClickable();
await EditPage.savePage.click(); await EditPage.savePage.click();
await EditPage.notification.waitForDisplayed(); await EditPage.saveComplete();
assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' ); assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' );
} ); } );