diff --git a/test/end-to-end-tests/src/scenarios/toast.js b/test/end-to-end-tests/src/scenarios/toast.js index 9a0594cc31..b5b7fa4494 100644 --- a/test/end-to-end-tests/src/scenarios/toast.js +++ b/test/end-to-end-tests/src/scenarios/toast.js @@ -14,18 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -const {acceptToast, rejectToast} = require("../usecases/toasts"); +const {assertNoToasts, acceptToast, rejectToast} = require("../usecases/toasts"); module.exports = async function toastScenarios(alice, bob) { - console.log(" checking and clearing all toasts:"); + console.log(" checking and clearing toasts:"); alice.log.startGroup(`clears toasts`); + alice.log.step(`accepts desktop notifications toast`); await acceptToast(alice, "Notifications"); + alice.log.step(`accepts analytics toast`); await acceptToast(alice, "Help us improve Riot"); + await assertNoToasts(alice); alice.log.endGroup(); bob.log.startGroup(`clears toasts`); + alice.log.step(`reject desktop notifications toast`); await rejectToast(bob, "Notifications"); + alice.log.step(`reject analytics toast`); await rejectToast(bob, "Help us improve Riot"); + await assertNoToasts(bob); 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 991d3cc39c..636714d66b 100644 --- a/test/end-to-end-tests/src/usecases/toasts.js +++ b/test/end-to-end-tests/src/usecases/toasts.js @@ -16,6 +16,11 @@ limitations under the License. const assert = require('assert'); +async function assertNoToasts(session) { + const toast = await session.query('.mx_Toast_toast'); + assert(!toast, 'toast found when none expected'); +} + async function assertToast(session, expectedTitle) { const h2Element = await session.query('.mx_Toast_title h2'); const toastTitle = await session.innerText(h2Element); @@ -34,4 +39,4 @@ async function rejectToast(session, expectedTitle) { await btn.click(); } -module.exports = {assertToast, acceptToast, rejectToast}; +module.exports = {assertNoToasts, assertToast, acceptToast, rejectToast};