Skip to content

Commit a93e418

Browse files
author
Alexander Vakrilov
authored
tests: Frame tests refactor (NativeScript#6406)
1 parent 96b439e commit a93e418

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/app/ui/frame/frame-tests-common.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { Page } from "tns-core-modules/ui/page";
88
import * as helper from "../helper";
99
import * as TKUnit from "../../TKUnit";
1010

11-
const NAV_WAIT = 8;
11+
const NAV_WAIT = 15;
12+
function emptyNavigationQueue(frame: Frame) {
13+
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
14+
}
1215

1316
export function ignore_test_DummyTestForSnippetOnly0() {
1417
// >> frame-navigating
@@ -66,7 +69,7 @@ export function test_can_go_back() {
6669
const frame = topmost();
6770

6871
frame.navigate({ create: () => new Page(), clearHistory: true });
69-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty());
72+
emptyNavigationQueue(frame);
7073

7174
frame.navigate(() => new Page());
7275
frame.navigate(() => new Page());
@@ -131,13 +134,14 @@ export function test_can_go_back() {
131134

132135
TKUnit.assertFalse(frame.canGoBack(), "14");
133136
frame.goBack();
134-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
137+
138+
emptyNavigationQueue(frame);
135139
}
136140

137141
export function test_go_back_to_backstack_entry() {
138142
const frame = topmost();
139143
frame.navigate(() => new Page());
140-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty());
144+
emptyNavigationQueue(frame);
141145

142146
frame.navigate(() => new Page());
143147
frame.navigate(() => new Page());
@@ -149,7 +153,7 @@ export function test_go_back_to_backstack_entry() {
149153

150154
TKUnit.assertFalse(frame.canGoBack(), "2");
151155
frame.goBack();
152-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
156+
emptyNavigationQueue(frame);
153157
}
154158

155159
export function test_page_parent_when_backstackVisible_is_false() {
@@ -165,7 +169,7 @@ export function test_page_parent_when_backstackVisible_is_false() {
165169
frame.navigate({ create: () => new Page(), clearHistory: true });
166170
frame.navigate({ create, backstackVisible: false });
167171
frame.navigate(() => new Page());
168-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
172+
emptyNavigationQueue(frame);
169173

170174
TKUnit.assertEqual(pages.length, 1);
171175
TKUnit.assertEqual(frame.backStack.length, 1);
@@ -191,7 +195,7 @@ export function test_page_parent_when_navigate_with_clear_history() {
191195
frame.navigate({ create, backstackVisible: false });
192196
frame.navigate({ create });
193197
frame.navigate({ create: () => new Page(), clearHistory: true });
194-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
198+
emptyNavigationQueue(frame);
195199

196200
TKUnit.assertEqual(pages.length, 3);
197201
TKUnit.assertEqual(frame.backStack.length, 0);
@@ -216,7 +220,7 @@ export function test_page_parent_when_navigate_back() {
216220
frame.navigate({ create: () => new Page(), clearHistory: true });
217221
frame.navigate({ create });
218222
frame.goBack();
219-
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT);
223+
emptyNavigationQueue(frame);
220224

221225
TKUnit.assertEqual(pages.length, 1);
222226
TKUnit.assertEqual(frame.backStack.length, 0);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy