Skip to content

Commit

Permalink
Last try
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratbg committed Apr 26, 2024
1 parent 744bd16 commit 7dec293
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
3 changes: 1 addition & 2 deletions webapp/e2e/features/addUser.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Feature: Register page functionality

Scenario: Register
Given I am on the add user page
When I register a user
Given I register a user
Then I am in /menu

3 changes: 1 addition & 2 deletions webapp/e2e/features/login.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Feature: Login page functionality

Scenario: Login
Given I am on the login page
When I login as user
Given I login as user
Then I am in /menu

13 changes: 3 additions & 10 deletions webapp/e2e/steps/addUser.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,10 @@ defineFeature(feature, test => {


test('Register', ({ given,when, then }) => {
given('I am on the add user page', async () => {
await page.goto('http://localhost:3000/addUser');
await page.waitForSelector('.general');
});
when('I register a user', async () => {
await page.type('input[name="email"]', email);
await page.type('input[name="username"]', username);
await page.type('input[name="password"]', password);
await page.type('input[name="repeat_password"]', password);
await page.click('button[type="submit"]');
given('I register a user', async () => {
await register(page, email, username, password);
});

then('I am in /menu', async () => {
await expect(page).toMatchElement('.divMenu');
});
Expand Down
13 changes: 2 additions & 11 deletions webapp/e2e/steps/login.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,11 @@ await register(page, email, username, password);


test('Login', ({ given,when, then }) => {
given('I am on the login page', async () => {
await page.goto('http://localhost:3000/login');
await page.waitForSelector('.general');
given('I login a user', async () => {
await login(page, username, password);

});
when('I login as user', async () => {

await page.type('input[type="text"]', username);
await page.type('input[type="password"]', password);
await page.click('button[type="submit"]');
await page.waitForSelector('.general');
});
then('I am in /menu', async () => {
await page.waitForSelector('.general');
await expect(page).toMatchElement('.divMenu');
});
}, 60000);
Expand Down

0 comments on commit 7dec293

Please sign in to comment.