Skip to content

Commit

Permalink
fix: selecting testnet in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Dec 7, 2023
1 parent 5bef424 commit d275d8c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
2 changes: 0 additions & 2 deletions src/app/features/theme-drawer/theme-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useCallback } from 'react';

import { SettingsSelectors } from '@tests/selectors/settings.selectors';
import { Flex, FlexProps } from 'leather-styles/jsx';

import { useAnalytics } from '@app/common/hooks/analytics/use-analytics';
Expand Down Expand Up @@ -30,7 +29,6 @@ export function ThemeList(props: FlexProps) {
{themes.map(theme => (
<ThemeListItem
key={theme}
data-testid={SettingsSelectors.NetworkListItem}
theme={theme}
onThemeSelected={handleThemeSelected}
isActive={theme === userSelectedTheme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,25 @@ export function NetworkListItemLayout({
}: NetworkListItemLayoutProps) {
const unSelectable = !isOnline || isActive;
return (
<Box
width="100%"
key={networkId}
_hover={
unSelectable
? undefined
: {
backgroundColor: 'accent.component-background-hover',
}
}
px="space.05"
py="space.04"
onClick={unSelectable ? undefined : onSelectNetwork}
cursor={!isOnline ? 'not-allowed' : isActive ? 'default' : 'pointer'}
opacity={!isOnline ? 0.5 : 1}
data-testid={SettingsSelectors.NetworkListItem}
>
<Flex>
<Flex
width="100%"
justifyContent="space-between"
alignItems="center"
data-testid={network.id}
>
<Flex data-testid={SettingsSelectors.NetworkListItem}>
<Box
width="100%"
key={networkId}
_hover={
unSelectable
? undefined
: {
backgroundColor: 'accent.component-background-hover',
}
}
px="space.05"
py="space.04"
onClick={unSelectable ? undefined : onSelectNetwork}
cursor={!isOnline ? 'not-allowed' : isActive ? 'default' : 'pointer'}
opacity={!isOnline ? 0.5 : 1}
data-testid={network.id}
>
<Flex width="100%" justifyContent="space-between" alignItems="center">
<Stack alignItems="flex-start" flex={1} gap="space.02">
<styled.span mb="space.01" textStyle="label.01">
{network.name}
Expand All @@ -76,7 +71,7 @@ export function NetworkListItemLayout({
<TrashIcon />
</LeatherButton>
)}
</Flex>
</Box>
</Box>
</Flex>
);
}
3 changes: 2 additions & 1 deletion tests/page-object-models/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ export class HomePage {
async enableTestMode() {
await this.page.getByTestId(SettingsSelectors.SettingsMenuBtn).click();
await this.page.getByTestId(SettingsSelectors.ChangeNetworkAction).click();
await this.page.waitForTimeout(1000);
await (
await this.page.waitForSelector(this.testNetworkSelector, { timeout: 30000 })
).isEnabled();
).isVisible();
await this.page.getByTestId(WalletDefaultNetworkConfigurationIds.testnet).click();
}

Expand Down
1 change: 1 addition & 0 deletions tests/specs/rpc-sign-psbt/sign-psbt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test.describe('Sign PSBT', () => {
function clickActionButton(context: BrowserContext) {
return async (buttonToPress: 'Cancel' | 'Confirm') => {
const popup = await context.waitForEvent('page');
await popup.waitForTimeout(1000);
const btn = popup.locator(`text="${buttonToPress}"`);
await btn.click();
};
Expand Down

0 comments on commit d275d8c

Please sign in to comment.