Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/lw-10259-improve…
Browse files Browse the repository at this point in the history
…-copy-paste-mnemonics
  • Loading branch information
szymonmaslowski committed Apr 30, 2024
2 parents 2c53ca9 + 7ffd2f2 commit e37c219
Show file tree
Hide file tree
Showing 20 changed files with 651 additions and 129 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ on:
branches:
- 'release/**'

permissions:
pull-requests: write
actions: read

jobs:
buildAndTest:
name: Build & Test
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Collect Workflow Telemetry Build Packages
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Decrypt test data
working-directory: ./packages/e2e-tests
run: ./decrypt_secret.sh
Expand All @@ -33,7 +41,7 @@ jobs:
AVAILABLE_CHAINS: 'Preprod,Preview,Mainnet'
DEFAULT_CHAIN: 'Preprod'
NODE_OPTIONS: '--max_old_space_size=8192'
run: yarn test --maxWorkers=2 --silent
run: yarn test --silent
- name: Upload build
uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
workflow_dispatch:

permissions:
pull-requests: write
actions: read

env:
TAGS: '@Smoke and @Testnet'
BROWSER: 'chrome'
Expand All @@ -17,6 +21,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Collect Workflow Telemetry Build Packages
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Decrypt test data
working-directory: ./packages/e2e-tests
run: ./decrypt_secret.sh
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.1
v20.12.2
2 changes: 1 addition & 1 deletion apps/browser-extension-wallet/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.1
v20.12.2
4 changes: 3 additions & 1 deletion packages/common/src/ui/components/Form/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type inputProps = {
label?: string;
invalid?: boolean;
focus?: boolean;
labelClassName?: string;
} & InputProps;

