Skip to content

Commit

Permalink
Ya funciona el e2e de crear grupo
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 24, 2024
1 parent 7a67ba7 commit 46efcab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion webapp/e2e/features/create-group.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Feature: Creating a group
Scenario: The user can create a group
Given A logged-in user
When I click on the Groups link and create a group
Then The Group should be shown on the My Groups page
Then The confirmation message should be shown on screen
38 changes: 11 additions & 27 deletions webapp/e2e/steps/create-group.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,23 @@ defineFeature(feature, (test) => {
//await page.waitForNavigation({ waitUntil: "networkidle0" });

await page.waitForSelector('[name="name"]');
await page.type('[name="name"]', "Test Group");
await page.type('[name="name"]', "Testgroup");
await page.waitForTimeout(2000);
await page.evaluate(() => {
var botones = document.querySelectorAll('button.chakra-button.css-r7xd4a[data-testid="addgroup-button"]');
botones.forEach(function(boton) {
if (boton.textContent === "Crear") {
boton.click();
}
});
});
await page.click('button[data-testid="addgroup-button"]');
});

then("The Group should be shown on the My Groups page", async () => {
await page.waitForTimeout(1000);
await page.click('button[aria-label="Abrir menú"]');
then("The confirmation message should be shown on screen", async () => {
await page.waitForTimeout(1000);
await page.evaluate(() => {
var enlaces = document.querySelectorAll('a.chakra-link.css-spn4bz[data-testid="home-misgrupos-link"]');
enlaces.forEach(function(enlace) {
if (enlace.textContent === "Mis grupos") {
enlace.click();
}
});
});
//await page.waitForNavigation({ waitUntil: "networkidle0" });
await page.waitForTimeout(2000);
const groupExists = await page.evaluate(() => {
const groupName = "Test Group";
const groups = Array.from(document.querySelectorAll("tbody tr td:first-child"));
return groups.some(td => td.textContent === groupName);
await page.waitForSelector('div[role="alert"]');

// Obtén el texto del elemento que contiene el mensaje
const alertText = await page.evaluate(() => {
const alertElement = document.querySelector('div[role="alert"]');
return alertElement.innerText.trim();
});
const rightMessage=alertText === "Group created successfully";
expect(rightMessage).toBe(true);

expect(groupExists).toBe(true);
});
});

Expand Down
2 changes: 1 addition & 1 deletion webapp/e2e/steps/play-battery.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defineFeature(feature, (test) => {
firstquestion = await page.evaluate(element =>
element.textContent, await page.$('[data-testid="question"]'));

await page.click('[data-testid="answer-button"]');
await page.click('[data-testid="answer-button-0"]');
});

then("The next question should be loaded on screen", async () => {
Expand Down
2 changes: 1 addition & 1 deletion webapp/e2e/steps/play-calculator.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defineFeature(feature, (test) => {
await jugarButton[0].click();
await page.waitForSelector('[data-testid="operation"]');

const answer = -1;
const answer = -999;

await page.type('[data-testid="answer-input"]', answer.toString());

Expand Down

0 comments on commit 46efcab

Please sign in to comment.