parent
cb07fa53f4
commit
e35c9d5bbf
|
@ -24,12 +24,14 @@ import GenericToast from "../components/views/toasts/GenericToast";
|
||||||
import ToastStore from "../stores/ToastStore";
|
import ToastStore from "../stores/ToastStore";
|
||||||
|
|
||||||
const onAccept = () => {
|
const onAccept = () => {
|
||||||
|
console.log("DEBUG onAccept AnalyticsToast");
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'accept_cookies',
|
action: 'accept_cookies',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onReject = () => {
|
const onReject = () => {
|
||||||
|
console.log("DEBUG onReject AnalyticsToast");
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: "reject_cookies",
|
action: "reject_cookies",
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,13 +20,25 @@ module.exports = async function toastScenarios(alice, bob) {
|
||||||
console.log(" checking and clearing toasts:");
|
console.log(" checking and clearing toasts:");
|
||||||
|
|
||||||
alice.log.startGroup(`clears toasts`);
|
alice.log.startGroup(`clears toasts`);
|
||||||
alice.log.step(`accepts desktop notifications toast`);
|
// alice.log.step(`accepts desktop notifications toast`);
|
||||||
await acceptToast(alice, "Notifications");
|
// await acceptToast(alice, "Notifications");
|
||||||
alice.log.done();
|
// alice.log.done();
|
||||||
|
//
|
||||||
|
// alice.log.step(`accepts analytics toast`);
|
||||||
|
// await acceptToast(alice, "Help us improve Riot");
|
||||||
|
// alice.log.done();
|
||||||
|
|
||||||
alice.log.step(`rejects analytics toast`);
|
while (true) {
|
||||||
await rejectToast(alice, "Help us improve Riot");
|
try {
|
||||||
alice.log.done();
|
const h2Element = await alice.query('.mx_Toast_title h2');
|
||||||
|
const toastTitle = await alice.innerText(h2Element);
|
||||||
|
console.log("DEBUG closing", toastTitle);
|
||||||
|
const toastDismissButton = await alice.query('.mx_Toast_buttons .mx_AccessibleButton_kind_danger');
|
||||||
|
await toastDismissButton.click();
|
||||||
|
} catch (e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
alice.log.step(`checks no remaining toasts`);
|
alice.log.step(`checks no remaining toasts`);
|
||||||
await assertNoToasts(alice);
|
await assertNoToasts(alice);
|
||||||
|
@ -34,13 +46,25 @@ module.exports = async function toastScenarios(alice, bob) {
|
||||||
alice.log.endGroup();
|
alice.log.endGroup();
|
||||||
|
|
||||||
bob.log.startGroup(`clears toasts`);
|
bob.log.startGroup(`clears toasts`);
|
||||||
bob.log.step(`reject desktop notifications toast`);
|
// bob.log.step(`reject desktop notifications toast`);
|
||||||
await rejectToast(bob, "Notifications");
|
// await rejectToast(bob, "Notifications");
|
||||||
bob.log.done();
|
// bob.log.done();
|
||||||
|
//
|
||||||
|
// bob.log.step(`reject analytics toast`);
|
||||||
|
// await rejectToast(bob, "Help us improve Riot");
|
||||||
|
// bob.log.done();
|
||||||
|
|
||||||
bob.log.step(`reject analytics toast`);
|
while (true) {
|
||||||
await rejectToast(bob, "Help us improve Riot");
|
try {
|
||||||
bob.log.done();
|
const h2Element = await bob.query('.mx_Toast_title h2');
|
||||||
|
const toastTitle = await bob.innerText(h2Element);
|
||||||
|
console.log("DEBUG closing", toastTitle);
|
||||||
|
const toastDismissButton = await bob.query('.mx_Toast_buttons .mx_AccessibleButton_kind_danger');
|
||||||
|
await toastDismissButton.click();
|
||||||
|
} catch (e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bob.log.step(`checks no remaining toasts`);
|
bob.log.step(`checks no remaining toasts`);
|
||||||
await assertNoToasts(bob);
|
await assertNoToasts(bob);
|
||||||
|
|
|
@ -22,7 +22,10 @@ async function assertNoToasts(session) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Error('toast found when none expected');
|
|
||||||
|
const h2Element = await session.query('.mx_Toast_title h2');
|
||||||
|
const toastTitle = await session.innerText(h2Element);
|
||||||
|
throw new Error(`"${toastTitle}" toast found when none expected`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function assertToast(session, expectedTitle) {
|
async function assertToast(session, expectedTitle) {
|
||||||
|
|
Loading…
Reference in New Issue