forked from cucumber/cucumber-java-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSpacesSteps.java
84 lines (71 loc) · 3.08 KB
/
SpacesSteps.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
/**
* ownCloud Android Scenario Tests
*
* @author Jesús Recio Rincón (@jesmrec)
*/
package io.cucumber;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import utils.log.Log;
public class SpacesSteps {
private World world;
public SpacesSteps(World world) {
this.world = world;
}
@Given("the following spaces have been created in {word} account")
public void spaces_have_been_created(String userName, DataTable table) throws IOException {
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 description = rows.get(1);
world.graphAPI.createSpace(name, description, userName);
}
}
@When("Alice selects the spaces view")
public void user_selects_spaces_view() {
String stepName = new Object(){}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.fileListPage.openSpaces();
}
@When("following space is disabled in server")
public void space_disabled_server(DataTable table)
throws IOException {
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 description = rows.get(1);
world.graphAPI.disableSpace(name, description);
}
}
@When("Alice filters the list using {word}")
public void user_filters_list(String pattern) {
String stepName = new Object(){}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
world.spacesPage.typeSearch(pattern);
}
@Then("Alice should see the following spaces")
public void user_should_see_following_spaces(DataTable table) {
String stepName = new Object(){}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
assertTrue(world.spacesPage.areAllSpacesVisible(listItems));
}
@Then("Alice should not see the following spaces")
public void user_should_not_see_following_spaces(DataTable table) {
String stepName = new Object(){}.getClass().getEnclosingMethod().getName().toUpperCase();
Log.log(Level.FINE, "----STEP----: " + stepName);
List<List<String>> listItems = table.asLists();
assertFalse(world.spacesPage.areAllSpacesVisible(listItems));
}
}