Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { expect } from 'chai';

import ConfigureMidnightPage from '../../elements/onboarding/ConfigureMidnightPage';
import { Constants } from '../../setup/Constants';
import { t } from '../../utils/translationService';

import OnboardingCommonAssert from './onboardingCommonAssert';

class ConfigureMidnightPageAssert extends OnboardingCommonAssert {
async assertSeeNetworkSection() {
await ConfigureMidnightPage.networkSectionLabel.waitForDisplayed();
// TODO: update translation keys when LW-13474 is merged
expect(await ConfigureMidnightPage.networkSectionLabel.getText()).to.equal(
await t('midnight.network-config.network-label')
);
await ConfigureMidnightPage.networkOptionTestnet.waitForDisplayed();
expect(await ConfigureMidnightPage.networkOptionTestnet.getText()).to.equal(
await t('midnight.network-config.network-option.2')
);
await ConfigureMidnightPage.networkOptionUndeployed.waitForDisplayed();
expect(await ConfigureMidnightPage.networkOptionUndeployed.getText()).to.equal(
await t('midnight.network-config.network-option.0')
);
}

async assertSeeEnterWalletButton() {
await ConfigureMidnightPage.enterWalletButton.waitForDisplayed();
expect(await ConfigureMidnightPage.enterWalletButton.getText()).to.equal(await t('onboarding.steps.enter-wallet'));
}

async assertSeeProofServerSection(midnightNetwork: 'testnet' | 'undeployed' = 'testnet') {
await ConfigureMidnightPage.proofServerSectionLabel.waitForDisplayed();
expect(await ConfigureMidnightPage.proofServerSectionLabel.getText()).to.equal(
await t('midnight.network-config.proof-server-label')
);

await ConfigureMidnightPage.proofServerOptionLocal.waitForDisplayed();
const proofServerValue = await ConfigureMidnightPage.proofServerOptionLocal.getText();
expect(proofServerValue).to.include(Constants.MIDNIGHT_PROOF_SERVER_ADDRESS);
expect(proofServerValue).to.include(await t('midnight.network-config.proof-server-option.local'));

await ConfigureMidnightPage.nodeAddressInputLabel.waitForDisplayed();
expect(await ConfigureMidnightPage.nodeAddressInputLabel.getText()).to.equal(
await t('midnight.network-config.node-address')
);
await ConfigureMidnightPage.nodeAddressInput.waitForDisplayed();
const expectedNodeAddress =
midnightNetwork === 'undeployed' ? Constants.NODE_ADDRESS_UNDEPLOYED : Constants.NODE_ADDRESS_TESTNET;
expect(await ConfigureMidnightPage.nodeAddressInput.getValue()).to.equal(expectedNodeAddress);

await ConfigureMidnightPage.indexerAddressInputLabel.waitForDisplayed();
expect(await ConfigureMidnightPage.indexerAddressInputLabel.getText()).to.equal(
await t('midnight.network-config.indexer-address')
);
await ConfigureMidnightPage.indexerAddressInput.waitForDisplayed();
const expectedIndexerAddress =
midnightNetwork === 'undeployed' ? Constants.INDEXER_ADDRESS_UNDEPLOYED : Constants.INDEXER_ADDRESS_TESTNET;
expect(await ConfigureMidnightPage.indexerAddressInput.getValue()).to.equal(expectedIndexerAddress);
}

async assertSeeConfigureMidnightPage() {
await this.assertSeeTopLaceLogo();
await this.assertSeeHelpAndSupportButton();
await this.assertSeeStepTitle(await t('onboarding.midnight.settings.title'));
await this.assertSeeStepSubtitle(await t('onboarding.midnight.settings.description'));
await this.assertSeeNetworkSection();
await this.assertSeeProofServerSection();
await this.assertSeeBackButton();
await this.assertSeeEnterWalletButton();
await this.assertSeeMidnightCompatibilityInfo();
await this.assertSeeLegalLinks();
}
}

export default new ConfigureMidnightPageAssert();
14 changes: 14 additions & 0 deletions packages/e2e-tests/src/assert/onboarding/onboardingCommonAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class OnboardingCommonAssert {
this.commonOnboardingElements = new CommonOnboardingElements();
}

async assertSeeTopLaceLogo(): Promise<void> {
await this.commonOnboardingElements.laceLogo.waitForDisplayed();
}

async assertSeeStepTitle(expectedTitle: string): Promise<void> {
await this.commonOnboardingElements.stepTitle.waitForStable();
expect(await this.commonOnboardingElements.stepTitle.getText()).to.equal(expectedTitle);
Expand Down Expand Up @@ -81,6 +85,16 @@ class OnboardingCommonAssert {
}
expect(await this.commonOnboardingElements.activeStepIndicator.getText()).to.equal(expectedStepTitle);
}

