Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(extension): remove redundant DApp connector POM #1663

Merged
merged 4 commits into from
Jan 29, 2025
Merged
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
8 changes: 4 additions & 4 deletions packages/e2e-tests/src/assert/dAppConnectorAssert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { browser } from '@wdio/globals';
import InsufficientFundsDAppPage from '../elements/dappConnector/insufficientFundsDAppPage';
import ErrorDAppModal from '../elements/dappConnector/errorDAppModal';
import { getTextFromElementArray } from '../utils/getTextFromArray';
import DAppConnectorPageObject from '../pageobject/dAppConnectorPageObject';
import { parseDappCucumberAssetList } from '../utils/dappConnectorUtils';
import DAppConnectorPageObject from '../utils/DAppConnectorUtils';
import { parseDAppCucumberAssetList } from '../utils/cucumberDataHelper';

export type ExpectedDAppDetails = {
hasLogo: boolean;
Expand Down Expand Up @@ -301,7 +301,7 @@ class DAppConnectorAssert {
);
await ConfirmTransactionPage.transactionFeeValueAda.waitForDisplayed();

const parsedAssetsList = await parseDappCucumberAssetList(assetsDetails);
const parsedAssetsList = await parseDAppCucumberAssetList(assetsDetails);
expect(await getTextFromElementArray(await ConfirmTransactionPage.transactionSummaryAssetsRows)).to.deep.equal(
parsedAssetsList
);
Expand All @@ -323,7 +323,7 @@ class DAppConnectorAssert {
}

async assertSeeConfirmFromAddressTransactionPage(section: 'To address' | 'From address', assets: string[]) {
const adjustedAssetsList = await parseDappCucumberAssetList(assets);
const adjustedAssetsList = await parseDAppCucumberAssetList(assets);
const expectedAssets =
section === 'To address'
? await ConfirmTransactionPage.getAssetsToAddressSection()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-undef */
import { ChainablePromiseElement } from 'webdriverio';
import { browser } from '@wdio/globals';

class AuthorizeDAppModal {
private CONTAINER = '[data-testid="connect-modal-container"]';
Expand Down Expand Up @@ -27,6 +28,12 @@ class AuthorizeDAppModal {
get onceButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.ONCE_BUTTON);
}

async clickButton(button: 'Always' | 'Only once'): Promise<void> {
await browser.pause(500);
await this.alwaysButton.waitForClickable();
button === 'Always' ? await this.alwaysButton.click() : await this.onceButton.click();
}
}

export default new AuthorizeDAppModal();
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class AuthorizeDAppPage extends CommonDappPageElements {
get cancelButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.CANCEL_BUTTON);
}

async clickButton(button: 'Authorize' | 'Cancel'): Promise<void> {
await this.authorizeButton.waitForClickable();
button === 'Authorize' ? await this.authorizeButton.click() : await this.cancelButton.click();
}
}

export default new AuthorizeDAppPage();
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import CommonDappPageElements from './commonDappPageElements';
import { ChainablePromiseArray } from 'webdriverio/build/types';
import { getTextFromElementArray } from '../../utils/getTextFromArray';
import testContext from '../../utils/testContext';
import { ChainablePromiseElement } from 'webdriverio';

class ConfirmTransactionPage extends CommonDappPageElements {
private TRANSACTION_TYPE_TITLE = '[data-testid="dapp-transaction-title"]';
Expand Down Expand Up @@ -33,71 +35,71 @@ class ConfirmTransactionPage extends CommonDappPageElements {
'[data-testid="dapp-transaction-from-section-expander"] [data-testid="address-tag"]';
private ADDRESS_TAG_TO_SECTION = '[data-testid="dapp-transaction-to-section-expander"] [data-testid="address-tag"]';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Expand All @@ -113,11 +115,11 @@ class ConfirmTransactionPage extends CommonDappPageElements {
return $$(this.TRANSACTION_TO_ROW);
}

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

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

Expand Down Expand Up @@ -148,6 +150,11 @@ class ConfirmTransactionPage extends CommonDappPageElements {
throw new Error(`Unsupported section name: ${section}`);
}
}

async saveDAppTransactionFeeValue() {
const [feeValue] = (await this.transactionFeeValueAda.getText()).split(' ');
await testContext.save('feeValueDAppTx', feeValue);
}
}

export default new ConfirmTransactionPage();
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class NoWalletModal {
get createRestoreButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.CREATE_RESTORE_BUTTON);
}

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

export default new NoWalletModal();
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class RemoveDAppModal {
get cancelButton(): ChainablePromiseElement<WebdriverIO.Element> {
return $(this.CANCEL_BUTTON);
}

async clickButton(button: 'Back' | 'Disconnect DApp'): Promise<void> {
await this.cancelButton.waitForClickable();
button === 'Back' ? await this.cancelButton.click() : await this.confirmButton.click();
}
}

export default new RemoveDAppModal();
4 changes: 2 additions & 2 deletions packages/e2e-tests/src/steps/commonSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { browser } from '@wdio/globals';
import faqPageAssert from '../assert/faqPageAssert';
import { visit } from '../utils/pageUtils';
import CommonDrawerElements from '../elements/CommonDrawerElements';
import DAppConnectorPageObject from '../pageobject/dAppConnectorPageObject';
import DAppConnectorUtils from '../utils/DAppConnectorUtils';
import settingsExtendedPageObject from '../pageobject/settingsExtendedPageObject';
import consoleManager from '../utils/consoleManager';
import consoleAssert from '../assert/consoleAssert';
Expand Down Expand Up @@ -290,7 +290,7 @@ Then(/^I close all remaining tabs except current one$/, async () => {
});

Then(/^I switch to window with (Lace|DApp)$/, async (window: 'Lace' | 'DApp') => {
await (window === 'Lace' ? switchToWindowWithLace() : DAppConnectorPageObject.switchToTestDAppWindow());
await (window === 'Lace' ? switchToWindowWithLace() : DAppConnectorUtils.switchToTestDAppWindow());
});

When(/^I resize the window to a width of: ([^"]*) and a height of: ([^"]*)$/, async (width: number, height: number) => {
Expand Down
Loading
Loading