Files
pezkuwi-apps/packages/page-addresses/test/pages/addressesPage.tsx
T
Satoshi Qazi Muhammed 3767c819e3 Accounts, Contacts and Sidebar specs: follow the current table layout, run them
The three suites were skipped since the table rework. What changed under them:

- An account or contact spans three rows (main, total balance, details),
  marked from isFirst; the helpers paired rows by two and filtered on a
  row class the rows no longer carry. A collapsed details row is hidden,
  so rows are read including hidden ones.
- Accounts render one table per account group; the page object reads the
  rows of every group table in order, and the sorting fixture keeps its
  three accounts in one group, since sorting applies within a group.
- The expand toggle is the row's expand column, not a row-toggle element.
- useAccountInfo reads ownership from the keyring context, which the test
  page did not provide, so saving a name did nothing; the page now renders
  the real KeyringCtxRoot. The mock api gains consts.system.ss58Prefix.
- Badge popups (react-tooltip v6) render only while hovered; the specs
  hover the badge first. The multisig badge needs the isMultisig flag.
- Addresses are shown in full and shortened by css; the fixtures with
  shortened addresses are gone.
- The total balance, transferable and locked cards are always shown, as
  placeholders without accounts; the specs check that instead of their
  absence.
- Checks that needed matchers the runner lacks (not.toHaveLength,
  toHaveProperty, toThrow with a contained message) are written against
  the DOM directly.
2026-10-10 16:28:39 +04:00

53 lines
1.6 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/app-addresses authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Row } from '@pezkuwi/test-support/pagesElements';
import type { AccountOverrides as ContactOverrides } from '@pezkuwi/test-support/types';
import React from 'react';
import { aContact } from '@pezkuwi/test-support/creation/contact';
import { Page } from '@pezkuwi/test-support/pages/Page';
import AddressOverview from '../../src/Contacts/index.js';
const NOOP_CHANGE = () => undefined;
export class AddressesPage extends Page {
constructor () {
super(
<AddressOverview onStatusChange={NOOP_CHANGE} />
);
}
async getAddressesRows (): Promise<Row[]> {
const addressesTable = await this.getTable();
return addressesTable.getRows();
}
renderDefaultContacts (contactsNumber: number): void {
const contacts = Array.from({ length: contactsNumber },
(_, index) => [this.defaultAddresses[index], aContact()] as [string, ContactOverrides]);
this.render(contacts);
}
renderContactsWithDefaultAddresses (...overrides: ContactOverrides[]): void {
const contacts = overrides.map((contactProperties, index) =>
[this.defaultAddresses[index], contactProperties] as [string, ContactOverrides]);
this.render(contacts);
}
renderContactsForAddresses (...addresses: string[]): void {
const contacts = addresses.map((address) => [address, aContact()] as [string, ContactOverrides]);
this.render(contacts);
}
renderContacts (contacts: [string, ContactOverrides][]): void {
this.render(contacts);
}
}