async assertSeeMidnightCompatibilityInfo(): Promise<void> {
await this.commonOnboardingElements.compatibilityLabel.waitForDisplayed();
expect(await this.commonOnboardingElements.compatibilityLabel.getText()).to.equal(
await t('onboarding.compatible-with')
);
await this.commonOnboardingElements.midnightSymbol.waitForDisplayed();
await this.commonOnboardingElements.midnightLabel.waitForDisplayed();
expect(await this.commonOnboardingElements.midnightLabel.getText()).to.equal(await t('onboarding.midnight.label'));
}
}

export default OnboardingCommonAssert;
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,22 @@ class OnboardingMainPageAssert extends OnboardingCommonAssert {
await OnboardingMainPage.restoreWalletButton.waitForClickable();
}

async assertSeeMainPage() {
async assertSeeMainPage(walletType: 'Cardano' | 'Midnight' = 'Cardano') {
await this.assertSeeLogo();
await this.assertSeeTitle();
await this.assertSeeSubtitle();
await this.assertSeeCreateWalletOption();
// Lack of support for hardware wallets on Firefox
await this.assertSeeHardwareWalletOption(!browser.isFirefox);
// Lack of support for hardware wallets on Firefox and on Midnight
await this.assertSeeHardwareWalletOption(!browser.isFirefox && walletType === 'Cardano');
await this.assertSeeRestoreWalletOption();
await this.assertSeeLegalLinks();
await this.assertSeeHelpAndSupportButton();
await this.assertSeeAgreementText();
await this.assertSeeTermsOfServiceLink();
await this.assertSeePrivacyPolicyLink();
if (walletType === 'Midnight') {
await this.assertSeeMidnightCompatibilityInfo();
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions packages/e2e-tests/src/assert/tokensPageAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,18 @@ class TokensPageAssert {
await t('general.warnings.cannotFetchPrice')
);
}

async assertSendButtonEnabled(shouldBeEnabled: boolean): Promise<void> {
await MenuHeader.sendButton.waitForEnabled({ reverse: !shouldBeEnabled });
}

async assertSeeMidnightTokensPage() {
await TokensPage.title.waitForDisplayed();
expect(await TokensPage.title.getText()).to.contain(await t('app.tokens'));

await TokensPage.counter.waitForDisplayed();
expect(await TokensPage.counter.getText()).to.to.match(TestnetPatterns.COUNTER_REGEX);
}
}

export default new TokensPageAssert();
22 changes: 22 additions & 0 deletions packages/e2e-tests/src/assert/topNavigationAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class TopNavigationAssert {
await t('browserView.sideMenu.links.addSharedWallet')
);
}
// TODO: uncomment when LW-13474 is merged
// await MenuHeader.menuAddMidnightWalletButton.waitForDisplayed();
// expect(await MenuHeader.menuAddMidnightWalletButton.getText()).to.equal(
// await t('browserView.sideMenu.links.addMidnightWallet')
// );
await MenuHeader.menuAddressBookButton.waitForDisplayed();
expect(await MenuHeader.menuAddressBookButton.getText()).to.equal(
await t('browserView.sideMenu.links.addressBook')
Expand Down Expand Up @@ -259,6 +264,23 @@ class TopNavigationAssert {
async assertSeeAddSharedWalletOption(shouldBeDisplayed: boolean) {
await MenuHeader.menuAddSharedWalletButton.waitForDisplayed({ reverse: !shouldBeDisplayed });
}

async assertMidnightWalletIsInSyncedStatus() {
await MenuHeader.midnightLogo.waitForDisplayed();
await MenuHeader.midnightTitle.waitForDisplayed();
await MenuHeader.midnightSyncStatus.waitForDisplayed();
await this.assertMidnightSyncStatus('app.sync-status.synced');
await MenuHeader.midnightResyncIcon.waitForEnabled();
}

async assertMidnightSyncStatus(status: string) {
const expectedStatus = (await t(status)) ?? status;
await browser.waitUntil(async () => (await MenuHeader.getWalletSyncStatusText()) === expectedStatus, {
timeout: 180_000,
interval: 500,
timeoutMsg: `expected sync status "${expectedStatus}" was not displayed`
});
}
}

export default new TopNavigationAssert();
34 changes: 34 additions & 0 deletions packages/e2e-tests/src/elements/menuHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class MenuHeader {
private MENU_ADD_NEW_WALLET_BUTTON = '[data-testid="header-menu-new-wallet"]';
private MENU_ADD_BITCOIN_WALLET_BUTTON = '[data-testid="header-menu-add-bitcoin-wallet"]';
private MENU_ADD_SHARED_WALLET_BUTTON = '[data-testid="header-menu-add-shared-wallet"]';
private MENU_ADD_MIDNIGHT_WALLET_BUTTON = '[data-testid="header-menu-add-midnight-wallet"]';
private MENU_SETTINGS_BUTTON = '//li[@data-testid="header-menu-settings"]';
private MENU_SIGN_MESSAGE_BUTTON = '//li[@data-testid="header-menu-sign-message"]';
private MENU_LOCK_BUTTON = '//li[@data-testid="header-menu-lock"]';
Expand All @@ -36,6 +37,10 @@ export class MenuHeader {
private readonly RECEIVE_BUTTON = 'aside [data-testid="receive-button"]';
private readonly SEND_BUTTON = 'aside [data-testid="send-button"]';
private readonly CO_SIGN_BUTTON = '[data-testid="co-sign-button"]';
private readonly MIDNIGHT_LOGO = '[data-testid="midnight-logo"]';
private readonly MIDNIGHT_TITLE = '[data-testid="midnight-title"]';
private readonly MIDNIGHT_MENU_SYNC_STATUS = '[data-testid="menu-sync-status"]';
private readonly MIDNIGHT_RESYNC_ICON = '[data-testid="resync-icon"]';

get avatarOnButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.AVATAR_ON_BUTTON);
Expand Down Expand Up @@ -117,6 +122,10 @@ export class MenuHeader {
return $(this.MENU_ADD_SHARED_WALLET_BUTTON);
}

get menuAddMidnightWalletButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MENU_ADD_MIDNIGHT_WALLET_BUTTON);
}

get menuSettingsButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MENU_SETTINGS_BUTTON);
}
Expand Down Expand Up @@ -169,6 +178,22 @@ export class MenuHeader {
return $(this.RIGHT_SIDE_PANEL_BUTTON);
}

get midnightLogo(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_LOGO);
}

get midnightTitle(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_TITLE);
}

get midnightSyncStatus(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_MENU_SYNC_STATUS);
}

get midnightResyncIcon(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_RESYNC_ICON);
}

async clickOnExpandButton(): Promise<void> {
await this.expandButton.click();
}
Expand Down Expand Up @@ -204,6 +229,11 @@ export class MenuHeader {
await this.menuAddSharedWalletButton.click();
}

async clickOnAddMidnightWalletOption(): Promise<void> {
await this.menuAddMidnightWalletButton.waitForClickable();
await this.menuAddMidnightWalletButton.click();
}

async clickMenuButton(): Promise<void> {
await this.menuButton.waitForClickable({ timeout: 15_000 });
await this.menuButton.click();
Expand Down Expand Up @@ -272,6 +302,10 @@ export class MenuHeader {
async clickRightSidePanelButton(): Promise<void> {
await this.rightSidePanelButton.click();
}

async getWalletSyncStatusText(): Promise<string> {
return await this.midnightSyncStatus.getText();
}
}

export default new MenuHeader();
23 changes: 23 additions & 0 deletions packages/e2e-tests/src/elements/midnight/PasswordAuthPrompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* global WebdriverIO */
import { ChainablePromiseElement } from 'webdriverio';

class PasswordAuthPrompt {
private readonly PASSWORD_INPUT = '[data-testid="authentication-prompt-input"]';
private readonly CONFIRM_BUTTON = '[data-testid="authentication-prompt-button-confirm"]';

get passwordInput(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.PASSWORD_INPUT);
}

get confirmButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.CONFIRM_BUTTON);
}

async enterPasswordAndConfirm(password: string) {
await this.passwordInput.waitForDisplayed();
await this.passwordInput.setValue(password);
await this.confirmButton.click();
}
}

export default new PasswordAuthPrompt();
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* global WebdriverIO */
import CommonOnboardingElements from './commonOnboardingElements';
import { ChainablePromiseElement } from 'webdriverio';

