Skip to content

Commit

Permalink
Make sure protractor tests actually use the dummyReader
Browse files Browse the repository at this point in the history
  • Loading branch information
LudvigHz committed Oct 3, 2021
1 parent f05040c commit 50a4ec8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion features/step_definitions/webSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,33 @@ function logIn(username, password) {
module.exports = function () {
this.Given(/^I am logged in as an admin$/, () => {
logIn('admin', 'password');
this.userType = 'admin';
});

this.Given(/^I am logged in as a moderator$/, () => {
logIn('moderator', 'password');
this.userType = 'moderator';
});

this.When(/^I log in$/, () => {
logIn('testUser', 'password');
this.userType = 'user';
});

this.When(/^I log out/, () => {
const logoutButton = element(by.linkText('Logg ut'));
logoutButton.click();
this.userType = undefined;
});

this.Given(/^I am logged in$/, () => {
logIn('testUser', 'password');
});

this.Given(/^I am on page "([^"]*)"$/, (path) => {
browser.get(path);
const actualPath =
this.userType === 'moderator' ? path + '?dummyReader' : path;
browser.get(actualPath);
});

this.When(/^I go to page "([^"]*)"$/, (path) => {
Expand Down

0 comments on commit 50a4ec8

Please sign in to comment.