1- import { AppiumDriver , createDriver } from "nativescript-dev-appium" ;
1+ import { AppiumDriver , createDriver , nsCapabilities } from "nativescript-dev-appium" ;
22import { Screen , sharedModalView , homeComponent } from "./screens/screen" ;
33import {
44 assertComponent ,
@@ -12,143 +12,148 @@ const roots = [
1212 "setNamedFrameRootViewModal" ,
1313] ;
1414
15- describe ( "modal-on-init:" , ( ) => {
15+ describe ( "modal-on-init:" , async function ( ) {
1616 let driver : AppiumDriver ;
1717 let screen : Screen ;
1818
19- before ( async ( ) => {
19+ before ( async function ( ) {
20+ nsCapabilities . testReporter . context = this ;
21+
2022 driver = await createDriver ( ) ;
2123 screen = new Screen ( driver ) ;
2224 } ) ;
2325
24- after ( "modal-on-init after all hook" , async ( ) => {
26+ after ( "modal-on-init after all hook" , async function ( ) {
2527 await driver . logTestArtifacts ( "modal-on-init" ) ;
2628 } ) ;
2729
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 ;
3135 await screen [ root ] ( ) ;
3236 console . log ( `Root: ${ root } ` ) ;
3337 } ) ;
3438
35- beforeEach ( async function ( ) { } ) ;
39+ beforeEach ( async function ( ) { } ) ;
3640
37- afterEach ( async function ( ) {
41+ afterEach ( async function ( ) {
3842 if ( this . currentTest . state === "failed" ) {
3943 await driver . logTestArtifacts ( this . currentTest . title ) ;
4044 await driver . resetApp ( ) ;
4145 await screen [ root ] ( ) ;
4246 }
4347 } ) ;
4448
45- after ( "root after all hook" , async function ( ) {
49+ after ( "root after all hook" , async function ( ) {
4650 await driver . logTestArtifacts ( `${ root } _root_after_all_hook` ) ;
4751 } ) ;
4852
49- it ( "should shared modal view" , async ( ) => {
53+ it ( "should shared modal view" , async function ( ) {
5054 await assertComponent ( driver , sharedModalView ) ;
5155 } ) ;
5256
53- it ( "run in background" , async ( ) => {
57+ it ( "run in background" , async function ( ) {
5458 await driver . backgroundApp ( 1 ) ;
5559 await assertComponent ( driver , sharedModalView ) ;
5660 } ) ;
5761
58- it ( "should close shared modal " , async ( ) => {
62+ it ( "should close shared modal " , async function ( ) {
5963 await screen . closeModal ( ) ;
6064 await screen . loadedHome ( ) ;
6165 } ) ;
6266
63- it ( "should open/close shared modal" , async ( ) => {
67+ it ( "should open/close shared modal" , async function ( ) {
6468 await screen . loadSharedModal ( true ) ;
6569 await screen . closeModal ( ) ;
6670 await screen . loadedHome ( ) ;
6771 } ) ;
6872
69- it ( "should open/close shared modal again" , async ( ) => {
73+ it ( "should open/close shared modal again" , async function ( ) {
7074 await screen . loadSharedModal ( true ) ;
7175 if ( driver . isAndroid ) {
72- await driver . navBack ( ) ;
73- } else {
74- await screen . closeModal ( ) ;
76+ await driver . navBack ( ) ;
77+ } else {
78+ await screen . closeModal ( ) ;
7579 }
7680 await screen . loadedHome ( ) ;
7781 } ) ;
7882
79- it ( "should open/close modal with frame" , async ( ) => {
83+ it ( "should open/close modal with frame" , async function ( ) {
8084 await screen . loadModalFrame ( true ) ;
8185 await screen . closeModal ( ) ;
8286 } ) ;
8387
84- it ( "should open/close shared modal again" , async ( ) => {
88+ it ( "should open/close shared modal again" , async function ( ) {
8589 await screen . loadSharedModal ( true ) ;
8690 await screen . closeModal ( ) ;
8791 } ) ;
8892
89- it ( "run in background again" , async ( ) => {
93+ it ( "run in background again" , async function ( ) {
9094 await driver . backgroundApp ( 1 ) ;
9195 await screen . loadedHome ( ) ;
9296 } ) ;
9397
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 ( ) ;
97101 } ) ;
98102 } ) ;
99- } ) ;
103+ } ;
100104
101- describe ( "Shared Modal on Init" , ( ) => {
105+ describe ( "Shared Modal on Init" , async function ( ) {
102106 const root = "setLayoutRootViewModal" ;
103- before ( async ( ) => {
107+ before ( async function ( ) {
108+ nsCapabilities . testReporter . context = this ;
104109 await screen [ root ] ( ) ;
105110 console . log ( `Root: ${ root } ` ) ;
106111 } ) ;
107112
108- beforeEach ( async function ( ) { } ) ;
113+ beforeEach ( async function ( ) { } ) ;
109114
110- afterEach ( async function ( ) {
115+ afterEach ( async function ( ) {
111116 if ( this . currentTest . state === "failed" ) {
112117 await driver . logTestArtifacts ( this . currentTest . title ) ;
113118 await driver . resetApp ( ) ;
114119 await screen [ root ] ( ) ;
115120 }
116121 } ) ;
117122
118- after ( "root after all hook" , async function ( ) {
123+ after ( "root after all hook" , async function ( ) {
119124 await driver . logTestArtifacts ( `${ root } _root_after_all_hook` ) ;
120125 } ) ;
121126
122- it ( "should shared modal view" , async ( ) => {
127+ it ( "should shared modal view" , async function ( ) {
123128 await assertComponent ( driver , sharedModalView ) ;
124129 } ) ;
125130
126- it ( "run in background" , async ( ) => {
131+ it ( "run in background" , async function ( ) {
127132 await driver . backgroundApp ( 1 ) ;
128133 await assertComponent ( driver , sharedModalView ) ;
129134 } ) ;
130135
131- it ( "should close shared modal " , async ( ) => {
136+ it ( "should close shared modal " , async function ( ) {
132137 await screen . closeModal ( ) ;
133138 await screen . loadedHome ( ) ;
134139 } ) ;
135140
136- it ( "should open/close shared modal" , async ( ) => {
141+ it ( "should open/close shared modal" , async function ( ) {
137142 await screen . loadModalFrame ( true ) ;
138143 await screen . closeModal ( ) ;
139144 } ) ;
140145
141- it ( "run in background again" , async ( ) => {
146+ it ( "run in background again" , async function ( ) {
142147 await driver . backgroundApp ( 1 ) ;
143148 await screen . loadedHome ( ) ;
144149 } ) ;
145150
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 ( ) ;
149154 } ) ;
150155
151- it ( "should open/close shared modal" , async ( ) => {
156+ it ( "should open/close shared modal" , async function ( ) {
152157 await screen . loadSharedModal ( true ) ;
153158 await screen . closeModal ( ) ;
154159 } ) ;
0 commit comments