forked from cucumber/cucumber-java-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFileListSteps.java
613 lines (546 loc) · 27.1 KB
/
FileListSteps.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
/**
* ownCloud Android Scenario Tests
*
* @author Jesús Recio Rincón (@jesmrec)
*/
package io.cucumber;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.ParameterType;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import utils.entities.OCFile;
import utils.log.Log;
public class FileListSteps {
private World world;
public FileListSteps(World world) {
this.world = world;
}
@ParameterType("replace|keep both")
public String conflictFix(String type) {
return type;
}
@ParameterType("file|audio|image|video|damaged")
public String fileType(String type) {
return type;
}
@ParameterType("Upload File|Picture from Camera|Create Shortcut|Create Folder")
public String optionsFab(String type) {
return type;
}
@Given("there is an item called {word} in the folder Downloads of the device")
public void there_is_an_item_in_folder_downloads(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.pushFile(itemName);
}
@Given("the following items have been created in {word} account")
public void items_have_been_created_in_account(String userName, DataTable table) throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
for (List<String> rows : listItems) {
String type = rows.get(0);
String name = rows.get(1);
Log.log(Level.FINE, type + " " + name);
if (!world.filesAPI.itemExist(name)) {
switch (type) {
case ("folder"):
case ("item"): {
world.filesAPI.createFolder(name, userName);
break;
}
case ("file"): {
world.filesAPI.pushFile(name, userName);
break;
}
case ("image"): {
world.filesAPI.pushFileByMime(name, "image/jpg");
break;
}
case ("audio"): {
world.filesAPI.pushFileByMime(name, "audio/mpeg3");
break;
}
case ("video"): {
world.filesAPI.pushFileByMime(name, "video/mp4");
break;
}
case ("shortcut"): {
world.filesAPI.pushFileByMime(name, "text/uri-list");
break;
}
case ("damaged"): { //Our sample damaged file is a .png
world.filesAPI.pushFileByMime(name, "image/png");
break;
}
default:
break;
}
}
}
}
@Given("the folder {word} contains {int} files")
public void folder_contains_files(String folderName, int files) throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
if (!world.filesAPI.itemExist(folderName)) {
world.filesAPI.createFolder(folderName, "alice");
}
for (int i = 0; i < files; i++) {
world.filesAPI.pushFile(folderName + "/file_" + i + ".txt", "Alice");
}
}
@When("Alice selects to set as av.offline the item {word}")
public void user_selects_to_set_as_avoffline_item(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.executeOperation("Set as available offline", itemName);
world.fileListPage.closeSelectionMode();
}
@When("Alice selects to unset as av.offline the item {word}")
public void user_selects_to_unset_as_unavoffline_item(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.executeOperation("Unset as available offline", itemName);
world.fileListPage.closeSelectionMode();
}
@When("Alice selects to {word} the {itemtype} {word}")
public void user_selects_item_to_some_operation(String operation, String type, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
if (operation.equals("Download") || operation.equals("open")) {
world.fileListPage.downloadAction(itemName);
} else {
world.fileListPage.executeOperation(operation, itemName);
}
}
@When("Alice selects to {word}")
public void user_selects_item_to_some_operation_in_multi(String operation) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.selectOperation(operation);
}
@When("Alice selects {word} as target folder")
public void user_selects_target_folder(String targetFolder) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.folderPickerPage.selectFolder(targetFolder);
world.folderPickerPage.accept();
}
@When("Alice selects {word} as space")
public void user_selects_space(String spaceName)
throws IOException {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
if (world.authAPI.isOidc()) {
world.folderPickerPage.selectSpace(spaceName);
}
}
@When("Alice creates new folder {word} in the folder picker")
public void user_creates_folder_picker(String targetFolder) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.folderPickerPage.createFolder();
world.inputNamePage.setItemName(targetFolder);
}
@When("Alice selects the option {optionsFab}")
public void user_selects_option_upload(String operation) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
switch (operation){
case "Upload File": {
world.fileListPage.selectUploadFiles();
break;
}
case "Picture from Camera":{
world.fileListPage.selectUploadPicture();
break;
}
case "Create Folder":{
world.fileListPage.selectCreateFolder();
break;
}
case "Create Shortcut":{
world.fileListPage.selectCreateShortcut();
break;
}
default:
break;
}
}
@When("Alice refreshes the list")
public void user_refreshes_list() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
}
@When("Alice accepts the deletion of {word}")
public void user_accepts_deletion(String type) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.removeDialogPage.removeAll();
}
@When("the {word} has been deleted remotely")
public void item_has_been_deleted_remotely(String fileName)
throws IOException {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.filesAPI.removeItem(fileName, "Alice");
world.fileListPage.refreshList();
}
@When("Alice sets {word} as new name")
public void user_sets_new_name(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.inputNamePage.setItemName(itemName);
}
@When("Alice opens the public link shortcut")
public void user_opens_public_link_shortcut() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openLinkShortcut();
world.fileListPage.refreshList();
}
@When("Alice opens the available offline shortcut")
public void user_opens_av_offline_shortcut() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openAvOffhortcut();
world.fileListPage.refreshList();
}
@When("Alice browses into {word}")
public void user_browses_into_folder(String path) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
world.fileListPage.browseToFolder(path);
}
@When("Alice browses to root folder")
public void user_browses_root_folder() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.browseRoot();
}
@When("Alice clicks on the thumbnail")
public void user_clicks_on_the_thumbnail() {
String stepName = new Object() {
}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.detailsPage.downloadFromThumbnail();
}
@When("file {word} is modified externally adding {word}")
public void file_is_modified_externally_adding_text(String itemName, String text)
throws IOException {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.filesAPI.pushFile(itemName, text, "Alice");
}
@When("Alice closes the preview")
public void user_closes_preview() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.detailsPage.backListFiles();
}
@When("Alice fixes the conflict with {conflictFix}")
public void user_fixes_conflict(String conflictFix) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.fixConflict(conflictFix);
}
@When("Alice long presses over {word}")
public void user_longpress_over_item(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
world.fileListPage.longPress(itemName);
}
@When("Alice multiselects the following items")
public void user_selects_all_items(DataTable table) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
for (List<String> rows : listItems) {
String name = rows.get(0);
world.fileListPage.selectItem(name);
}
}
@When("Alice opens a private link pointing to {word} with scheme {word}")
public void open_private_link(String filePath, String scheme)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
OCFile item = world.filesAPI.listItems(filePath, "Alice").get(0);
String privateLink = world.fileListPage.getPrivateLink(scheme, item.getPrivateLink());
world.fileListPage.openPrivateLink(privateLink);
}
@When("Alice opens a private link pointing to shared {word} with scheme {word}")
public void open_private_link_shared(String fileName, String scheme)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
ArrayList<OCFile> listShared = world.filesAPI.listShared();
OCFile item = null;
for (OCFile ocFile : listShared) {
if (ocFile.getName().equals(fileName)) {
item = ocFile;
}
}
String privateLink = world.fileListPage.getPrivateLink(scheme, item.getPrivateLink());
world.fileListPage.openPrivateLink(privateLink);
}
@When("Alice opens a private link pointing to non-existing item")
public void open_fake_private_link() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openFakePrivateLink();
}
@When("Alice opens the share shortcut")
public void open_share_shortcut() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openFakePrivateLink();
}
@When("Alice takes a picture")
public void takes_picture() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.cameraPage.takePicture();
}
@When("Alice creates a web shortcut with the following fields")
public void creates_shortcut(DataTable table) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
for (List<String> rows : listItems) {
String name = rows.get(0);
String url = rows.get(1);
world.shortcutDialogPage.typeURLName(name, url);
world.shortcutDialogPage.submitShortcut();
}
}
@When ("Alice opens the shortcut {word}.url")
public void opens_shortcut(String name) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.downloadAction(name+".url");
}
@When ("Alice opens the link")
public void opens_link() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.shortcutDialogPage.openShortcut();
}
@Then("Alice should see {word} in the (file)list")
public void user_should_see_item_in_filelist(String itemName) throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
//Get the last token of the item path
assertTrue(world.fileListPage.isItemInList(itemName.substring(itemName.lastIndexOf('/') + 1)));
assertTrue(world.filesAPI.itemExist(itemName));
}
@Then("Alice should not see {word} in the filelist anymore")
public void user_should_not_see_item_in_list_anymore(String itemName) throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertFalse(world.fileListPage.isItemInList(itemName));
assertFalse(world.filesAPI.itemExist(itemName));
}
@Then("Alice should not see {word} in the links/offline list")
public void user_should_not_see_item_in_links_list(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertFalse(world.fileListPage.isItemInList(itemName));
}
@Then("Alice should see {word} in the shares list")
public void user_not_see_item_in_shares_list(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.fileListPage.isItemInList(itemName));
}
//Variant with word parameter
@Then("Alice should see {word} inside the folder {word}")
public void user_should_see_item_inside_folder_word(String itemName, String targetFolder)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.browseInto(targetFolder);
assertTrue(world.fileListPage.isItemInList(itemName));
assertTrue(world.filesAPI.itemExist(targetFolder + "/" + itemName));
}
//Variant with string parameter, in case the itemName contain blanks
@Then("Alice should see {string} inside the folder {word}")
public void user_should_see_item_inside_folder_string(String itemName, String targetFolder)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.browseInto(targetFolder);
world.fileListPage.isItemInList(itemName);
assertTrue(world.filesAPI.itemExist(targetFolder + "/" + itemName));
}
@Then("Alice should see {word} inside the space {word}")
public void user_should_see_item_inside_space(String itemName, String spaceName)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openSpaces();
world.spacesPage.openSpace(spaceName);
assertTrue(world.fileListPage.isItemInList(itemName));
}
@Then("Alice should see {word} in the filelist as original")
public void user_should_see_item_in_filelist_as_original_word(String itemName)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.fileListPage.isItemInList(itemName.substring(itemName.lastIndexOf('/') + 1)));
assertTrue(world.filesAPI.itemExist(itemName));
}
@Then("Alice should see {string} in the filelist as original")
public void user_should_see_item_in_filelist_as_original_string(String itemName)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
assertTrue(world.fileListPage.isItemInList(itemName.substring(itemName.lastIndexOf('/') + 1)));
assertTrue(world.filesAPI.itemExist(itemName));
}
@Then("Alice should see the detailed information: {word}, {word}, and {word}")
public void user_should_see_defailed_information(String itemName, String type, String size) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.detailsPage.removeShareSheet();
assertEquals(world.detailsPage.getName(), itemName);
assertEquals(world.detailsPage.getSize(), size);
assertEquals(world.detailsPage.getType(), type);
world.detailsPage.backListFiles();
}
@Then("the {fileType} {word} should be marked as downloaded")
public void item_should_be_marked_as_downloaded(String type, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
//We always reach this step from a preview... first browsing back
world.detailsPage.backListFiles();
assertTrue(world.fileListPage.isFileMarkedAsDownloaded(itemName));
}
@Then("Alice should see the {itemtype} {word} as av.offline")
public void user_should_see_item_marked_as_avOffline(String type, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.fileListPage.isItemMarkedAsAvOffline(itemName));
}
@Then("Alice should not see the {itemtype} {word} as av.offline")
public void user_should_not_see_item_marked_as_avOffline(String type, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.fileListPage.isItemMarkedAsUnAvOffline(itemName));
}
@Then("the item {word} should be opened and previewed")
public void item_should_be_opened_and_previewed(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.detailsPage.isItemPreviewed());
world.detailsPage.backListFiles();
}
@Then("the {fileType} {word} should be opened and previewed")
public void image_should_be_opened_and_previewed(String type, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
switch (type) {
case ("file"): {
assertTrue(world.detailsPage.isItemPreviewed());
break;
}
case ("audio"): {
assertTrue(world.detailsPage.isAudioPreviewed());
break;
}
case ("image"): {
assertTrue(world.detailsPage.isImagePreviewed());
world.detailsPage.displayControls();
break;
}
case ("video"): {
assertTrue(world.detailsPage.isVideoPreviewed());
break;
}
case ("damaged"): {
assertTrue(world.detailsPage.isDamagedPreviewed());
break;
}
}
}
@Then("the list of files in {word} folder should match with the server")
public void list_of_files_in_folder_should_match_server(String path)
throws Throwable {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.refreshList();
world.fileListPage.browseToFolder(path);
ArrayList<OCFile> listServer = world.filesAPI.listItems(path, "Alice");
assertTrue(world.fileListPage.isDisplayedListCorrect(path, listServer));
}
@Then("Alice should see the following error/message/item(s)")
public void user_should_see_following_error(DataTable table) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
String error = listItems.get(0).get(0);
Log.log(Level.FINE, "Error/Message to check: " + error);
assertTrue(world.fileListPage.errorDisplayed(error));
}
@Then("Alice should see the file {word} with {word}")
public void user_should_see_the_file_with_text(String itemName, String text) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.detailsPage.isTextInFile(text));
}
@Then("share sheet for the item {word} is displayed")
public void share_sheet_for_item_displayed(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.detailsPage.isShareSheetDisplayed(itemName));
}
@Then("Alice cannot unset as av.offline the item {word}")
public void user_cannot_unset_avoffline_the_item(String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.selectItemList(itemName);
assertFalse(world.fileListPage.isOperationAvailable("Unset as available offline"));
}
@Then("Alice should see the conflict dialog with the following message")
public void user_see_dialog_conflict(DataTable table) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
String msg = listItems.get(0).get(0);
Log.log(Level.FINE, "Message to check: " + msg);
assertTrue(world.fileListPage.isConflictDisplayed());
assertTrue(world.fileListPage.errorDisplayed(msg));
}
@Then("{itemtype} {word} is opened in the app")
public void original_is_opened(String itemType, String itemName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.fileListPage.isItemOpened(itemType, itemName));
}
@Then("Alice should see the browser")
public void bowser_displayed() {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.shortcutDialogPage.isBrowserOpen());
}
@Then("Alice should see the error previewing {word}")
public void error_previewing(String fileName) {
String stepName = new Object() {}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
assertTrue(world.detailsPage.isDamagedPreviewed());
}
}