Files
trezor-suite/suite/e2e/support/pageObjects/metadata/outputMetadata.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

40 lines
1.4 KiB
TypeScript

import { expect } from '@playwright/test';
import { MetadataBase } from './metadataBase';
import { step } from '../../common';
export class OutputMetadata extends MetadataBase {
readonly outputLabel = (outputId: string, txNumber: number) =>
this.page.getByTestId(`${this.getLabelTestId(outputId, txNumber)}/hover-container`);
readonly outputMetadataInput = (outputId: string, txNumber: number) =>
this.outputLabel(outputId, txNumber).getByTestId(this.inputId);
private getLabelTestId(outputId: string, txNumber: number): string {
return `@metadata/outputLabel/${outputId}-${txNumber}`;
}
@step()
async clickAddLabelButton(outputId: string, txNumber: number) {
await this.page.resetMousePosition();
await expect(this.outputLabel(outputId, txNumber)).toHaveText(/[A-Za-z]+/);
await this.outputLabel(outputId, txNumber).hover();
await this.page.waitForTimeout(500); // edit button is unstable without this wait
await this.outputLabel(outputId, txNumber).getByTestId(this.editButtonId).click();
}
@step()
async changeLabel({
outputId,
txNumber,
label,
}: {
outputId: string;
txNumber: number;
label: string;
}) {
await this.clickAddLabelButton(outputId, txNumber);
await this.outputMetadataInput(outputId, txNumber).fill(label);
await this.page.keyboard.press('Enter');
}
}