From d9552c7f5c4296ee92258614c261cb3d01352d4f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 27 May 2020 13:10:28 +0100 Subject: [PATCH] e2e test toasts v2 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- test/end-to-end-tests/src/scenarios/toast.js | 12 ++++++++++-- test/end-to-end-tests/src/usecases/toasts.js | 12 ++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/end-to-end-tests/src/scenarios/toast.js b/test/end-to-end-tests/src/scenarios/toast.js index 91c6ed750f..9a0594cc31 100644 --- a/test/end-to-end-tests/src/scenarios/toast.js +++ b/test/end-to-end-tests/src/scenarios/toast.js @@ -14,10 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -const {acceptToast} = require("../usecases/toasts"); +const {acceptToast, rejectToast} = require("../usecases/toasts"); module.exports = async function toastScenarios(alice, bob) { console.log(" checking and clearing all toasts:"); + + alice.log.startGroup(`clears toasts`); + await acceptToast(alice, "Notifications"); await acceptToast(alice, "Help us improve Riot"); - await acceptToast(bob, "Help us improve Riot"); + alice.log.endGroup(); + + bob.log.startGroup(`clears toasts`); + await rejectToast(bob, "Notifications"); + await rejectToast(bob, "Help us improve Riot"); + bob.log.endGroup(); }; diff --git a/test/end-to-end-tests/src/usecases/toasts.js b/test/end-to-end-tests/src/usecases/toasts.js index 663484ce6e..991d3cc39c 100644 --- a/test/end-to-end-tests/src/usecases/toasts.js +++ b/test/end-to-end-tests/src/usecases/toasts.js @@ -23,21 +23,13 @@ async function assertToast(session, expectedTitle) { } async function acceptToast(session, expectedTitle) { - const foundToast = await assertToast(session, expectedTitle); - if (!foundToast) { - throw new Error("could not find expected toast"); - } - + await assertToast(session, expectedTitle); const btn = await session.query('.mx_Toast_buttons .mx_AccessibleButton_kind_primary'); await btn.click(); } async function rejectToast(session, expectedTitle) { - const foundToast = await assertToast(session, expectedTitle); - if (!foundToast) { - throw new Error("could not find expected toast"); - } - + await assertToast(session, expectedTitle); const btn = await session.query('.mx_Toast_buttons .mx_AccessibleButton_kind_danger'); await btn.click(); }