Skip to content

Commit

Permalink
Doing it without using utils
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratbg committed Apr 26, 2024
1 parent 4c5dca5 commit fce7bef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion webapp/e2e/steps/addUser.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ defineFeature(feature, test => {
await page.waitForSelector('.general');
});
when('I register a user', async () => {
await register(page, email, username, password);
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"]');
});
then('I am in /menu', async () => {
await page.waitForSelector('.divMenu');
await expect(page).toMatchElement('.divMenu');
});
}, 60000);
Expand Down
12 changes: 6 additions & 6 deletions webapp/e2e/steps/login.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ await register(page, email, username, password);

},60000);

beforeEach(async () => {
await logout(page);
await login(page, username, password);
})


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

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 fce7bef

Please sign in to comment.