-
Notifications
You must be signed in to change notification settings - Fork 36
/
modalAssert.ts
51 lines (43 loc) · 1.96 KB
/
modalAssert.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Modal from '../elements/modal';
import { expect } from 'chai';
import { t } from '../utils/translationService';
class ModalAssert {
async assertSeeModalContainer(shouldSee: boolean) {
await Modal.container.waitForDisplayed({ reverse: !shouldSee });
}
async assertSeeTitle(expectedTitle: string) {
await Modal.title.waitForDisplayed();
expect(await Modal.title.getText()).to.equal(expectedTitle);
}
async assertSeeDescription(expectedDescription: string) {
await Modal.description.waitForDisplayed();
expect(await Modal.description.getText()).to.equal(expectedDescription);
}
async assertSeeCancelButton(label: string) {
await Modal.cancelButton.waitForDisplayed();
expect(await Modal.cancelButton.getText()).to.equal(label);
}
async assertSeeConfirmButton(label: string) {
await Modal.confirmButton.waitForDisplayed();
expect(await Modal.confirmButton.getText()).to.equal(label);
}
async assertSeeModal(title: string, description: string, cancelButtonLabel: string, confirmButtonLabel: string) {
await this.assertSeeModalContainer(true);
await this.assertSeeTitle(title);
await this.assertSeeDescription(description);
await this.assertSeeCancelButton(cancelButtonLabel);
await this.assertSeeConfirmButton(confirmButtonLabel);
}
async assertSeeRemoveWalletModal(shouldBeDisplayed: boolean) {
if (shouldBeDisplayed) {
const title = await t('browserView.settings.wallet.general.removeWalletAlert.title');
const description = await t('browserView.settings.wallet.general.removeWalletAlert.content');
const cancelButtonLabel = await t('browserView.settings.wallet.general.removeWalletAlert.cancel');
const confirmButtonLabel = await t('browserView.settings.wallet.general.removeAction');
await this.assertSeeModal(title, description, cancelButtonLabel, confirmButtonLabel);
} else {
await this.assertSeeModalContainer(false);
}
}
}
export default new ModalAssert();