improve end to end tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d9552c7f5c
commit
37c875b863
2 changed files with 14 additions and 3 deletions
|
@ -14,18 +14,24 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {acceptToast, rejectToast} = require("../usecases/toasts");
|
const {assertNoToasts, acceptToast, rejectToast} = require("../usecases/toasts");
|
||||||
|
|
||||||
module.exports = async function toastScenarios(alice, bob) {
|
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.startGroup(`clears toasts`);
|
||||||
|
alice.log.step(`accepts desktop notifications toast`);
|
||||||
await acceptToast(alice, "Notifications");
|
await acceptToast(alice, "Notifications");
|
||||||
|
alice.log.step(`accepts analytics toast`);
|
||||||
await acceptToast(alice, "Help us improve Riot");
|
await acceptToast(alice, "Help us improve Riot");
|
||||||
|
await assertNoToasts(alice);
|
||||||
alice.log.endGroup();
|
alice.log.endGroup();
|
||||||
|
|
||||||
bob.log.startGroup(`clears toasts`);
|
bob.log.startGroup(`clears toasts`);
|
||||||
|
alice.log.step(`reject desktop notifications toast`);
|
||||||
await rejectToast(bob, "Notifications");
|
await rejectToast(bob, "Notifications");
|
||||||
|
alice.log.step(`reject analytics toast`);
|
||||||
await rejectToast(bob, "Help us improve Riot");
|
await rejectToast(bob, "Help us improve Riot");
|
||||||
|
await assertNoToasts(bob);
|
||||||
bob.log.endGroup();
|
bob.log.endGroup();
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,11 @@ limitations under the License.
|
||||||
|
|
||||||
const assert = require('assert');
|
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) {
|
async function assertToast(session, expectedTitle) {
|
||||||
const h2Element = await session.query('.mx_Toast_title h2');
|
const h2Element = await session.query('.mx_Toast_title h2');
|
||||||
const toastTitle = await session.innerText(h2Element);
|
const toastTitle = await session.innerText(h2Element);
|
||||||
|
@ -34,4 +39,4 @@ async function rejectToast(session, expectedTitle) {
|
||||||
await btn.click();
|
await btn.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {assertToast, acceptToast, rejectToast};
|
module.exports = {assertNoToasts, assertToast, acceptToast, rejectToast};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue