Skip to content

Commit

Permalink
Merge pull request #65 from Arquisoft/tests-e2e
Browse files Browse the repository at this point in the history
tests con registro
  • Loading branch information
uo283182 authored Apr 27, 2024
2 parents 741eea8 + eeb71b7 commit aa38718
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions webapp/e2e/steps/login-form.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ defineFeature(feature, test => {
let password;

given('A registered user', async () => {
username = "j"
password = "j"
username = "login1"
password = "test"
await expect(page).toClick('button', { text: 'SignUp' })
await expect(page).toFill('input[name="username"]', username);
await expect(page).toFill('input[name="password"]', password);
await expect(page).toClick('button', { text: 'Add User' });
await expect(page).toClick('a', { text: 'Already have an account? Login here.' });
await expect(page).toClick('button', { text: 'Login' })
});

Expand All @@ -44,6 +49,7 @@ defineFeature(feature, test => {
await expect(page).toMatchElement("button", { text: "Jugar" });
await expect(page).toMatchElement("button", { text: "Ver historial" });
await expect(page).toMatchElement("input[type='number']");
await expect(page.url()).toBe('http://localhost:3000/home');
});
})

Expand Down
3 changes: 2 additions & 1 deletion webapp/e2e/steps/record-button.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defineFeature(feature, test => {
let password;

given('An authenticated user', async () => {
username = "record1";
username = "record2";
password = "record1";
await expect(page).toClick('button', { text: 'SignUp' });
await expect(page).toFill('input[name="username"]', username);
Expand All @@ -46,6 +46,7 @@ defineFeature(feature, test => {
});

then('I can see my records', async () => {
await expect(page.url()).toBe('http://localhost:3000/history');
await expect(page).toMatchElement("th", { text: "Preguntas acertadas" });
await expect(page).toMatchElement("th", { text: "Nº preguntas" });
await expect(page).toMatchElement("th", { text: "Tiempo total" });
Expand Down
4 changes: 2 additions & 2 deletions webapp/e2e/steps/register-form.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ defineFeature(feature, test => {
let password;

given('An unregistered user', async () => {
username = "j"
password = "j"
username = "register1"
password = "test"
await expect(page).toClick('button', { text: 'SignUp' })
});

Expand Down

0 comments on commit aa38718

Please sign in to comment.