Integration tests use updated Sign In function from Selenium Helpers

This commit is contained in:
BryceLTaylor 2021-11-19 09:38:23 -05:00
parent ed8606d3f2
commit 6520a5f434
5 changed files with 15 additions and 23 deletions

View file

@ -61,7 +61,7 @@ describe('comment tests', async () => {
describe('leave comments', async () => {
beforeAll(async () => {
await signIn(username1, password, driver);
await signIn(username1, password);
await findByXpath('//span[contains(@class, "profile-name")]');
});
@ -137,7 +137,7 @@ describe('comment tests', async () => {
describe('second user tests', async () => {
beforeAll(async () => {
await signIn(username2, password, driver);
await signIn(username2, password);
await findByXpath('//span[contains(@class, "profile-name")]');
});

View file

@ -3,10 +3,11 @@
const SeleniumHelper = require('./selenium-helpers.js');
const {
buildDriver,
clickText,
findByXpath,
clickXpath,
buildDriver
findByXpath,
signIn
} = new SeleniumHelper();
let username = process.env.SMOKE_USERNAME + '1';
@ -30,14 +31,7 @@ describe('www-integration my_stuff', () => {
driver = await buildDriver('www-integration my_stuff');
await driver.get(rootUrl);
await driver.sleep(1000);
await clickXpath('//li[@class="link right login-item"]/a');
let name = await findByXpath('//input[@id="frc-username-1088"]');
await name.sendKeys(username);
let word = await findByXpath('//input[@id="frc-password-1088"]');
await word.sendKeys(password);
await driver.sleep(500);
await clickXpath('//button[contains(@class, "button") and ' +
'contains(@class, "submit-button") and contains(@class, "white")]');
await signIn(username, password);
await findByXpath('//span[contains(@class, "profile-name")]');
});

View file

@ -151,15 +151,13 @@ class SeleniumHelper {
}
// must be used on a www page
async signIn (username, password, driver) {
async signIn (username, password) {
await this.clickXpath('//li[@class="link right login-item"]/a');
let name = await this.findByXpath('//input[@id="frc-username-1088"]');
await name.sendKeys(username);
let word = await this.findByXpath('//input[@id="frc-password-1088"]');
await word.sendKeys(password);
await driver.sleep(500);
await this.clickXpath('//button[contains(@class, "button") and ' +
'contains(@class, "submit-button") and contains(@class, "white")]');
await word.sendKeys(password + this.getKey('ENTER'));
await this.findByXpath('//span[contains(@class, "profile-name")]');
}
urlMatches (regex) {

View file

@ -77,7 +77,7 @@ describe('www-integration sign-in-and-out', () => {
describe('sign out', () => {
beforeEach(async () => {
await driver.get(wwwURL);
await signIn(username, password, driver);
await signIn(username, password);
await driver.sleep(500);
});

View file

@ -78,7 +78,7 @@ describe('studio management', () => {
await driver.get(rootUrl);
// create a studio for tests
await signIn(username2, password, driver);
await signIn(username2, password);
await findByXpath('//span[contains(@class, "profile-name")]');
await driver.get(rateLimitCheck);
await driver.get(myStuffURL);
@ -99,7 +99,7 @@ describe('studio management', () => {
test('invite a curator', async () => {
// sign in as user2
await signIn(username2, password, driver);
await signIn(username2, password);
await findByXpath('//span[contains(@class, "profile-name")]');
// invite user3 to curate
@ -114,7 +114,7 @@ describe('studio management', () => {
test('accept curator invite', async () => {
// Sign in user3
await signIn(username3, password, driver);
await signIn(username3, password);
await findByXpath('//span[contains(@class, "profile-name")]');
// accept the curator invite
@ -126,7 +126,7 @@ describe('studio management', () => {
test('promote to manager', async () => {
// sign in as user2
await signIn(username2, password, driver);
await signIn(username2, password);
await findByXpath('//span[contains(@class, "profile-name")]');
// for some reason the user isn't showing up without reloading the page
await driver.get(curatorTab);
@ -150,7 +150,7 @@ describe('studio management', () => {
test('transfer studio host', async () => {
// sign in as user2
await signIn(username2, password, driver);
await signIn(username2, password);
await findByXpath('//span[contains(@class, "profile-name")]');
// for some reason the user isn't showing up without reloading the page
await driver.get(curatorTab);