MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / UITest

Class UITest

apps/automated/src/ui-test.ts:6–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import * as navHelper from './ui-helper';
5
6export class UITest<T extends View> implements TraceWriter {
7 private _testPage: Page;
8 private _testView: T;
9 private _errorMessage;
10
11 public get errorMessage(): string {
12 return this._errorMessage;
13 }
14
15 public get testPage(): Page {
16 return this._testPage;
17 }
18
19 public get testView(): T {
20 return this._testView;
21 }
22
23 public waitUntilTestElementIsLoaded(timeoutSec: number = 1): void {
24 TKUnit.waitUntilReady(() => this.testView.isLoaded, timeoutSec);
25 }
26
27 public waitUntilTestElementLayoutIsValid(timeoutSec: number = 1): void {
28 TKUnit.waitUntilReady(() => this.testView.isLayoutValid, timeoutSec);
29 }
30
31 public create(): T {
32 throw new Error(this + ' should implement Create method.');
33 }
34
35 public setUpModule(): void {
36 const pageFactory = () => {
37 const page = new Page();
38 this._testPage = page;
39
40 return page;
41 };
42
43 Trace.addWriter(this);
44 navHelper.navigate(pageFactory);
45 }
46
47 public tearDownModule() {
48 this._testPage = null;
49 this._testView = null;
50 Trace.removeWriter(this);
51 }
52
53 public setUp() {
54 this._testView = this.create();
55 this._testPage.content = this._testView;
56 }
57
58 public tearDown() {
59 this._testPage.content = null;
60 this._testPage.bindingContext = null;
61 this._testPage.css = '';
62 this._testView = null;
63 this._errorMessage = undefined;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected