From 3e93410e68805e8d03172c1df35a91971ea17e83 Mon Sep 17 00:00:00 2001 From: Esther Akinloose Date: Wed, 8 Jun 2022 15:56:24 +0100 Subject: [PATCH] selenium: Add EditPage.saveComplete() Add new check for page saving. Bug: T296187 Change-Id: I07639c58377f6f285df1bfeccfb5e037a3e619d5 --- tests/selenium/.eslintrc.json | 3 ++- tests/selenium/pageobjects/edit.page.js | 8 ++++++++ tests/selenium/specs/content_editable.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/selenium/.eslintrc.json b/tests/selenium/.eslintrc.json index 2b15ecf751..f6b644e69e 100644 --- a/tests/selenium/.eslintrc.json +++ b/tests/selenium/.eslintrc.json @@ -4,6 +4,7 @@ "wikimedia/selenium" ], "globals": { - "mw": "readonly" + "mw": "readonly", + "ve": "readonly" } } diff --git a/tests/selenium/pageobjects/edit.page.js b/tests/selenium/pageobjects/edit.page.js index 0b3685a9a6..c9c9e66bfe 100644 --- a/tests/selenium/pageobjects/edit.page.js +++ b/tests/selenium/pageobjects/edit.page.js @@ -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(); diff --git a/tests/selenium/specs/content_editable.js b/tests/selenium/specs/content_editable.js index bd451a94cd..cde6b6daac 100644 --- a/tests/selenium/specs/content_editable.js +++ b/tests/selenium/specs/content_editable.js @@ -54,7 +54,7 @@ describe( 'Content Editable', function () { await EditPage.savePage.waitForClickable(); await EditPage.savePage.click(); - await EditPage.notification.waitForDisplayed(); + await EditPage.saveComplete(); assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' ); } );