Skip to content

Commit

Permalink
fix: e2e tests failing due to changing class of login button
Browse files Browse the repository at this point in the history
  • Loading branch information
aleche28 committed Jan 14, 2024
1 parent bf89d8a commit 3a7238a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions backend/tests/e2e/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,44 @@ const { By, until } = require("selenium-webdriver");

const baseURL = `http://localhost:${process.env.FRONTEND_PORT}`;

module.exports = {
module.exports = {
doLogin: async (username, password, driver) => {
await driver.get(baseURL);

await driver.sleep(1000);

// perform login
const usernameBox = await driver.wait(until.elementLocated(By.id("username")), 20000);
usernameBox.clear();
await driver.sleep(500);
usernameBox.sendKeys(username);

const passwordBox = await driver.wait(until.elementLocated(By.id("password")), 20000);
passwordBox.clear();
await driver.sleep(500);
passwordBox.sendKeys(password);

await driver.sleep(2000);

// click submit button
const submitButton = await driver.findElement(By.xpath('//div[@class="cff0ff2c6"]//button[text()="Continue"]'));
await submitButton.click();


await passwordBox.submit();

await driver.sleep(500);
},

doLogout: async (driver) => {
await driver.get(baseURL);
await driver.sleep(1000);

// click on the drop menu
const logoutDropdown = await driver.findElement(By.id("dropdown-basic"));
await logoutDropdown.click();

await driver.sleep(1000);

// click on logout
const logout = await driver.findElement(By.id("logout-id"));
await logout.click();

await driver.sleep(1000);
}
}

0 comments on commit 3a7238a

Please sign in to comment.