Skip to content

Commit

Permalink
Merge branch 'development' into TW-823-e2e-Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsx committed Dec 7, 2023
2 parents b15335d + da22d25 commit 04e7022
Show file tree
Hide file tree
Showing 94 changed files with 1,205 additions and 502 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[production]
chrome >= 49
chrome >= 103
firefox >= 52
opera >= 36
safari >= 14
Expand Down
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
}
},
"ignorePatterns": "src/**/*.embed.js",
"rules": {
"prettier/prettier": "error",
"prefer-const": "error",
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start:manage_assets": "yarn start --tags @manage_assets",
"start:home": "yarn start --tags @home",
"start:create_new_wallet": "yarn start --tags @create_new_wallet",
"start:delegate": "yarn start --tags @create_new_wallet",
"start:delegate": "yarn start --tags @delegate",
"start:import_account_mnemonic": "yarn start --tags @import_account_mnemonic",
"start:import_account_private_key": "yarn start --tags @import_account_private_key",
"start:import_account_public_key": "yarn start --tags @import_account_public_key",
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/classes/page.class.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BrowserContext } from 'e2e/src/classes/browser-context.class';

export abstract class Page {
abstract isVisible(): void;
abstract isVisible(timeout?: number): void;

scrollTo(topPositionPx: number) {
return BrowserContext.page.evaluate(top => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/src/features/delegate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Feature: Delegate
Scenario: As a user, i'd like to re-delegate TEZ to a baker
Given I have imported an existing account
And I press Selected Network Button on the Header page
And I select ECAD Labs Mainnet node in the networks drop-down list on the Header page
And I check that ECAD Labs Mainnet node is selected correctly
And I select Marigold Mainnet node in the networks drop-down list on the Header page
And I check that Marigold Mainnet node is selected correctly
And I press Asset Item Apy Button on the Assets page

And I am on the DelegateTab page
Expand Down
18 changes: 7 additions & 11 deletions e2e/src/features/manage-tokens-collectibles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Feature: Manage tokens + collectibles

And I am on the AddAsset page
And I enter customTokenContractAddress into Address Input on the Add Asset page
And I wait until other inputs load after entering a token address
And I wait until adding asset customTokenName is preloaded
And I scroll 500 pixels on the AddAsset page
And I press Add Asset Button on the Add Asset page

And I am on the Token page
And I check that KLL page with Killer token displayed or selected correctly
And I check that customTokenSymbol page with customTokenName token displayed or selected correctly
And I press Temple Logo Icon on the Header page

And I am on the Home page
Expand Down Expand Up @@ -112,14 +112,14 @@ Feature: Manage tokens + collectibles
And I got the validation-error 'Required' in the Address Input Section on the Add Asset page

And I enter customTokenContractAddress into Address Input on the Add Asset page
And I wait until other inputs load after entering a token address
And I wait until adding asset customTokenName is preloaded
And I scroll 150 pixels on the AddAsset page

# Failed parse metadata alert
And I enter amount_1 into Asset ID Input on the Add Asset page
And I got the 'Failed to parse metadata' warning with Alert title Text element on the Alert page
And I clear Asset ID Input value on the Add Asset page
And I wait until other inputs load after entering a token address
And I wait until adding asset customTokenName is preloaded

# Symbol input.
And I clear Symbol Input value on the Add Asset page
Expand All @@ -138,14 +138,10 @@ Feature: Manage tokens + collectibles
And I clear Name Input value on the Add Asset page
And I got the validation-error 'Required' in the Name Input Section on the Add Asset page
And I enter amount_1 into Name Input on the Add Asset page
And I got the validation-error 'No special characters, 3-25 length' in the Name Input Section on the Add Asset page
And I got the validation-error '3-25 length' in the Name Input Section on the Add Asset page

And I enter longRandomContent into Name Input on the Add Asset page
And I got the validation-error 'No special characters, 3-25 length' in the Name Input Section on the Add Asset page
And I clear Name Input value on the Add Asset page

And I enter specialSymbolsContent into Name Input on the Add Asset page
And I got the validation-error 'No special characters, 3-25 length' in the Name Input Section on the Add Asset page
And I got the validation-error '3-25 length' in the Name Input Section on the Add Asset page
And I clear Name Input value on the Add Asset page

And I enter customTokenName into Name Input on the Add Asset page
Expand All @@ -168,7 +164,7 @@ Feature: Manage tokens + collectibles
And I press Add Asset Button on the Add Asset page

And I am on the Token page
And I check that KLL page with Killer token displayed or selected correctly
And I check that customTokenSymbol page with customTokenName token displayed or selected correctly
And I press Temple Logo Icon on the Header page

And I am on the Home page
Expand Down
4 changes: 2 additions & 2 deletions e2e/src/features/send.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Feature: Send
Scenario: As a user, I'd like to send my funds to another account
Given I have imported an existing account
And I press Selected Network Button on the Header page
And I select ECAD Labs Mainnet node in the networks drop-down list on the Header page
And I check that ECAD Labs Mainnet node is selected correctly
And I select Marigold Mainnet node in the networks drop-down list on the Header page
And I check that Marigold Mainnet node is selected correctly
And I press Send Button on the Home page

And I am on the Send page
Expand Down
4 changes: 2 additions & 2 deletions e2e/src/features/swap.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Feature: Swap
Scenario: As a user, i'd like to swap assets
Given I have imported an existing account
And I press Selected Network Button on the Header page
And I select ECAD Labs Mainnet node in the networks drop-down list on the Header page
And I check that ECAD Labs Mainnet node is selected correctly
And I select Marigold Mainnet node in the networks drop-down list on the Header page
And I check that Marigold Mainnet node is selected correctly
And I press Swap Button on the Home page

And I am on the Swap page
Expand Down
6 changes: 2 additions & 4 deletions e2e/src/page-objects/pages/add-asset.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ export class AddAssetPage extends Page {
await this.assetIDInput.waitForDisplayed();
}

async waitForOtherInputs() {
await this.addressInput.waitForDisplayed();
await this.assetIDInput.waitForDisplayed();
async waitAddingAssetPreloaded(assetName: string) {
await this.addAssetButton.waitForDisplayed();
await this.symbolInput.waitForDisplayed();
await this.nameInput.waitForDisplayed();
await this.nameInput.waitForText(assetName);
await this.decimalsInput.waitForDisplayed();
await this.iconURLInput.waitForDisplayed();
}
Expand Down
12 changes: 6 additions & 6 deletions e2e/src/page-objects/pages/drop-down-lists/networks.drop-down.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ export class NetworksDropDown extends Page {
await this.networkItemButton.waitForDisplayed(timeout);
}

async selectNetwork(name: string) {
const networkItemElem = await findElement(NetworkSelectSelectors.networkItemButton, { name });

await networkItemElem.click();
}

async isClosed() {
await retry(
() =>
Expand All @@ -30,4 +24,10 @@ export class NetworksDropDown extends Page {
RETRY_OPTIONS
);
}

async selectNetwork(name: string) {
const networkItemElem = await findElement(NetworkSelectSelectors.networkItemButton, { name });

await networkItemElem.click();
}
}
4 changes: 2 additions & 2 deletions e2e/src/page-objects/pages/newsletter-modal.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class NewsletterModalPage extends Page {
emailInput = createPageElement(NewsletterOverlaySelectors.emailInput);
subscribeButton = createPageElement(NewsletterOverlaySelectors.subscribeButton);

async isVisible() {
await this.closeButton.waitForDisplayed();
async isVisible(timeout?: number) {
await this.closeButton.waitForDisplayed(timeout);
await this.emailInput.waitForDisplayed();
await this.subscribeButton.waitForDisplayed();
}
Expand Down
2 changes: 2 additions & 0 deletions e2e/src/page-objects/pages/send.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ export class SendPage extends Page {
const tokenItemElem = await findElement(SendFormSelectors.assetDropDownItem, { slug });

await tokenItemElem.click();

await createPageElement(SendFormSelectors.assetDropDownSelect, { slug }).waitForDisplayed();
}
}
7 changes: 4 additions & 3 deletions e2e/src/step-definitions/common.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Given } from '@cucumber/cucumber';

import { BrowserContext } from '../classes/browser-context.class';
import { Pages } from '../page-objects';
import { clearDataFromCurrentInput, iEnterValues, IEnterValuesKey } from '../utils/input-data.utils';
import { iEnterValues, IEnterValuesKey, clearDataFromCurrentInput } from '../utils/input-data.utils';
import { createPageElement } from '../utils/search.utils';
import { LONG_TIMEOUT, MEDIUM_TIMEOUT, SHORT_TIMEOUT } from '../utils/timing.utils';

Expand All @@ -18,7 +18,8 @@ Given(
/I clear (.*) value on the (.*) page/,
{ timeout: MEDIUM_TIMEOUT },
async (elementName: string, pageName: string) => {
await createPageElement(`${pageName}/${elementName}`).click();
const element = createPageElement(`${pageName}/${elementName}`);
await element.click();
await clearDataFromCurrentInput();
}
);
Expand Down Expand Up @@ -49,7 +50,7 @@ Given(/I have imported an existing account/, { timeout: LONG_TIMEOUT }, async ()
await Pages.SetWallet.acceptTerms.click();
await Pages.SetWallet.importButton.click();

await Pages.NewsletterModal.isVisible();
await Pages.NewsletterModal.isVisible(LONG_TIMEOUT);
await Pages.NewsletterModal.closeButton.click();

await Pages.Home.isVisible();
Expand Down
4 changes: 2 additions & 2 deletions e2e/src/step-definitions/create-or-restore-account.steps.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Given } from '@cucumber/cucumber';
import { expect } from 'chai';

import { iEnterValues } from 'e2e/src/utils/input-data.utils';
import { IEnterValuesKey, iEnterValues } from 'e2e/src/utils/input-data.utils';
import { MEDIUM_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { Pages } from '../page-objects';

Given(
/I check if (.*) is edited name for created account/,
{ timeout: MEDIUM_TIMEOUT },
async (editedName: keyof typeof iEnterValues) => {
async (editedName: IEnterValuesKey) => {
const nameOfCreatedAccount = await Pages.Home.accountNameText.getText();

expect(nameOfCreatedAccount).eql(iEnterValues[editedName]);
Expand Down
8 changes: 4 additions & 4 deletions e2e/src/step-definitions/custom-network.steps.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Given } from '@cucumber/cucumber';

import { Pages } from 'e2e/src/page-objects';
import { iEnterValues } from 'e2e/src/utils/input-data.utils';
import { IEnterValuesKey, iEnterValues } from 'e2e/src/utils/input-data.utils';
import { MEDIUM_TIMEOUT } from 'e2e/src/utils/timing.utils';

Given(
/I check if added custom network = '(.*)' is displayed on 'Current networks' list/,
{ timeout: MEDIUM_TIMEOUT },
async (networkUrl: keyof typeof iEnterValues) => {
async (networkUrl: IEnterValuesKey) => {
const customNetworkUrl = iEnterValues[networkUrl];

if (customNetworkUrl === undefined) throw new Error(`${networkUrl} key doesn't exist in the 'iEnterValues' object`);
Expand All @@ -19,7 +19,7 @@ Given(
Given(
/I find an added custom network = '(.*)' and click to delete it/,
{ timeout: MEDIUM_TIMEOUT },
async (networkUrl: keyof typeof iEnterValues) => {
async (networkUrl: IEnterValuesKey) => {
const customNetworkUrl = iEnterValues[networkUrl];

if (customNetworkUrl === undefined) throw new Error(`${networkUrl} key doesn't exist in the 'iEnterValues' object`);
Expand All @@ -31,7 +31,7 @@ Given(
Given(
/I check if added custom network = '(.*)' is deleted from the 'Current networks' list/,
{ timeout: MEDIUM_TIMEOUT },
async (networkUrl: keyof typeof iEnterValues) => {
async (networkUrl: IEnterValuesKey) => {
const customNetworkUrl = iEnterValues[networkUrl];

if (customNetworkUrl === undefined) throw new Error(`${networkUrl} key doesn't exist in the 'iEnterValues' object`);
Expand Down
10 changes: 5 additions & 5 deletions e2e/src/step-definitions/manage-tokens-collectibles.steps.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { Given } from '@cucumber/cucumber';

import { iSelectTokenSlugs } from 'e2e/src/utils/input-data.utils';
import { IEnterValuesKey, iEnterValues, iSelectTokenSlugs } from 'e2e/src/utils/input-data.utils';
import { MEDIUM_TIMEOUT } from 'e2e/src/utils/timing.utils';

import { Pages } from '../page-objects';

Given(/I wait until other inputs load after entering a token address/, { timeout: MEDIUM_TIMEOUT }, async () => {
await Pages.AddAsset.waitForOtherInputs();
Given(/I wait until adding asset (.*) is preloaded/, { timeout: MEDIUM_TIMEOUT }, async (name: IEnterValuesKey) => {
await Pages.AddAsset.waitAddingAssetPreloaded(iEnterValues[name]);
});

Given(
/I check that (.*) page with (.*) token displayed or selected correctly/,
// Token page has token symbol as page name and token name has its full name in asset banner component
{ timeout: MEDIUM_TIMEOUT },
async (symbol: string, name: string) => {
await Pages.Token.isCorrectPageSelected(symbol, name);
async (symbol: IEnterValuesKey, name: IEnterValuesKey) => {
await Pages.Token.isCorrectPageSelected(iEnterValues[symbol], iEnterValues[name]);
}
);

Expand Down
14 changes: 5 additions & 9 deletions e2e/src/step-definitions/swap.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SwapFormSelectors } from 'src/app/templates/SwapForm/SwapForm.selectors
import { Pages } from 'e2e/src/page-objects';
import { iSelectTokenSlugs } from 'e2e/src/utils/input-data.utils';
import { createPageElement } from 'e2e/src/utils/search.utils';
import { MEDIUM_TIMEOUT, VERY_LONG_TIMEOUT, VERY_SHORT_TIMEOUT } from 'e2e/src/utils/timing.utils';
import { MEDIUM_TIMEOUT, VERY_LONG_TIMEOUT, SHORT_TIMEOUT } from 'e2e/src/utils/timing.utils';

Given(
/I select (.*) token in the token drop-down list on the Swap page/,
Expand All @@ -19,14 +19,10 @@ Given(
);

Given(/I click on animated Swap button on the Swap page/, { timeout: MEDIUM_TIMEOUT }, async () => {
const elem = createPageElement(SwapFormSelectors.swapButton, undefined, { loading: '' });
const swapBtnElem = createPageElement(SwapFormSelectors.swapButton, undefined, { loading: '' });
const confirmButton = createPageElement(InternalConfirmationSelectors.confirmButton);

await retry(
async () => {
await elem.click();
await confirmButton.waitForDisplayed(VERY_SHORT_TIMEOUT);
},
{ retries: 3 }
);
await retry(() => swapBtnElem.click(), { retries: 3 });

await confirmButton.waitForDisplayed(SHORT_TIMEOUT);
});
10 changes: 5 additions & 5 deletions e2e/src/utils/input-data.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const iEnterValues = {
// For input validation
shortRandomContent: generateRandomContent(),
longRandomContent: 'long random content for test + long +' + generateRandomContent(),
specialSymbolsContent: '#$%^&*&^()',
сyrillicContent: 'привіт привіт ',

// For adding assets, contacts, etc ...
Expand All @@ -59,10 +58,11 @@ export const iEnterValues = {
secondCustomNetworkRPC: envVars.CUSTOM_NETWORK_SECOND_RPC_URL,
customTestName: 'Custom Test Net',

customTokenContractAddress: 'KT1Td6a28ydPMXKJS5yS5Usadj4Qx5drsCfY', // 'KLL (Killer) token'
customTokenSymbol: 'KLL', // 'KLL (Killer) token'
customTokenName: 'Killer', // 'KLL (Killer) token'
customTokenIconURL: 'https://i.imgur.com/2s1WRni.png', // 'KLL (Killer) token'
// 'KLL (Killer) token'
customTokenContractAddress: 'KT1Td6a28ydPMXKJS5yS5Usadj4Qx5drsCfY',
customTokenSymbol: 'KLL',
customTokenName: 'Killer',
customTokenIconURL: 'https://i.imgur.com/2s1WRni.png',

// For transactions
amount_0_0001: '0.0001',
Expand Down
Loading

0 comments on commit 04e7022

Please sign in to comment.