export const Input = ({
Expand All @@ -21,6 +22,7 @@ export const Input = ({
invalid,
value,
focus,
labelClassName = '',
...props
}: inputProps): React.ReactElement => {
const inputRef = useRef();
Expand All @@ -42,7 +44,7 @@ export const Input = ({
onChange={onValChange}
{...(label && {
prefix: (
<div className={cn(styles.label, { [styles.filled]: localVal })} data-testid="input-label">
<div className={cn(styles.label, { [styles.filled]: localVal }, labelClassName)} data-testid="input-label">
{label}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
.formError {
color: var(--data-pink);
}

.label {
z-index: 0 !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export const WalletSetupSelectAccountsStepRevamp = ({
<div>
<Input
dataTestId="wallet-setup-register-name-input"
className={styles.inputName}
label={t('core.walletSetupSelectAccountsStep.walletName')}
value={walletName}
onChange={handleNameChange}
labelClassName={styles.label}
/>
{isDirty && walletName && !isNameValid && (
<p className={styles.formError} data-testid="wallet-setup-register-name-error">
Expand Down
20 changes: 10 additions & 10 deletions packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"@types/puppeteer": "7.0.4",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"@wdio/allure-reporter": "8.32.2",
"@wdio/cli": "8.32.3",
"@wdio/config": "8.32.3",
"@wdio/cucumber-framework": "8.32.3",
"@wdio/devtools-service": "8.32.3",
"@wdio/local-runner": "8.32.3",
"@wdio/spec-reporter": "8.32.2",
"@wdio/types": "8.32.2",
"allure-commandline": "2.24.1",
"@wdio/allure-reporter": "8.36.1",
"@wdio/cli": "8.36.1",
"@wdio/config": "8.36.1",
"@wdio/cucumber-framework": "8.36.1",
"@wdio/devtools-service": "8.36.1",
"@wdio/local-runner": "8.36.1",
"@wdio/spec-reporter": "8.36.1",
"@wdio/types": "8.36.1",
"allure-commandline": "2.29.0",
"clipboardy": "2.3.0",
"eslint": "8.38.0",
"eslint-config-airbnb-base": "15.0.0",
Expand All @@ -53,6 +53,6 @@
"ts-node": "10.9.1",
"typescript": "4.9.5",
"wdio-intercept-service": "4.4.0",
"webdriverio": "8.32.3"
"webdriverio": "8.36.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import testContext from '../../utils/testContext';
import { StakePoolGridCard } from '../../elements/multidelegation/StakePoolGridCard';
import { StakePoolListColumnName } from '../../types/staking';
import { SortingOrder } from '../../types/sortingOrder';
import { mapColumnNameStringToEnum, sortColumnContent } from '../../utils/stakePoolListContent';
import {
mapColumnNameStringToEnum,
mapSortingOptionToColumnNameEnum,
sortColumnContent
} from '../../utils/stakePoolListContent';
import { StakePoolListColumn } from '../../enums/StakePoolListColumn';
import { StakePoolSortingOption } from '../../enums/StakePoolSortingOption';

class MultidelegationPageAssert {
assertSeeStakingOnPoolsCounter = async (poolsCount: number) => {
Expand Down Expand Up @@ -312,9 +317,18 @@ class MultidelegationPageAssert {
).waitForDisplayed();
};

assertSeeSortingOptionOrderButton = async (
sortingOption: StakePoolSortingOption,
order: 'ascending' | 'descending'
) => {
await (
await MultidelegationPage.moreOptionsComponent.getSortingOptionOrderButton(sortingOption, order)
).waitForDisplayed();
};

assertSeeStakePoolsSorted = async (
stakePoolsDisplayType: 'list rows' | 'cards',
sortingOption: StakePoolListColumnName,
sortingOption: StakePoolSortingOption,
order: SortingOrder,
poolLimit?: number
) => {
Expand All @@ -325,19 +339,55 @@ class MultidelegationPageAssert {
throw new Error('Please add validation for grid cards sorting');
} else {
const columnContent = await MultidelegationPage.extractColumnContent(
mapColumnNameStringToEnum(sortingOption),
mapSortingOptionToColumnNameEnum(sortingOption),
poolLimit
);
const sortedColumnContent = await sortColumnContent(
columnContent,
mapColumnNameStringToEnum(sortingOption),
mapSortingOptionToColumnNameEnum(sortingOption),
order
);

expect(columnContent).to.not.be.empty;
expect(columnContent).to.deep.equal(sortedColumnContent);
}
};

assertSeeTooltipForSortingOption = async (sortingOption: StakePoolSortingOption) => {
await browser.pause(800); // Those tooltips are displayed after delay
await MultidelegationPage.sortingOptionTooltip.waitForStable();
await MultidelegationPage.sortingOptionTooltip.waitForDisplayed();
let expectedTooltipText;
switch (sortingOption) {
case StakePoolSortingOption.Ticker:
expectedTooltipText = await t('browsePools.tooltips.ticker', 'staking');
break;
case StakePoolSortingOption.Saturation:
expectedTooltipText = await t('browsePools.tooltips.saturation', 'staking');
break;
case StakePoolSortingOption.ROS:
expectedTooltipText = await t('browsePools.tooltips.ros', 'staking');
break;
case StakePoolSortingOption.Cost:
expectedTooltipText = await t('browsePools.tooltips.cost', 'staking');
break;
case StakePoolSortingOption.Margin:
expectedTooltipText = await t('browsePools.tooltips.margin', 'staking');
break;
case StakePoolSortingOption.ProducedBlocks:
expectedTooltipText = await t('browsePools.tooltips.blocks', 'staking');
break;
case StakePoolSortingOption.Pledge:
expectedTooltipText = await t('browsePools.tooltips.pledge', 'staking');
break;
case StakePoolSortingOption.LiveStake:
expectedTooltipText = await t('browsePools.tooltips.liveStake', 'staking');
break;
default:
throw new Error(`Unsupported column name: ${sortingOption}`);
}
expect(await MultidelegationPage.sortingOptionTooltip.getText()).to.equal(expectedTooltipText);
};
}

export default new MultidelegationPageAssert();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SortingOption } from './SortingOption';
import { StakePoolSortingOptionType } from '../../types/staking';
import { StakePoolSortingOption } from '../../enums/StakePoolSortingOption';

class MoreOptionsComponent {
private MORE_OPTIONS_LABEL = '[data-testid="stake-pools-more-options-label"]';
Expand Down Expand Up @@ -70,35 +70,104 @@ class MoreOptionsComponent {
return $(this.ROS_FILTER_LABEL);
}

async selectSortingOption(sortingOption: StakePoolSortingOptionType) {
async getSortingOptionOrderButton(sortingOption: StakePoolSortingOption, order: 'ascending' | 'descending') {
return $(this.getSortingOptionButtonSelector(sortingOption, order));
}

async hoverOverSortingOption(sortingOption: StakePoolSortingOption) {
switch (sortingOption) {
case 'Ticker':
case StakePoolSortingOption.Ticker:
await this.tickerOption.label.moveTo();
break;
case StakePoolSortingOption.Saturation:
await this.saturationOption.label.moveTo();
break;
case StakePoolSortingOption.ROS:
await this.rosOption.label.moveTo();
break;
case StakePoolSortingOption.Cost:
await this.costOption.label.moveTo();
break;
case StakePoolSortingOption.Margin:
await this.marginOption.label.moveTo();
break;
case StakePoolSortingOption.ProducedBlocks:
await this.blocksOption.label.moveTo();
break;
case StakePoolSortingOption.Pledge:
await this.pledgeOption.label.moveTo();
break;
case StakePoolSortingOption.LiveStake:
await this.liveStakeOption.label.moveTo();
break;
default:
throw new Error(`Unsupported sorting option: ${sortingOption}`);
}
}

async selectSortingOption(sortingOption: StakePoolSortingOption) {
switch (sortingOption) {
case StakePoolSortingOption.Ticker:
await this.tickerOption.radioButton.click();
break;
case 'Saturation':
case StakePoolSortingOption.Saturation:
await this.saturationOption.radioButton.click();
break;
case 'ROS':
case StakePoolSortingOption.ROS:
await this.rosOption.radioButton.click();
break;
case 'Cost':
case StakePoolSortingOption.Cost:
await this.costOption.radioButton.click();
break;
case 'Margin':
case StakePoolSortingOption.Margin:
await this.marginOption.radioButton.click();
break;
case 'Produced blocks':
case StakePoolSortingOption.ProducedBlocks:
await this.blocksOption.radioButton.click();
break;
case 'Pledge':
case StakePoolSortingOption.Pledge:
await this.pledgeOption.radioButton.click();
break;
case 'Live Stake':
case StakePoolSortingOption.LiveStake:
await this.liveStakeOption.radioButton.click();
break;
default:
throw new Error(`Unsupported column name: ${sortingOption}`);
throw new Error(`Unsupported sorting option: ${sortingOption}`);
}
}

private getSortingOptionButtonSelector(
sortingOption: StakePoolSortingOption,
order: 'ascending' | 'descending'
): string {
const orderSelector = order === 'ascending' ? '[data-testid="sort-asc"]' : '[data-testid="sort-desc"]';
const selectorTemplate = `#radio-btn-sorting-id-###option### ${orderSelector}`;
let option;
switch (sortingOption) {
case StakePoolSortingOption.Ticker:
case StakePoolSortingOption.Saturation:
case StakePoolSortingOption.ROS:
case StakePoolSortingOption.Cost:
case StakePoolSortingOption.Margin:
case StakePoolSortingOption.Pledge:
option = String(sortingOption).toLowerCase();
break;
case StakePoolSortingOption.ProducedBlocks:
option = 'blocks';
break;
case StakePoolSortingOption.LiveStake:
option = 'liveStake';
break;
default:
throw new Error(`Unsupported sorting option: ${sortingOption}`);
}
return selectorTemplate.replace('###option###', option);
}

async clickOnOrderButtonForSortingOption(order: 'ascending' | 'descending', sortingOption: StakePoolSortingOption) {
const selector = this.getSortingOptionButtonSelector(sortingOption, order);
await $(selector).moveTo();
await $(selector).click();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class MultidelegationPage {
private DELEGATED_POOL_LAST_REWARDS_VALUE = '[data-testid="stats-last-reward-container"] [data-testid="stats-value"]';
private STAKING_POOL_INFO = '[data-testid="staking-pool-info"]';
private TOOLTIP = 'div.ant-tooltip-inner';
private SORTING_OPTION_TOOLTIP = '[class^="tooltip-root"]';
private CHECKBOX = '[data-testid="stake-pool-list-checkbox"]';
private MANAGE_BTN = '[data-testid="manage-btn"]';
private GRID_VIEW_TOGGLE = '[data-testid="grid-view-toggle"]';
Expand Down Expand Up @@ -212,6 +213,10 @@ class MultidelegationPage {
return $(this.TOOLTIP);
}

get sortingOptionTooltip() {
return $(this.SORTING_OPTION_TOOLTIP);
}

get manageBtn() {
return $(this.MANAGE_BTN);
}
Expand Down
11 changes: 11 additions & 0 deletions packages/e2e-tests/src/enums/StakePoolSortingOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable no-unused-vars */
export enum StakePoolSortingOption {
Ticker = 'Ticker',
Saturation = 'Saturation',
ROS = 'ROS',
Cost = 'Cost',
Margin = 'Margin',
ProducedBlocks = 'Produced blocks',
Pledge = 'Pledge',
LiveStake = 'Live Stake'
}
Loading

0 comments on commit e37c219

Please sign in to comment.