@@ -141,168 +141,159 @@ include `string`, `number`, `numberStr` and `date`. If you use date be aware th
141
141
</file>
142
142
<file name="scenario.js">
143
143
var gridTestUtils = require('../../test/e2e/gridTestUtils.spec.js');
144
+ var GridObjectTest = require('../../test/e2e/gridObjectTestUtils.spec.js');
145
+ var grid1 = new GridObjectTest('grid1');
146
+ var grid2 = new GridObjectTest('grid2');
144
147
145
148
describe('first grid on the page, no default sort', function() {
146
149
// Reload the page before each test if on Firefox. Chrome does it automatically.
147
150
gridTestUtils.firefoxReload();
148
151
149
- it('grid should have three visible columns', function () {
150
- gridTestUtils.expectHeaderColumnCount( 'grid1', 3 );
151
- });
152
-
153
152
it('header values should be as expected', function () {
154
- gridTestUtils.expectHeaderCellValueMatch( 'grid1', 0, 'Name' );
155
- gridTestUtils.expectHeaderCellValueMatch( 'grid1', 1, 'Gender' );
156
- gridTestUtils.expectHeaderCellValueMatch( 'grid1', 2, 'Company' );
153
+ grid1.expectHeaderColumns( [ 'Name', 'Gender', 'Company' ] );
157
154
});
158
155
159
156
it('grid should be unsorted by default', function () {
160
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );
161
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Claudine Neal' );
157
+ grid1 .expectCellValueMatch( 0, 0, 'Ethel Price' );
158
+ grid1 .expectCellValueMatch( 1, 0, 'Claudine Neal' );
162
159
});
163
160
164
161
it('sort by name by clicking header', function () {
165
- gridTestUtils .clickHeaderCell( 'grid1', 0 )
162
+ grid1 .clickHeaderCell( 0 )
166
163
.then(function () {
167
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Alexander Foley' );
168
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Alisha Myers' );
164
+ grid1 .expectCellValueMatch( 0, 0, 'Alexander Foley' );
165
+ grid1 .expectCellValueMatch( 1, 0, 'Alisha Myers' );
169
166
});
170
167
});
171
168
172
169
it('reverse sort by name by clicking header', function () {
173
- gridTestUtils .clickHeaderCell( 'grid1', 0 )
170
+ grid1 .clickHeaderCell( 0 )
174
171
.then(function () {
175
- return gridTestUtils .clickHeaderCell( 'grid1', 0 );
172
+ return grid1 .clickHeaderCell( 0 );
176
173
})
177
174
.then(function () {
178
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Yvonne Parsons' );
179
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Woods Key' );
175
+ grid1 .expectCellValueMatch( 0, 0, 'Yvonne Parsons' );
176
+ grid1 .expectCellValueMatch( 1, 0, 'Woods Key' );
180
177
});
181
178
});
182
179
183
180
it('return to original sort by name by clicking header', function () {
184
- gridTestUtils .clickHeaderCell( 'grid1', 0 )
181
+ grid1 .clickHeaderCell( 0 )
185
182
.then(function () {
186
- return gridTestUtils .clickHeaderCell( 'grid1', 0 );
183
+ return grid1 .clickHeaderCell( 0 );
187
184
})
188
185
.then(function () {
189
- return gridTestUtils .clickHeaderCell( 'grid1', 0 );
186
+ return grid1 .clickHeaderCell( 0 );
190
187
})
191
188
.then(function () {
192
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );
193
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Claudine Neal' );
189
+ grid1 .expectCellValueMatch( 0, 0, 'Ethel Price' );
190
+ grid1 .expectCellValueMatch( 1, 0, 'Claudine Neal' );
194
191
});
195
192
});
196
193
197
194
it('sort asc by clicking menu', function() {
198
- gridTestUtils .clickColumnMenuSortAsc( 'grid1', 0 )
195
+ grid1 .clickColumnMenuSortAsc( 0 )
199
196
.then(function () {
200
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Alexander Foley' );
201
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Alisha Myers' );
197
+ grid1 .expectCellValueMatch( 0, 0, 'Alexander Foley' );
198
+ grid1 .expectCellValueMatch( 1, 0, 'Alisha Myers' );
202
199
});
203
200
});
204
201
205
202
it('sort desc by clicking menu, then remove sort', function() {
206
- gridTestUtils .clickColumnMenuSortDesc( 'grid1', 0 )
203
+ grid1 .clickColumnMenuSortDesc( 0 )
207
204
.then(function () {
208
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Yvonne Parsons' );
209
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Woods Key' );
205
+ grid1 .expectCellValueMatch( 0, 0, 'Yvonne Parsons' );
206
+ grid1 .expectCellValueMatch( 1, 0, 'Woods Key' );
210
207
return true;
211
208
})
212
209
.then(function () {
213
- return gridTestUtils .clickColumnMenuRemoveSort( 'grid1', 0 );
210
+ return grid1 .clickColumnMenuRemoveSort( 0 );
214
211
})
215
212
.then(function () {
216
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );
217
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Claudine Neal' );
213
+ grid1 .expectCellValueMatch( 0, 0, 'Ethel Price' );
214
+ grid1 .expectCellValueMatch( 1, 0, 'Claudine Neal' );
218
215
});
219
216
});
220
217
221
218
it('sort two columns, gender then name, by shift clicking', function() {
222
- gridTestUtils .clickHeaderCell( 'grid1', 1 )
219
+ grid1 .clickHeaderCell( 1 )
223
220
.then(function () {
224
- return gridTestUtils .shiftClickHeaderCell( 'grid1', 0 );
221
+ return grid1 .shiftClickHeaderCell( 0 );
225
222
})
226
223
.then(function () {
227
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Alisha Myers' );
228
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Beryl Rice' );
224
+ grid1 .expectCellValueMatch( 0, 0, 'Alisha Myers' );
225
+ grid1 .expectCellValueMatch( 1, 0, 'Beryl Rice' );
229
226
});
230
227
});
231
228
232
229
it('sort disabled on last column', function() {
233
- gridTestUtils .clickHeaderCell( 'grid1', 2 )
230
+ grid1 .clickHeaderCell( 2 )
234
231
.then(function () {
235
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Ethel Price' );
236
- gridTestUtils .expectCellValueMatch( 'grid1', 1, 0, 'Claudine Neal' );
232
+ grid1 .expectCellValueMatch( 0, 0, 'Ethel Price' );
233
+ grid1 .expectCellValueMatch( 1, 0, 'Claudine Neal' );
237
234
});
238
235
});
239
236
240
237
it('click one menu, then click another menu, expect undisplay and redisplay on second click', function() {
241
- gridTestUtils .expectVisibleColumnMenuItems( 'grid1', 0, 3 );
242
- gridTestUtils .expectVisibleColumnMenuItems( 'grid1', 1, 3 );
238
+ grid1 .expectVisibleColumnMenuItems( 0, 3 );
239
+ grid1 .expectVisibleColumnMenuItems( 1, 3 );
243
240
});
244
241
245
242
it('toggle gender, expect Alexander Foley to move around', function() {
246
243
// sort gender asc, then name
247
- gridTestUtils .clickHeaderCell( 'grid1', 1 )
244
+ grid1 .clickHeaderCell( 1 )
248
245
.then(function () {
249
- return gridTestUtils .clickHeaderCell( 'grid1', 1 );
246
+ return grid1 .clickHeaderCell( 1 );
250
247
})
251
248
.then(function () {
252
- return gridTestUtils .shiftClickHeaderCell( 'grid1', 0 );
249
+ return grid1 .shiftClickHeaderCell( 0 );
253
250
})
254
251
.then(function () {
255
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Alexander Foley' );
252
+ grid1 .expectCellValueMatch( 0, 0, 'Alexander Foley' );
256
253
})
257
254
.then(function () {
258
255
return gridTestUtils.click(element(by.id('toggleGender')));
259
256
})
260
257
.then(function () {
261
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Anthony Joyner' );
258
+ grid1 .expectCellValueMatch( 0, 0, 'Anthony Joyner' );
262
259
})
263
260
.then(function () {
264
261
return gridTestUtils.click(element(by.id('toggleGender')));
265
262
})
266
263
.then(function () {
267
- gridTestUtils .expectCellValueMatch( 'grid1', 0, 0, 'Alexander Foley' );
264
+ grid1 .expectCellValueMatch( 0, 0, 'Alexander Foley' );
268
265
});
269
266
});
270
267
271
268
});
272
269
273
270
274
271
describe('second grid on the page, has default sort', function() {
275
- it('grid should have three visible columns', function () {
276
- gridTestUtils.expectHeaderColumnCount( 'grid2', 3 );
277
- });
278
-
279
272
it('header values should be as expected', function () {
280
- gridTestUtils.expectHeaderCellValueMatch( 'grid2', 0, 'Name' );
281
- gridTestUtils.expectHeaderCellValueMatch( 'grid2', 1, 'Gender' );
282
- gridTestUtils.expectHeaderCellValueMatch( 'grid2', 2, 'Company' );
273
+ grid2.expectHeaderColumns( [ 'Name', 'Gender', 'Company' ] );
283
274
});
284
275
285
276
it('grid should be sorted by default', function () {
286
- gridTestUtils .expectCellValueMatch( 'grid2', 0, 0, 'Yvonne Parsons' );
287
- gridTestUtils .expectCellValueMatch( 'grid2', 1, 0, 'Velma Fry' );
277
+ grid2 .expectCellValueMatch( 0, 0, 'Yvonne Parsons' );
278
+ grid2 .expectCellValueMatch( 1, 0, 'Velma Fry' );
288
279
});
289
280
290
281
it('sort on second column can\'t be removed when cycle through header clicks', function () {
291
- gridTestUtils .clickHeaderCell( 'grid2', 0 )
282
+ grid2 .clickHeaderCell( 0 )
292
283
.then(function () {
293
- gridTestUtils .expectCellValueMatch( 'grid2', 0, 0, 'Ethel Price' );
284
+ grid2 .expectCellValueMatch( 0, 0, 'Ethel Price' );
294
285
})
295
286
.then(function () {
296
- return gridTestUtils .clickHeaderCell( 'grid2', 1 );
287
+ return grid2 .clickHeaderCell( 1 );
297
288
})
298
289
.then(function () {
299
- gridTestUtils .expectCellValueMatch( 'grid2', 0, 0, 'Wilder Gonzales' );
290
+ grid2 .expectCellValueMatch( 0, 0, 'Wilder Gonzales' );
300
291
})
301
292
.then(function () {
302
- return gridTestUtils .clickHeaderCell( 'grid2', 1 );
293
+ return grid2 .clickHeaderCell( 1 );
303
294
})
304
295
.then(function () {
305
- gridTestUtils .expectCellValueMatch( 'grid2', 0, 0, 'Ethel Price' );
296
+ grid2 .expectCellValueMatch( 0, 0, 'Ethel Price' );
306
297
});
307
298
});
308
299
});
0 commit comments