Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #142

Merged
merged 4 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions webapp/e2e/features/userprofile-form.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ Feature: View and Change User Quiz Rankings

Scenario: Viewing Global Rankings
Given the user navigates to their profile
When they select the "Global" category
Then they see their performance statistics for global quizzes
When see user general info
Then they see their performance statistics for all quizzes

Scenario: Switching Category to Flags
Given the user is on their profile page
When they click on the "Flags" category
Then they view their performance metrics for flag-related quizzes

Scenario: Switching Category to Food
Given the user is on their profile page
When they click on the "Food" category
Then they view their performance metrics for food-related quizzes

67 changes: 15 additions & 52 deletions webapp/e2e/steps/userprofile-form.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,76 +29,39 @@ defineFeature(feature, test => {

let username;
let password;
let email;

given('the user navigates to their profile', async () => {
username = "testUser"
username = "testUser";
password = "testpass";
email = "test@email";
await expect(page).toClick("a", { text: "Log In" });
await expect(page).toFill('input[name="username"]', username);
await expect(page).toFill('input[name="password"]', password);
await expect(page).toClick("button", { text: "Log In" });
await expect(page).toClick("button", { text: "My stats" });
});

when('they select the "Global" category', async () => {
when('see user general info', async () => {

await expect(page).toMatchElement("h2", { text: "Username: " + username });
await expect(page).toClick("button", { text: "Flags" });
await expect(page).toClick("button", { text: "Global" });
await expect(page).toMatchElement("h2", { text: username });
await expect(page).toMatchElement("p", { text: "Email: " + email });
});

then('they see their performance statistics for global quizzes', async () => {
await expect(page).toMatchElement('.ranking h3', { text: "global Ranking" });
await expect(page).toMatchElement(".ranking p:nth-child(1)", { text: "Total Answered Questions: " + 1 });
});

});

test('Switching Category to Flags', ({given,when,then}) => {

let username;
let password;

given('the user is on their profile page', async () => {
username = "testUser"
password = "testpass";
await expect(page).toMatchElement("h2", { text: "Username: " + username });
});

when('they click on the "Flags" category', async () => {

await expect(page).toClick("button", { text: "Flags" });
});
then('they see their performance statistics for all quizzes', async () => {
await expect(page).toMatchElement('h3.font-bold', { text: "Global" });
await expect(page).toMatchElement('h3.font-bold', { text: "Flags" });
await expect(page).toMatchElement('h3.font-bold', { text: "Cities" });
await expect(page).toMatchElement('h3.font-bold', { text: "Food" });
await expect(page).toMatchElement('h3.font-bold', { text: "Attractions" });
await expect(page).toMatchElement('h3.font-bold', { text: "Monuments" });

then('they view their performance metrics for flag-related quizzes', async () => {
await expect(page).toMatchElement('.ranking h3', { text: "flags Ranking" });
await expect(page).toMatchElement(".ranking p:nth-child(1)", { text: "Total Answered Questions: " + 1 });
await expect(page).toMatchElement("div.mx-auto h3.font-bold + p", { text: "Total questions: 1" });
await expect(page).toMatchElement("div.mx-auto h3.font-bold + p", { text: "Total questions: 0" });
});

});

test('Switching Category to Food', ({given,when,then}) => {

let username;
let password;

given('the user is on their profile page', async () => {
username = "testUser"
password = "testpass";
await expect(page).toMatchElement("h2", { text: "Username: " + username });
});

when('they click on the "Food" category', async () => {

await expect(page).toClick("button", { text: "Food" });
});

then('they view their performance metrics for food-related quizzes', async () => {
await expect(page).toMatchElement('.ranking h3', { text: "foods Ranking" });
await expect(page).toMatchElement(".ranking p:nth-child(1)", { text: "Total Answered Questions: " + 0 });
});

});

afterAll(async ()=>{
browser.close()
Expand Down