1
1
import { AppiumDriver , createDriver , nsCapabilities } from "nativescript-dev-appium" ;
2
2
import { ButtonBackgroundPage } from "./button-background-page" ;
3
3
import { assert } from "chai" ;
4
- import { ImageOptions } from "nativescript-dev-appium/lib/ image-options " ;
4
+ import { setImageName } from "../../../helpers/ image-helper " ;
5
5
6
6
const suite = "button" ;
7
7
const spec = "background" ;
8
+ const imagePrefix = `${ suite } -${ spec } ` ;
8
9
9
- describe ( `${ suite } - ${ spec } -suite` , ( ) => {
10
+ describe ( `${ imagePrefix } -suite` , ( ) => {
10
11
let driver : AppiumDriver ;
11
12
let backgroundPage : ButtonBackgroundPage ;
12
13
@@ -16,14 +17,15 @@ describe(`${suite}-${spec}-suite`, () => {
16
17
await driver . restartApp ( ) ;
17
18
backgroundPage = new ButtonBackgroundPage ( driver ) ;
18
19
await backgroundPage . initSuite ( ) ;
20
+ driver . imageHelper . options . donNotAppendActualSuffixOnIntialImageCapture = true ;
19
21
} ) ;
20
22
21
23
after ( async function ( ) {
22
24
await backgroundPage . endSuite ( ) ;
23
25
} ) ;
24
26
25
27
beforeEach ( function ( ) {
26
- driver . imageHelper . testName = this . currentTest . title ;
28
+ driver . imageHelper . testName = setImageName ( suite , spec , this . currentTest . title ) ;
27
29
} ) ;
28
30
29
31
afterEach ( async function ( ) {
@@ -34,127 +36,126 @@ describe(`${suite}-${spec}-suite`, () => {
34
36
}
35
37
} ) ;
36
38
37
- it ( "background_11" , async function ( ) {
39
+ it ( ` ${ imagePrefix } -init` , async function ( ) {
38
40
const presenter = await backgroundPage . testElement ( ) ;
39
- const result = await driver . compareElement ( presenter , "background_11_clean" , 0.1 , 2 ) ;
41
+ const result = await driver . compareElement ( presenter , ` ${ imagePrefix } -reset` ) ;
40
42
assert . isTrue ( result ) ;
41
43
} ) ;
42
44
43
- it ( "background_12" , async function ( ) {
44
- await await backgroundPage . executeScenario ( "background_12" , " 1") ;
45
+ it ( ` ${ imagePrefix } -1` , async function ( ) {
46
+ await await backgroundPage . executeScenario ( "1" ) ;
45
47
} ) ;
46
48
47
- it ( "background_13" , async function ( ) {
49
+ it ( ` ${ imagePrefix } -reset` , async function ( ) {
48
50
await backgroundPage . tapResetBtn ( ) ;
49
51
const presenter = await backgroundPage . testElement ( ) ;
50
- const result = await driver . compareElement ( presenter , "background_11_clean" ) ;
52
+ const result = await driver . compareElement ( presenter , ` ${ imagePrefix } -reset` ) ;
51
53
assert . isTrue ( result ) ;
52
54
} ) ;
53
55
54
56
// Border
55
- it ( "background_21_border" , async function ( ) {
56
- // await backgroundPage.navigateBackToSuitMainPage();
57
- await backgroundPage . executeScenario ( "background_21_border" , "21" ) ;
57
+ it ( `${ imagePrefix } -21-borders` , async function ( ) {
58
+ await backgroundPage . executeScenario ( "21" ) ;
58
59
} ) ;
59
60
60
- it ( "background_22_border" , async function ( ) {
61
- await backgroundPage . executeScenario ( "background_22_border" , " 22") ;
61
+ it ( ` ${ imagePrefix } -22-borders` , async function ( ) {
62
+ await backgroundPage . executeScenario ( "22" ) ;
62
63
} ) ;
63
64
64
- it ( "background_23_border" , async function ( ) {
65
- await backgroundPage . executeScenario ( "background_23_border" , " 23") ;
65
+ it ( ` ${ imagePrefix } -23-borders` , async function ( ) {
66
+ await backgroundPage . executeScenario ( "23" ) ;
66
67
} ) ;
67
68
68
69
// Repeat
69
- it ( "background_31_repeat" , async function ( ) {
70
- await backgroundPage . executeScenario ( "background_31_repeat" , " 31") ;
70
+ it ( ` ${ imagePrefix } -31-repeat` , async function ( ) {
71
+ await backgroundPage . executeScenario ( "31" ) ;
71
72
} ) ;
72
73
73
- it ( "background_32_repeat" , async function ( ) {
74
- await backgroundPage . executeScenario ( "background_32_repeat" , " 32") ;
74
+ it ( ` ${ imagePrefix } -32-repeat` , async function ( ) {
75
+ await backgroundPage . executeScenario ( "32" ) ;
75
76
} ) ;
76
77
77
- it ( "background_33_repeat" , async function ( ) {
78
- await backgroundPage . executeScenario ( "background_33_repeat" , " 33") ;
78
+ it ( ` ${ imagePrefix } -33-repeat` , async function ( ) {
79
+ await backgroundPage . executeScenario ( "33" ) ;
79
80
} ) ;
80
81
81
82
// Position
82
- it ( "background_41_position" , async function ( ) {
83
- await backgroundPage . executeScenario ( "background_41_position" , " 41") ;
83
+ it ( ` ${ imagePrefix } -41-position` , async function ( ) {
84
+ await backgroundPage . executeScenario ( "41" ) ;
84
85
} ) ;
85
86
86
- it ( "background_42_position" , async function ( ) {
87
- await backgroundPage . executeScenario ( "background_42_position" , " 42") ;
87
+ it ( ` ${ imagePrefix } -42-position` , async function ( ) {
88
+ await backgroundPage . executeScenario ( "42" ) ;
88
89
} ) ;
89
90
90
- it ( "background_43_position" , async function ( ) {
91
- await backgroundPage . executeScenario ( "background_43_position" , " 43") ;
91
+ it ( ` ${ imagePrefix } -43-position` , async function ( ) {
92
+ await backgroundPage . executeScenario ( "43" ) ;
92
93
} ) ;
93
94
94
- it ( "background_44_position" , async function ( ) {
95
- await backgroundPage . executeScenario ( "background_44_position" , " 44") ;
95
+ it ( ` ${ imagePrefix } -44-position` , async function ( ) {
96
+ await backgroundPage . executeScenario ( "44" ) ;
96
97
} ) ;
97
98
98
- it ( "background_45_position" , async function ( ) {
99
- await backgroundPage . executeScenario ( "background_45_position" , " 45") ;
99
+ it ( ` ${ imagePrefix } -45-position` , async function ( ) {
100
+ await backgroundPage . executeScenario ( "45" ) ;
100
101
} ) ;
101
102
102
- it ( "background_46_position" , async function ( ) {
103
- await backgroundPage . executeScenario ( "background_46_position" , " 46") ;
103
+ it ( ` ${ imagePrefix } -46-position` , async function ( ) {
104
+ await backgroundPage . executeScenario ( "46" ) ;
104
105
} ) ;
105
106
106
- it ( "background_47_position" , async function ( ) {
107
- await backgroundPage . executeScenario ( "background_47_position" , " 47") ;
107
+ it ( ` ${ imagePrefix } -47-position` , async function ( ) {
108
+ await backgroundPage . executeScenario ( "47" ) ;
108
109
} ) ;
109
110
110
- it ( "background_48_position" , async function ( ) {
111
- await backgroundPage . executeScenario ( "background_48_position" , " 48") ;
111
+ it ( ` ${ imagePrefix } -48-position` , async function ( ) {
112
+ await backgroundPage . executeScenario ( "48" ) ;
112
113
} ) ;
113
114
114
- it ( "background_49_position" , async function ( ) {
115
- await backgroundPage . executeScenario ( "background_49_position" , " 49") ;
115
+ it ( ` ${ imagePrefix } -49-position` , async function ( ) {
116
+ await backgroundPage . executeScenario ( "49" ) ;
116
117
} ) ;
117
118
118
- it ( "background_50_position" , async function ( ) {
119
- await backgroundPage . executeScenario ( "background_50_position" , " 50") ;
119
+ it ( ` ${ imagePrefix } -50-position` , async function ( ) {
120
+ await backgroundPage . executeScenario ( "50" ) ;
120
121
} ) ;
121
122
122
- it ( "background_51_position" , async function ( ) {
123
- await backgroundPage . executeScenario ( "background_51_position" , " 51") ;
123
+ it ( ` ${ imagePrefix } -51-position` , async function ( ) {
124
+ await backgroundPage . executeScenario ( "51" ) ;
124
125
} ) ;
125
126
126
- it ( "background_52_position" , async function ( ) {
127
- await backgroundPage . executeScenario ( "background_52_position" , " 52") ;
127
+ it ( ` ${ imagePrefix } -52-position` , async function ( ) {
128
+ await backgroundPage . executeScenario ( "52" ) ;
128
129
} ) ;
129
130
130
131
// Size
131
- it ( "background_61_size" , async function ( ) {
132
- await backgroundPage . executeScenario ( "background_61_size" , " 61") ;
132
+ it ( ` ${ imagePrefix } -61-size` , async function ( ) {
133
+ await backgroundPage . executeScenario ( "61" ) ;
133
134
} ) ;
134
135
135
- it ( "background_62_size" , async function ( ) {
136
- await backgroundPage . executeScenario ( "background_62_size" , " 62") ;
136
+ it ( ` ${ imagePrefix } -62-size` , async function ( ) {
137
+ await backgroundPage . executeScenario ( "62" ) ;
137
138
} ) ;
138
139
139
- it ( "background_63_size" , async function ( ) {
140
- await backgroundPage . executeScenario ( "background_63_size" , " 63") ;
140
+ it ( ` ${ imagePrefix } -63-size` , async function ( ) {
141
+ await backgroundPage . executeScenario ( "63" ) ;
141
142
} ) ;
142
143
143
- it ( "background_64_size" , async function ( ) {
144
- await backgroundPage . executeScenario ( "background_64_size" , " 64") ;
144
+ it ( ` ${ imagePrefix } -64-size` , async function ( ) {
145
+ await backgroundPage . executeScenario ( "64" ) ;
145
146
} ) ;
146
147
147
148
// All
148
- it ( "background_71_all" , async function ( ) {
149
- await backgroundPage . executeScenario ( "background_71_all" , " 71") ;
149
+ it ( ` ${ imagePrefix } -71-all` , async function ( ) {
150
+ await backgroundPage . executeScenario ( "71" ) ;
150
151
} ) ;
151
152
152
- it ( "background_72_all" , async function ( ) {
153
- await backgroundPage . executeScenario ( "background_72_all" , " 72") ;
153
+ it ( ` ${ imagePrefix } -72-all` , async function ( ) {
154
+ await backgroundPage . executeScenario ( "72" ) ;
154
155
} ) ;
155
156
156
157
// Antialiasing
157
- it ( "background_78_antialiasing" , async function ( ) {
158
- await backgroundPage . executeScenario ( "background_78_antialiasing" , " 78") ;
158
+ it ( ` ${ imagePrefix } -78-antialiasing` , async function ( ) {
159
+ await backgroundPage . executeScenario ( "78" ) ;
159
160
} ) ;
160
161
} ) ;
0 commit comments