Files
trezor-suite/suite/e2e/support/pageObjects/metadata/walletMetadata.ts
Martin Vere Cihlar ebbccbb052 test(e2e-suite): rework suit-sync test
test focuses on label creation and sync to server
2026-02-11 17:19:40 +01:00

35 lines
1.4 KiB
TypeScript

import { expect } from '@playwright/test';
import { MetadataBase } from './metadataBase';
import { step } from '../../common';
export class WalletMetadata extends MetadataBase {
readonly walletLabel = (index: number) => this.walletOnIndex(index).getByTestId(this.inputId);
readonly walletOnIndex = (index: number) =>
this.page.getByTestId(`@switch-device/wallet-on-index/${index}`);
readonly labelChangeSuccessIcon = (index: number) =>
this.walletOnIndex(index).getByTestId(this.successId);
@step()
async clickEditLabel(index: number) {
await this.page.resetMousePosition();
// ensure wallet label is loaded - test can be too fast
await expect(this.walletLabel(index)).toHaveText(/[A-Za-z]+/);
await this.walletOnIndex(index).getByTestId(this.inputId).hover();
await this.walletOnIndex(index).getByTestId(this.editButtonId).click();
}
@step()
async successIconIsVisible(standardWalletIndex: number) {
await expect(this.labelChangeSuccessIcon(standardWalletIndex)).toBeVisible();
await expect(this.labelChangeSuccessIcon(standardWalletIndex)).toBeHidden();
}
@step()
async changeLabel({ index, label }: { index: number; label: string }) {
await this.clickEditLabel(index);
await this.fillLabelInput(label);
await this.successIconIsVisible(index);
}
}