Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/helpers/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,21 @@ export async function toggleWidgets() {
await tap('NavigationClose');
}

export async function deleteAllDefaultWidgets() {
await tap('WidgetsEdit');
for (const w of ['Bitcoin Price', 'Bitcoin Blocks', 'Bitcoin Headlines']) {
tap(w + '_WidgetActionDelete');
await elementByText('Yes, Delete').waitForDisplayed();
await elementByText('Yes, Delete').click();
await elementById(w).waitForDisplayed({ reverse: true, timeout: 5000 });
await sleep(500);
}
await tap('WidgetsEdit');
await elementById('PriceWidget').waitForDisplayed({ reverse: true });
await elementById('NewsWidget').waitForDisplayed({ reverse: true });
await elementById('BlocksWidget').waitForDisplayed({ reverse: true });
}

export async function waitForBackup() {
await tap('HeaderMenu');
await tap('DrawerSettings');
Expand All @@ -300,3 +315,4 @@ export async function waitForBackup() {
await allSynced.waitForDisplayed();
await tap('NavigationClose');
}

10 changes: 8 additions & 2 deletions test/specs/backup.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import initElectrum from '../helpers/electrum';
import { reinstallApp } from '../helpers/setup';
import {
completeOnboarding,
deleteAllDefaultWidgets,
elementById,
elementByIdWithin,
elementByText,
Expand All @@ -13,7 +14,6 @@ import {
sleep,
swipeFullScreen,
tap,
toggleWidgets,
typeText,
} from '../helpers/actions';

Expand Down Expand Up @@ -94,13 +94,19 @@ describe('Backup', () => {
await tap('NavigationClose');

// - add widgets (add PriceWidget) //
await toggleWidgets();
await deleteAllDefaultWidgets();
await tap('WidgetsAdd');
await tap('WidgetsOnboarding-button');
await tap('WidgetListItem-price');
await elementById('WidgetSave').waitForDisplayed();
await sleep(1000); // wait for the app to settle
await tap('WidgetSave');
// sometimes flaky on GH actions, try again
try {
await elementById('PriceWidget').waitForDisplayed();
} catch {
await tap('WidgetSave');
}
await elementById('PriceWidget').waitForDisplayed();

// - backup seed and restore wallet //
Expand Down
14 changes: 11 additions & 3 deletions test/specs/widgets.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
tap,
swipeFullScreen,
completeOnboarding,
toggleWidgets,
deleteAllDefaultWidgets,
} from '../helpers/actions';
import { reinstallApp } from '../helpers/setup';

Expand All @@ -17,8 +17,8 @@ describe('Widgets', () => {
});

it('Can add/edit/remove a widget', async () => {
// Enable widgets
await toggleWidgets();
// delete all default widgets
await deleteAllDefaultWidgets();

// Add a widget
await tap('WidgetsAdd');
Expand All @@ -44,7 +44,15 @@ describe('Widgets', () => {

// Preview and save
await tap('WidgetEditPreview');
await sleep(500);
await tap('WidgetSave');
// sometimes flaky on GH actions, try again
try {
await elementById('PriceWidget').waitForDisplayed();
} catch {
await tap('WidgetSave');
}
await elementById('PriceWidget').waitForDisplayed();

// Back on Home: scroll a bit to ensure widget is in view
await elementById('PriceWidget').waitForDisplayed();
Expand Down