class ConfigureMidnightPage extends CommonOnboardingElements {
private readonly NODE_ADDRESS_INPUT = '[data-testid="node-address-input"]';
private readonly NODE_ADDRESS_INPUT_LAEBL = '[data-testid="node-address-input"] + label';
private readonly PUB_SUB_INDEXER_ADDRESS_INPUT = '[data-testid="indexer-address-input"]';
private readonly PUB_SUB_INDEXER_ADDRESS_INPUT_LABEL = '[data-testid="indexer-address-input"] + label';
private readonly PROOF_SERVER_ADDRESS_OPTION_LOCAL =
'[data-testid="configure-midnight-proof-server-section-option-local"] label';
private readonly PROOF_SERVER_ADDRESS_LABEL = '[data-testid="configure-midnight-proof-server-section-label"]';
private readonly NETWORK_LABEL = '[data-testid="configure-midnight-network-section-label"]';
private readonly NETWORK_OPTION_UNDEPLOYED = '[data-testid="configure-midnight-network-section-option-0"] label';
private readonly NETWORK_OPTION_TESTNET = '[data-testid="configure-midnight-network-section-option-2"] label';

get enterWalletButton(): ChainablePromiseElement<WebdriverIO.Element> {
return this.nextButton;
}

get nodeAddressInput(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.NODE_ADDRESS_INPUT);
}

get indexerAddressInput(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.PUB_SUB_INDEXER_ADDRESS_INPUT);
}

get proofServerOptionLocal(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.PROOF_SERVER_ADDRESS_OPTION_LOCAL);
}

get nodeAddressInputLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.NODE_ADDRESS_INPUT_LAEBL);
}

get indexerAddressInputLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.PUB_SUB_INDEXER_ADDRESS_INPUT_LABEL);
}

get proofServerSectionLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.PROOF_SERVER_ADDRESS_LABEL);
}

get networkSectionLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.NETWORK_LABEL);
}

get networkOptionUndeployed(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.NETWORK_OPTION_UNDEPLOYED);
}

get networkOptionTestnet(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.NETWORK_OPTION_TESTNET);
}
}

export default new ConfigureMidnightPage();
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@
import { ChainablePromiseElement } from 'webdriverio';

export default class CommonOnboardingElements {
private STEP_HEADER = '[data-testid="wallet-setup-step-header"]';
private STEP_HEADER_TITLE = '[data-testid="wallet-setup-step-title"]';
private STEP_HEADER_SUBTITLE = '[data-testid="wallet-setup-step-subtitle"]';
private BACK_BUTTON = '[data-testid="wallet-setup-step-btn-back"]';
private NEXT_BUTTON = '[data-testid="wallet-setup-step-btn-next"]';
private HELP_AND_SUPPORT_BUTTON = '[data-testid="help-and-support-button"]';
private COOKIE_POLICY_LINK = '[data-testid="cookie-policy-link"]';
private PRIVACY_POLICY_LINK = '[data-testid="privacy-policy-link"]';
private TERMS_OF_SERVICE_LINK = '[data-testid="terms-of-service-link"]';
private ACTIVE_STEP_INDICATOR = '[data-testid="active-onboarding-step"]';
private readonly LACE_LOGO = '[data-testid="lace-logo"]';
private readonly STEP_HEADER = '[data-testid="wallet-setup-step-header"]';
private readonly STEP_HEADER_TITLE = '[data-testid="wallet-setup-step-title"]';
private readonly STEP_HEADER_SUBTITLE = '[data-testid="wallet-setup-step-subtitle"]';
private readonly BACK_BUTTON = '[data-testid="wallet-setup-step-btn-back"]';
private readonly NEXT_BUTTON = '[data-testid="wallet-setup-step-btn-next"]';
private readonly HELP_AND_SUPPORT_BUTTON = '[data-testid="help-and-support-button"]';
private readonly COOKIE_POLICY_LINK = '[data-testid="cookie-policy-link"]';
private readonly PRIVACY_POLICY_LINK = '[data-testid="privacy-policy-link"]';
private readonly TERMS_OF_SERVICE_LINK = '[data-testid="terms-of-service-link"]';
private readonly ACTIVE_STEP_INDICATOR = '[data-testid="active-onboarding-step"]';
private readonly COMPATIBILITY_LABEL = '[data-testid="compatibility-label"]';
private readonly MIDNIGHT_SYMBOL = '[data-testid="midnight-symbol"]';
private readonly MIDNIGHT_LABEL = '[data-testid="midnight-label"]';

get laceLogo(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.LACE_LOGO);
}

get stepHeader(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.STEP_HEADER);
Expand Down Expand Up @@ -53,6 +61,18 @@ export default class CommonOnboardingElements {
return $(this.ACTIVE_STEP_INDICATOR);
}

get compatibilityLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.COMPATIBILITY_LABEL);
}

get midnightSymbol(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_SYMBOL);
}

get midnightLabel(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.MIDNIGHT_LABEL);
}

async clickOnNextButton(): Promise<void> {
await this.nextButton.waitForClickable({ timeout: 12_000 });
await this.nextButton.click();
Expand Down
Loading
Loading