Skip to content

Commit

Permalink
fixed checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebyt committed Dec 18, 2024
1 parent e8cca6d commit 274aa05
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
17 changes: 12 additions & 5 deletions packages/e2e-tests/pages/wallet/walletTab/sendSubTab.page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import WalletTab from './walletTab.page.js';
import { quarterSecond, fiveSeconds, halfSecond } from '../../../helpers/timeConstants.js';
import { quarterSecond, fiveSeconds, halfSecond, defaultWaitTimeout } from '../../../helpers/timeConstants.js';

class SendSubTab extends WalletTab {
// locators
Expand Down Expand Up @@ -131,14 +131,21 @@ class SendSubTab extends WalletTab {
this.logger.info(`SendSubTab::receiverIsGood is called.`);
return await this.customWaitIsPresented(this.receiverDoneIcon, fiveSeconds, quarterSecond);
}
async receiverIsIncorrect() {
this.logger.info(`SendSubTab::receiverIsIncorrect is called.`);
return await this.customWaitIsPresented(this.receiverErrorIcon, fiveSeconds, quarterSecond);
}
async getReceiverHelperText() {
this.logger.info(`SendSubTab::getReceiverHelperText is called.`);
return await this.getText(this.receiverHelperTextLocator);
}
async waitReceiverHelperTextEqual(expectedText) {
this.logger.info(`SendSubTab::waitReceiverHelperTextEqual is called.`);
return await this.customWaiter(
async () => {
const currentText = await this.getReceiverHelperText();
return currentText === expectedText;
},
defaultWaitTimeout,
quarterSecond
);
}
async getReceiverHandlerAddress() {
this.logger.info(`SendSubTab::getReceiverHandlerAddress is called.`);
return await this.getText(this.domainResolverAddressTextLocator);
Expand Down
12 changes: 3 additions & 9 deletions packages/e2e-tests/test/27_handles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,10 @@ describe('Handle handles', function () {
await sendStep1Page.enterReceiver(testNegativeDatum.userHandle);
});

it(`${testNegativeDatum.provider}. Wait for domain resolver response`, async function () {
it(`${testNegativeDatum.provider}. Wait and check displayed info`, async function () {
const sendStep1Page = new SendSubTab(webdriver, logger);
const errorMarkIsDisplayed = await sendStep1Page.receiverIsIncorrect();
expect(errorMarkIsDisplayed, 'There is no error for receiver').to.be.true;
});

it(`${testNegativeDatum.provider}. Check displayed info and continue`, async function () {
const sendStep1Page = new SendSubTab(webdriver, logger);
const helperText = await sendStep1Page.getReceiverHelperText();
expect(helperText, 'A different error message is displayed').to.equal(RECEIVER_DOESNT_EXIST);
const errorMessageIsDisplayed = await sendStep1Page.waitReceiverHelperTextEqual(RECEIVER_DOESNT_EXIST);
expect(errorMessageIsDisplayed, 'A different error message is displayed').to.equal(true);
});
});
}
Expand Down
12 changes: 3 additions & 9 deletions packages/e2e-tests/test/28_invalidAddressToSend.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ describe('Invalid address for sending', function () {
await sendStep1Page.enterReceiver(invalidAddress);
});

it(`Wait for checking`, async function () {
it(`Wait and check displayed info`, async function () {
const sendStep1Page = new SendSubTab(webdriver, logger);
const errorMarkIsDisplayed = await sendStep1Page.receiverIsIncorrect();
expect(errorMarkIsDisplayed, 'There is no error for receiver').to.be.true;
});

it(`Check displayed info`, async function () {
const sendStep1Page = new SendSubTab(webdriver, logger);
const helperText = await sendStep1Page.getReceiverHelperText();
expect(helperText, 'A different error message is displayed').to.equal(INVALID_ADDRESS);
const errorMessageIsDisplayed = await sendStep1Page.waitReceiverHelperTextEqual(INVALID_ADDRESS);
expect(errorMessageIsDisplayed, 'A different error message is displayed').to.equal(true);
});

afterEach(function (done) {
Expand Down

0 comments on commit 274aa05

Please sign in to comment.