mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-11-09 00:37:07 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
commit
d21bfb1320
5867 files changed
+329019
No files matched your search
@@ -0,0 +1,100 @@
|
||||
// Copyright 2017-2025 @pezkuwi/test-supports authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global expect */
|
||||
|
||||
import type { Balance } from '@pezkuwi/types/interfaces';
|
||||
|
||||
import { fireEvent, screen, within } from '@testing-library/react';
|
||||
|
||||
import { format } from '../utils/balance.js';
|
||||
import { Sidebar } from './Sidebar.js';
|
||||
|
||||
// utility wrapper over an account item in accounts table, serves basic assertions about an account row
|
||||
export class Row {
|
||||
public primaryRow: HTMLElement;
|
||||
public detailsRow: HTMLElement;
|
||||
|
||||
constructor (primaryRow: HTMLElement, detailsRow: HTMLElement) {
|
||||
this.primaryRow = primaryRow;
|
||||
this.detailsRow = detailsRow;
|
||||
}
|
||||
|
||||
async assertBalancesTotal (expectedTotalBalance: Balance): Promise<void> {
|
||||
const actualBalanceText = await this.getBalanceSummary();
|
||||
const expectedBalanceText = format(expectedTotalBalance);
|
||||
|
||||
expect(actualBalanceText).toHaveTextContent(expectedBalanceText);
|
||||
}
|
||||
|
||||
async getBalanceSummary (): Promise<HTMLElement> {
|
||||
return within(this.primaryRow).findByTestId('balance-summary');
|
||||
}
|
||||
|
||||
async assertAccountName (expectedName: string): Promise<void> {
|
||||
const accountName = await this.getAccountName();
|
||||
|
||||
expect(accountName).toHaveTextContent(expectedName);
|
||||
}
|
||||
|
||||
async assertBalancesDetails (expectedBalanceComponents: { name: string, amount: Balance }[]): Promise<void> {
|
||||
for (const { amount, name } of expectedBalanceComponents) {
|
||||
await this.assertBalanceComponent({ amount, name });
|
||||
}
|
||||
}
|
||||
|
||||
async assertBadge (expectedBadgeName: string): Promise<void> {
|
||||
await within(this.primaryRow).findByTestId(expectedBadgeName);
|
||||
}
|
||||
|
||||
assertNoBadge (badgeName: string): void {
|
||||
expect(within(this.primaryRow).queryByTestId(badgeName)).toBeFalsy();
|
||||
}
|
||||
|
||||
async assertTags (expectedTagsContent: string): Promise<void> {
|
||||
const actualTags = await within(this.detailsRow).findByTestId('tags');
|
||||
|
||||
expect(actualTags).toHaveTextContent(expectedTagsContent);
|
||||
}
|
||||
|
||||
async assertShortAddress (expectedShortAddress: string): Promise<void> {
|
||||
const actualShortAddress = await within(this.primaryRow).findByTestId('short-address');
|
||||
|
||||
expect(actualShortAddress).toHaveTextContent(expectedShortAddress);
|
||||
}
|
||||
|
||||
async expand (): Promise<void> {
|
||||
const toggle = await within(this.primaryRow).findByTestId('row-toggle');
|
||||
|
||||
fireEvent.click(toggle);
|
||||
}
|
||||
|
||||
async getBadge (expectedBadgeName: string): Promise<HTMLElement> {
|
||||
return within(this.primaryRow).findByTestId(`${expectedBadgeName}-badge`);
|
||||
}
|
||||
|
||||
async openSidebar (): Promise<Sidebar> {
|
||||
const accountName = await this.getAccountName();
|
||||
|
||||
fireEvent.click(accountName);
|
||||
|
||||
return new Sidebar(await screen.findByTestId('account-sidebar'));
|
||||
}
|
||||
|
||||
private async assertBalanceComponent (expectedBalanceComponent: { name: string; amount: Balance }): Promise<void> {
|
||||
const balanceElement = await this.getBalanceElementByLabelName(expectedBalanceComponent.name);
|
||||
const balanceText = format(expectedBalanceComponent.amount);
|
||||
|
||||
expect(balanceElement).toHaveTextContent(balanceText);
|
||||
}
|
||||
|
||||
private async getBalanceElementByLabelName (labelName: string): Promise<ChildNode | null> {
|
||||
const labelElement = await within(this.detailsRow).findByText(labelName);
|
||||
|
||||
return labelElement.nextSibling;
|
||||
}
|
||||
|
||||
private getAccountName (): Promise<HTMLElement> {
|
||||
return within(this.primaryRow).findByTestId('account-name');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user