1
1
"use strict" ;
2
2
3
3
module . exports = function ( ) {
4
-
4
+
5
5
require ( 'colors' ) ;
6
6
let wd = require ( "wd" ) ;
7
- let assert = require ( 'assert' ) ;
7
+ let assert = require ( 'assert' ) ;
8
8
let _ = require ( 'underscore' ) ;
9
9
let Q = require ( 'q' ) ;
10
10
let fsExtra = require ( 'fs-extra' ) ;
11
11
let fs = require ( 'fs' ) ;
12
12
let _p = require ( '../helpers/promise-utils' ) ;
13
13
let elements = require ( '../helpers/elements' ) ;
14
14
let actions = require ( '../helpers/actions' ) ;
15
+ let store = require ( '../helpers/store' ) ;
15
16
let pry = require ( 'pryjs' ) ;
16
17
let config = require ( '../helpers/config' ) ;
17
18
let serverConfigs = require ( '../helpers/appium-servers' ) ;
@@ -24,7 +25,7 @@ module.exports = function () {
24
25
25
26
26
27
describe ( "Test all icon colors" , function ( ) {
27
-
28
+
28
29
this . timeout ( 3000000 ) ;
29
30
let allPassed = true ;
30
31
console . log ( ( 'RUNNING ' + __filename . slice ( __dirname . length + 1 ) + ' for iOS' ) . green . bold . underline ) ;
@@ -35,9 +36,14 @@ module.exports = function () {
35
36
. fullLogin ( )
36
37
} ) ;
37
38
38
- it ( 'Should turn the house blue: one primary target not home' , function ( ) {
39
- console . log ( 'Should turn the house blue: one primary target not home' . green . bold . underline ) ;
39
+ it . only ( 'Should login quick' , function ( ) {
40
+ return driver
41
+ . loginQuick ( )
42
+ } ) ;
40
43
44
+ it . only ( 'Should turn the house blue: one primary target not home' , function ( ) {
45
+ console . log ( 'Should turn the house blue: one primary target not home' . green . bold . underline ) ;
46
+ store . set ( 'houseHolds' , { } )
41
47
// Not home 1 primary target turns house blue
42
48
// Survey: DO NOT USE: Mobile Automation Survey 1.0
43
49
@@ -53,19 +59,42 @@ module.exports = function () {
53
59
. elementById ( 'DO NOT USE: Mobile Automation Survey 1.0' )
54
60
. click ( )
55
61
. waitForElementById ( elements . survey . start , 10000 )
62
+ . sleep ( 1000 )
56
63
. elementById ( elements . survey . start )
57
64
. click ( )
58
65
. startTime ( 'Load Survey' )
59
- . waitForElementById ( 'Select Walkbook' , 10000 )
66
+ . waitForElementById ( 'Select Walkbook' , 13000 )
60
67
. endTotalAndLogTime ( 'Load Survey' )
61
68
. elementByXPath ( elements . survey . walkbook1 )
62
69
. click ( )
63
- . waitForElementById ( elements . survey . popoverOpenBook , 10000 )
70
+ . waitForElementById ( elements . survey . popoverOpenBook , 13000 )
64
71
. elementById ( elements . survey . popoverOpenBook )
65
72
. click ( )
66
73
. startTime ( 'Load Walkbook' )
67
- . waitForElementByXPath ( elements . walkbook . houseHold1 , 10000 )
68
- . click ( )
74
+ . waitForElementByClassName ( 'XCUIElementTypeTable' , 13000 )
75
+
76
+ //save household IDs
77
+ . elementByClassName ( 'XCUIElementTypeTable' )
78
+ . elementsByClassName ( '>' , 'XCUIElementTypeCell' )
79
+ . then ( _p . saveHouseNames )
80
+
81
+ //pick the first notstarted household
82
+ . then ( function ( ) {
83
+ var houseHolds = store . get ( 'houseHolds' ) ;
84
+ for ( var key in houseHolds ) {
85
+ var regexp = / .* n o t s t a r t e d .* / i;
86
+ var this_value = houseHolds [ key ] ;
87
+ if ( regexp . test ( this_value ) === true ) {
88
+ console . log ( 'Using ' + houseHolds [ key ] )
89
+ config . thisHousehold = this_value
90
+ return driver
91
+ . elementById ( config . thisHousehold )
92
+ . click ( )
93
+ break ;
94
+ }
95
+ }
96
+ } )
97
+
69
98
. waitForElementById ( elements . walkbook . popoverOpenHouse , 10000 )
70
99
. elementById ( elements . walkbook . popoverOpenHouse )
71
100
. click ( )
@@ -91,7 +120,7 @@ module.exports = function () {
91
120
//
92
121
// return driver
93
122
//
94
- //
123
+ //
95
124
// });
96
125
// it('Should turn the house blue: xxxxxxxxxxx', function () {
97
126
// console.log('Should turn the house blue: xxxxxxxxxxx'.green.bold.underline);
@@ -101,7 +130,7 @@ module.exports = function () {
101
130
//
102
131
// return driver
103
132
//
104
- //
133
+ //
105
134
// });
106
135
// it('Should turn the house blue: xxxxxxxxxxx', function () {
107
136
// console.log('Should turn the house blue: xxxxxxxxxxx'.green.bold.underline);
@@ -111,7 +140,7 @@ module.exports = function () {
111
140
//
112
141
// return driver
113
142
//
114
- //
143
+ //
115
144
// });
116
145
// it('Should turn the house blue: xxxxxxxxxxx', function () {
117
146
// console.log('Should turn the house blue: xxxxxxxxxxx'.green.bold.underline);
@@ -121,7 +150,7 @@ module.exports = function () {
121
150
//
122
151
// return driver
123
152
//
124
- //
153
+ //
125
154
// });
126
155
127
156
0 commit comments