mirror of https://github.com/vector-im/riot-web
improve end to end tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
d9552c7f5c
commit
37c875b863
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -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};
|
||||
|
|
Loading…
Reference in New Issue