diff --git a/test/SignUpLogIn.test.js b/test/SignUpLogIn.test.js index 72aee6563d..e396ecfef7 100644 --- a/test/SignUpLogIn.test.js +++ b/test/SignUpLogIn.test.js @@ -2,7 +2,7 @@ let { getWebDriver, findButtonContainingText, waitForUrl, click } = require("./u let { URLS, TEST_USER_1 } = require("./utils/const"); const { By, until } = require("selenium-webdriver"); const { deleteAllUsers } = require("./utils/api"); -const { fillLoginForm, fillSignUpForm, signUpAndLogIn, logOut } = require("./utils/utils"); +const { fillLoginForm, fillSignUpForm, signUp } = require("./utils/utils"); /** * SIGN UP LOG IN TEST @@ -64,8 +64,7 @@ describe("Sign Up/Log In test", () => { beforeEach(async () => { await deleteAllUsers(); // create existing user - await signUpAndLogIn(driver, TEST_USER_1); - await logOut(driver, TEST_USER_1); + await signUp(driver, TEST_USER_1); }); test("simulate unsuccessful user sign up", async () => { diff --git a/test/utils/utils.js b/test/utils/utils.js index 719b6a16e2..d045e4d3b6 100644 --- a/test/utils/utils.js +++ b/test/utils/utils.js @@ -24,19 +24,24 @@ const fillLoginForm = async (driver, user) => { }; module.exports.fillLoginForm = fillLoginForm; -module.exports.signUpAndLogIn = async (driver, user) => { +const signUp = async (driver, user) => { await driver.get(URLS.signup); await fillSignUpForm(driver, user); await waitForUrl(driver, URLS.login); - await fillLoginForm(driver, user); - await driver.wait(until.elementLocated(By.xpath(`//button[contains(text(),'Logout')]`)), 3000); }; +module.exports.signUp = signUp; -module.exports.logIn = async (driver, user) => { +const logIn = async (driver, user) => { await driver.get(URLS.login); await fillLoginForm(driver, user); await driver.wait(until.elementLocated(By.xpath(`//button[contains(text(),'Logout')]`)), 3000); }; +module.exports.logIn = logIn; + +module.exports.signUpAndLogIn = async (driver, user) => { + await signUp(driver, user); + await logIn(driver, user); +}; module.exports.logOut = async (driver) => { await driver.get(URLS.logout);