mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-11-22 05:49:56 +00:00
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.
This commit is contained in:
1 parent
61c681567d
commit
3767c819e3
11 files changed
+136
-107
No files matched your search
@@ -16,6 +16,7 @@ import { ThemeProvider } from 'styled-components';
|
||||
import { PEZKUWI_GENESIS } from '@pezkuwi/apps-config';
|
||||
import { AccountSidebar, lightTheme } from '@pezkuwi/react-components';
|
||||
import { ApiCtx } from '@pezkuwi/react-hooks/ctx/Api';
|
||||
import { KeyringCtxRoot } from '@pezkuwi/react-hooks/ctx/Keyring';
|
||||
import { QueueCtx } from '@pezkuwi/react-hooks/ctx/Queue';
|
||||
import { TypeRegistry } from '@pezkuwi/types/create';
|
||||
import { keyring } from '@pezkuwi/ui-keyring';
|
||||
@@ -34,9 +35,8 @@ export abstract class Page {
|
||||
private renderResult?: RenderResult;
|
||||
protected readonly defaultAddresses = [alice, bob, charlie, ferdie];
|
||||
|
||||
protected constructor (private readonly overview: React.ReactElement, private readonly rowClassName: string) {
|
||||
protected constructor (private readonly overview: React.ReactElement) {
|
||||
this.overview = overview;
|
||||
this.rowClassName = rowClassName;
|
||||
}
|
||||
|
||||
render (accounts: [string, AccountOverrides][]): void {
|
||||
@@ -59,6 +59,9 @@ export abstract class Page {
|
||||
proxy: {
|
||||
proxyDepositBase: new BN(1),
|
||||
proxyDepositFactor: new BN(1)
|
||||
},
|
||||
system: {
|
||||
ss58Prefix: new BN(42)
|
||||
}
|
||||
},
|
||||
createType: () => ({
|
||||
@@ -141,9 +144,11 @@ export abstract class Page {
|
||||
<MemoryRouter>
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<ApiCtx.Provider value={mockApi}>
|
||||
<AccountSidebar>
|
||||
{React.cloneElement(this.overview, { onStatusChange: noop }) }
|
||||
</AccountSidebar>
|
||||
<KeyringCtxRoot>
|
||||
<AccountSidebar>
|
||||
{React.cloneElement(this.overview, { onStatusChange: noop }) }
|
||||
</AccountSidebar>
|
||||
</KeyringCtxRoot>
|
||||
</ApiCtx.Provider>
|
||||
</ThemeProvider>
|
||||
</MemoryRouter>
|
||||
@@ -156,7 +161,14 @@ export abstract class Page {
|
||||
async getTable (): Promise<Table> {
|
||||
this.assertRendered();
|
||||
|
||||
return new Table(await screen.findByRole('table'), this.rowClassName);
|
||||
return new Table(await screen.findByRole('table'));
|
||||
}
|
||||
|
||||
/** All tables, in document order, for a page that splits its items over several */
|
||||
async getTables (): Promise<Table[]> {
|
||||
this.assertRendered();
|
||||
|
||||
return (await screen.findAllByRole('table')).map((table) => new Table(table));
|
||||
}
|
||||
|
||||
clearAccounts (): void {
|
||||
|
||||
Reference in new issue
Block a user