1
- import { AppiumDriver , createDriver } from "nativescript-dev-appium" ;
1
+ import { AppiumDriver , createDriver , nsCapabilities } from "nativescript-dev-appium" ;
2
2
import { Screen , sharedModalView , homeComponent } from "./screens/screen" ;
3
3
import {
4
4
assertComponent ,
@@ -12,143 +12,148 @@ const roots = [
12
12
"setNamedFrameRootViewModal" ,
13
13
] ;
14
14
15
- describe ( "modal-on-init:" , ( ) => {
15
+ describe ( "modal-on-init:" , async function ( ) {
16
16
let driver : AppiumDriver ;
17
17
let screen : Screen ;
18
18
19
- before ( async ( ) => {
19
+ before ( async function ( ) {
20
+ nsCapabilities . testReporter . context = this ;
21
+
20
22
driver = await createDriver ( ) ;
21
23
screen = new Screen ( driver ) ;
22
24
} ) ;
23
25
24
- after ( "modal-on-init after all hook" , async ( ) => {
26
+ after ( "modal-on-init after all hook" , async function ( ) {
25
27
await driver . logTestArtifacts ( "modal-on-init" ) ;
26
28
} ) ;
27
29
28
- roots . forEach ( root => {
29
- describe ( "Shared Modal on Init" , ( ) => {
30
- before ( async ( ) => {
30
+ for ( let index = 0 ; index < roots . length ; index ++ ) {
31
+ const root = roots [ index ] ;
32
+ describe ( "Shared Modal on Init" , async function ( ) {
33
+ before ( async function ( ) {
34
+ nsCapabilities . testReporter . context = this ;
31
35
await screen [ root ] ( ) ;
32
36
console . log ( `Root: ${ root } ` ) ;
33
37
} ) ;
34
38
35
- beforeEach ( async function ( ) { } ) ;
39
+ beforeEach ( async function ( ) { } ) ;
36
40
37
- afterEach ( async function ( ) {
41
+ afterEach ( async function ( ) {
38
42
if ( this . currentTest . state === "failed" ) {
39
43
await driver . logTestArtifacts ( this . currentTest . title ) ;
40
44
await driver . resetApp ( ) ;
41
45
await screen [ root ] ( ) ;
42
46
}
43
47
} ) ;
44
48
45
- after ( "root after all hook" , async function ( ) {
49
+ after ( "root after all hook" , async function ( ) {
46
50
await driver . logTestArtifacts ( `${ root } _root_after_all_hook` ) ;
47
51
} ) ;
48
52
49
- it ( "should shared modal view" , async ( ) => {
53
+ it ( "should shared modal view" , async function ( ) {
50
54
await assertComponent ( driver , sharedModalView ) ;
51
55
} ) ;
52
56
53
- it ( "run in background" , async ( ) => {
57
+ it ( "run in background" , async function ( ) {
54
58
await driver . backgroundApp ( 1 ) ;
55
59
await assertComponent ( driver , sharedModalView ) ;
56
60
} ) ;
57
61
58
- it ( "should close shared modal " , async ( ) => {
62
+ it ( "should close shared modal " , async function ( ) {
59
63
await screen . closeModal ( ) ;
60
64
await screen . loadedHome ( ) ;
61
65
} ) ;
62
66
63
- it ( "should open/close shared modal" , async ( ) => {
67
+ it ( "should open/close shared modal" , async function ( ) {
64
68
await screen . loadSharedModal ( true ) ;
65
69
await screen . closeModal ( ) ;
66
70
await screen . loadedHome ( ) ;
67
71
} ) ;
68
72
69
- it ( "should open/close shared modal again" , async ( ) => {
73
+ it ( "should open/close shared modal again" , async function ( ) {
70
74
await screen . loadSharedModal ( true ) ;
71
75
if ( driver . isAndroid ) {
72
- await driver . navBack ( ) ;
73
- } else {
74
- await screen . closeModal ( ) ;
76
+ await driver . navBack ( ) ;
77
+ } else {
78
+ await screen . closeModal ( ) ;
75
79
}
76
80
await screen . loadedHome ( ) ;
77
81
} ) ;
78
82
79
- it ( "should open/close modal with frame" , async ( ) => {
83
+ it ( "should open/close modal with frame" , async function ( ) {
80
84
await screen . loadModalFrame ( true ) ;
81
85
await screen . closeModal ( ) ;
82
86
} ) ;
83
87
84
- it ( "should open/close shared modal again" , async ( ) => {
88
+ it ( "should open/close shared modal again" , async function ( ) {
85
89
await screen . loadSharedModal ( true ) ;
86
90
await screen . closeModal ( ) ;
87
91
} ) ;
88
92
89
- it ( "run in background again" , async ( ) => {
93
+ it ( "run in background again" , async function ( ) {
90
94
await driver . backgroundApp ( 1 ) ;
91
95
await screen . loadedHome ( ) ;
92
96
} ) ;
93
97
94
- it ( "should open/close shared modal second" , async ( ) => {
95
- await screen . loadModalFrame ( true ) ;
96
- await screen . closeModal ( ) ;
98
+ it ( "should open/close shared modal second" , async function ( ) {
99
+ await screen . loadModalFrame ( true ) ;
100
+ await screen . closeModal ( ) ;
97
101
} ) ;
98
102
} ) ;
99
- } ) ;
103
+ } ;
100
104
101
- describe ( "Shared Modal on Init" , ( ) => {
105
+ describe ( "Shared Modal on Init" , async function ( ) {
102
106
const root = "setLayoutRootViewModal" ;
103
- before ( async ( ) => {
107
+ before ( async function ( ) {
108
+ nsCapabilities . testReporter . context = this ;
104
109
await screen [ root ] ( ) ;
105
110
console . log ( `Root: ${ root } ` ) ;
106
111
} ) ;
107
112
108
- beforeEach ( async function ( ) { } ) ;
113
+ beforeEach ( async function ( ) { } ) ;
109
114
110
- afterEach ( async function ( ) {
115
+ afterEach ( async function ( ) {
111
116
if ( this . currentTest . state === "failed" ) {
112
117
await driver . logTestArtifacts ( this . currentTest . title ) ;
113
118
await driver . resetApp ( ) ;
114
119
await screen [ root ] ( ) ;
115
120
}
116
121
} ) ;
117
122
118
- after ( "root after all hook" , async function ( ) {
123
+ after ( "root after all hook" , async function ( ) {
119
124
await driver . logTestArtifacts ( `${ root } _root_after_all_hook` ) ;
120
125
} ) ;
121
126
122
- it ( "should shared modal view" , async ( ) => {
127
+ it ( "should shared modal view" , async function ( ) {
123
128
await assertComponent ( driver , sharedModalView ) ;
124
129
} ) ;
125
130
126
- it ( "run in background" , async ( ) => {
131
+ it ( "run in background" , async function ( ) {
127
132
await driver . backgroundApp ( 1 ) ;
128
133
await assertComponent ( driver , sharedModalView ) ;
129
134
} ) ;
130
135
131
- it ( "should close shared modal " , async ( ) => {
136
+ it ( "should close shared modal " , async function ( ) {
132
137
await screen . closeModal ( ) ;
133
138
await screen . loadedHome ( ) ;
134
139
} ) ;
135
140
136
- it ( "should open/close shared modal" , async ( ) => {
141
+ it ( "should open/close shared modal" , async function ( ) {
137
142
await screen . loadModalFrame ( true ) ;
138
143
await screen . closeModal ( ) ;
139
144
} ) ;
140
145
141
- it ( "run in background again" , async ( ) => {
146
+ it ( "run in background again" , async function ( ) {
142
147
await driver . backgroundApp ( 1 ) ;
143
148
await screen . loadedHome ( ) ;
144
149
} ) ;
145
150
146
- it ( "should open/close shared modal second" , async ( ) => {
147
- await screen . loadModalFrame ( true ) ;
148
- await screen . closeModal ( ) ;
151
+ it ( "should open/close shared modal second" , async function ( ) {
152
+ await screen . loadModalFrame ( true ) ;
153
+ await screen . closeModal ( ) ;
149
154
} ) ;
150
155
151
- it ( "should open/close shared modal" , async ( ) => {
156
+ it ( "should open/close shared modal" , async function ( ) {
152
157
await screen . loadSharedModal ( true ) ;
153
158
await screen . closeModal ( ) ;
154
159
} ) ;
0 commit comments