diff --git a/webapp/e2e/features/addUser.feature b/webapp/e2e/features/addUser.feature index 5ecd17c..df43f29 100644 --- a/webapp/e2e/features/addUser.feature +++ b/webapp/e2e/features/addUser.feature @@ -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 diff --git a/webapp/e2e/features/login.feature b/webapp/e2e/features/login.feature index 54f2597..3d37ffd 100644 --- a/webapp/e2e/features/login.feature +++ b/webapp/e2e/features/login.feature @@ -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 diff --git a/webapp/e2e/steps/addUser.steps.js b/webapp/e2e/steps/addUser.steps.js index a0ac371..23f5f0e 100644 --- a/webapp/e2e/steps/addUser.steps.js +++ b/webapp/e2e/steps/addUser.steps.js @@ -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'); }); diff --git a/webapp/e2e/steps/login.steps.js b/webapp/e2e/steps/login.steps.js index ecaa3d2..4f87a48 100644 --- a/webapp/e2e/steps/login.steps.js +++ b/webapp/e2e/steps/login.steps.js @@ -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);