Skip to content

Commit

Permalink
Wire in scenarios for guests not discovering unlisted rooms
Browse files Browse the repository at this point in the history
See: #72
See: #39

- You can bypass waiting for a room card to exist by passing `false` to
  the findRoomCard method on workspace

We think that it would be nice to make the `findRoomCard` function to
return the roomCard itself, or return a false; and move the wait out of
it completely; which would push responsibility for knowing whether we
should "wait for it" to the step.

This would also allow us to "check" the value of the roomCard in steps.

- We use `cucumber-pretty` to format our output legibly
  • Loading branch information
zspencer committed Aug 23, 2020
1 parent e1ba72f commit 69f8f9e
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 22 deletions.
37 changes: 19 additions & 18 deletions features/discovering-rooms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,39 @@ Feature: Discovering Rooms
When a Workspace Member is on the Workspace Dashboard
Then they see the Room

@built @unimplemented-steps
Scenario: Workspace Member may not discover Unlisted Room
Given a Workspace with an Unlisted Room
When a Workspace Member is on the Workspace Dashboard
Then they do not see the Room

@built @unimplemented-steps
Scenario: Guest may discover Listed Room
Given a Workspace with a Listed Room
When a Guest is on the Workspace Dashboard
Then they see the Room

@built @unimplemented-steps
Scenario: Guest may not discover Unlisted Rooms
Given a Workspace with an Unlisted Room
@unstarted
Scenario: Guest may not discover Listed Internal Room
Given a Workspace with an Listed Internal Room
When a Guest is on the Workspace Dashboard
Then they do not see the Room

@unstarted
# Unlisted Rooms

@built
Scenario: Guest may not discover Unlisted Rooms
Given the Guest is on the "System Test" Workspace Dashboard
Then the Guest does not see the "Unlisted Room 1" Room's Door

@built
Scenario: Workspace Member may not discover Unlisted Room
Given the Workspace Member is on the "System Test" Workspace Dashboard
Then the Workspace Member does not see the "Unlisted Room 1" Room's Door

@unstarted @unimplemented-steps
Scenario: Room Creator may discover Unlisted Room
Given a Workspace with an Unlisted Room
When the Room Creator is on the Workspace Dashboard
Then they see the Room


@unstarted
Scenario: Previous Attendee may discover previously visited Unlisted Room
Scenario: Room Previous Attendee may discover previously visited Unlisted Room
Given a Workspace with an Unlisted Room
When a Previous Attendee of that Room is on the Workspace Dashboard
Then they see the Room

@unstarted
Scenario: Guest may not discover Listed Internal Room
Given a Workspace with an Listed Internal Room
When a Guest is on the Workspace Dashboard
Then they do not see the Room
Then they see the Room
7 changes: 5 additions & 2 deletions features/page-objects/WorkspacePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class WorkspacePage extends Page {
roomCard.findElement(By.linkText("Enter Room")).click();
}

async findRoomCard(room) {
await this.driver.wait(until.elementLocated(By.id(room.name)));
async findRoomCard(room, wait = true) {
if(wait) {
await this.driver.wait(until.elementLocated(By.id(room.name)));
}

return await this.driver.findElement(By.id(room.name));
}

Expand Down
23 changes: 23 additions & 0 deletions features/steps/room_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Given("a Workspace with a {accessLevel} {room}", function (accessLevel, room) {
return "pending";
});

Given('a Workspace with an {publicityLevel} Room', function (publicityLevel) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});

When("a {actor} provides the wrong {room} Key", function (actor, room) {
// Write code here that turns the phrase above into concrete actions
return "pending";
Expand Down Expand Up @@ -34,3 +39,21 @@ Then('the {workspace} has a {room}', function (workspace, room) {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});


Then('the {actor} does not see the {room}\'s Door', function (actor, room) {
// We bypass the wait for the room door, and if we _do_ find it,
// something has gone horribly wrong, so we're going to raise an
// exception and fail the test.
// If it _does not_ find the roomCard, then everything is beautiful;
// all is right with the world; and we pass the assertion.
//
// TODO: Figure out a way to do this that doesn't require changing the
// find methods on our page objects!
return this.workspace.findRoomCard(room, false).then((ok) => {
throw `We found a door for ${room.name} that we did not want to find`
}).catch((e) => {
if(e.name === 'NoSuchElementError') { return true }
throw e
});
});
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Community owned tools that bring people together, both online and off",
"main": "index.js",
"scripts": {
"test": "cucumber-js --tags 'not @unscheduled and not @wip and not @unimplemented-steps and not @unstarted'"
"test": "cucumber-js --format node_modules/cucumber-pretty --tags 'not @unscheduled and not @wip and not @unimplemented-steps and not @unstarted'"
},
"repository": {
"type": "git",
Expand All @@ -23,7 +23,9 @@
"homepage": "https://github.com/zinc-collective/convene#readme",
"devDependencies": {
"cucumber": "^6.0.5",
"cucumber-pretty": "^6.0.0",
"geckodriver": "^1.20.0",
"selenium-webdriver": "^4.0.0-alpha.7"
}
},
"dependencies": {}
}

0 comments on commit 69f8f9e

Please sign in to comment.