Skip to content

Commit

Permalink
#517 update sign up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmartin committed Jun 11, 2021
1 parent 3f74abe commit a71f90d
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 61 deletions.
13 changes: 8 additions & 5 deletions tests/jest/model-registration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ describe('Scidash Model Registration Tests', () => {
}
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 60000 })
})

it('Sign Up Button Visible', async () => {
await wait4selector(page, 'a.signUpButton', { visible: true, timeout : 30000 })
})
})

// Tests User Registration/Sign-Up Works using the Sign-Up Button,
Expand All @@ -93,11 +89,18 @@ describe('Scidash Model Registration Tests', () => {
it('Login Button Visible', async () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".loginButton").click()
});
await wait4selector(page, 'div.login-container', { visible: true, timeout : 30000 });
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".signUpButton").click()
document.getElementsByName("_signup")[0].click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})
Expand Down
12 changes: 7 additions & 5 deletions tests/jest/model-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { wait4selector, click} from './utils';

export const modelCreation = (page, newModelName, newModelURL, newModelClass, newModelTag, var1, var2) => {
it('Sidebar Component Opened, Models Option Present', async () => {
await click(page, 'button#hamMenu');
await wait4selector(page, 'li#hamMenuModels', { visible: true })
await page.evaluate( () => {
document.getElementById("hamMenu").click()
});
await wait4selector(page, 'li#hamMenuModels', { visible: true, timeout : 15000 })
})

it('Models Page Opened, New Model Button Present', async () => {
Expand Down Expand Up @@ -416,7 +418,7 @@ export const editModel = (page, editedModelName, editedModelClass, editedModelTa
for(var i =0; i< tableRows.length; i++){
if(tableRows[i].innerText ==var1){
var parentDiv = document.querySelectorAll(".scidash-table td")[i+1];
return parentDiv.querySelectorAll("span")[1].classList.contains("Mui-checked");
return parentDiv?.querySelectorAll("span")[1]?.classList?.contains("Mui-checked");
}
}
return false;
Expand Down Expand Up @@ -486,7 +488,7 @@ export const editModel = (page, editedModelName, editedModelClass, editedModelTa
expect(modelClass).toEqual(editedModelClass);

const modelTag = await page.evaluate( () => {
return document.querySelectorAll(".chips span")[1].innerText;
return document.querySelectorAll(".chips span")[0].innerText;
});

expect(modelTag).toEqual(editedModelTag);
Expand All @@ -502,7 +504,7 @@ export const editModel = (page, editedModelName, editedModelClass, editedModelTa

it('Test Edited Model Tag is updated in Models Page', async () => {
const modelTag = await page.evaluate( () => {
return document.querySelectorAll(".chips span")[1].innerText;
return document.querySelectorAll(".chips span")[0].innerText;
});

expect(modelTag).toEqual(editedModelTag);
Expand Down
26 changes: 15 additions & 11 deletions tests/jest/neuroml-db-model-registration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ describe('Scidash Neuroml DB Model Registration Tests', () => {

await wait4selector(page, 'a.loginButton', { visible: true, timeout : 60000 })
})

it('Sign Up Button Visible', async () => {
await wait4selector(page, 'a.signUpButton', { visible: true, timeout : 30000 })
})
})

// Tests User Registration/Sign-Up Works using the Sign-Up Button,
Expand All @@ -92,13 +88,21 @@ describe('Scidash Neuroml DB Model Registration Tests', () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".signUpButton").click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".loginButton").click()
});
await wait4selector(page, 'div.login-container', { visible: true, timeout : 30000 });
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.getElementsByName("_signup")[0].click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})


// Perform registration form tests
signUpTests(page, newUserID, newUserEmail, newUserPassword);
Expand Down
28 changes: 16 additions & 12 deletions tests/jest/scheduling-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ describe('Scidash Scheduling Tests', () => {
}
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 60000 })
})

it('Sign Up Button Visible', async () => {
await wait4selector(page, 'a.signUpButton', { visible: true, timeout : 30000 })
})
})

// Tests User Registration/Sign-Up Works using the Sign-Up Button,
Expand Down Expand Up @@ -136,13 +132,21 @@ describe('Scidash Scheduling Tests', () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".signUpButton").click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".loginButton").click()
});
await wait4selector(page, 'div.login-container', { visible: true, timeout : 30000 });
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.getElementsByName("_signup")[0].click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})


// Perform registration form tests
signUpTests(page, newUserID, newUserEmail, newUserPassword);
Expand Down Expand Up @@ -189,7 +193,7 @@ describe('Scidash Scheduling Tests', () => {
describe('Scheduling Page Tests', () => {
it('Sidebar Component Opened, Scheduling Option Present', async () => {
await click(page, 'button#hamMenu');
await wait4selector(page, 'li#hamMenuScheduling', { visible: true })
await wait4selector(page, 'li#hamMenuScheduling', { visible: true, timeout : 5000 })
})

it('Scheduling Page Opened', async () => {
Expand Down
26 changes: 15 additions & 11 deletions tests/jest/test-registration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ describe('Scidash Tests Registration', () => {

await wait4selector(page, 'a.loginButton', { visible: true, timeout : 60000 })
})

it('Sign Up Button Visible', async () => {
await wait4selector(page, 'a.signUpButton', { visible: true, timeout : 30000 })
})
})

// Tests User Registration/Sign-Up Works using the Sign-Up Button,
Expand All @@ -99,13 +95,21 @@ describe('Scidash Tests Registration', () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".signUpButton").click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".loginButton").click()
});
await wait4selector(page, 'div.login-container', { visible: true, timeout : 30000 });
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.getElementsByName("_signup")[0].click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})


// Perform registration form tests
signUpTests(page, newUserID, newUserEmail, newUserPassword);
Expand Down
6 changes: 3 additions & 3 deletions tests/jest/tests-creation-utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { wait4selector, click} from './utils';
import { wait4selector, click, closeModalWindow} from './utils';

export const newTestCreation = async (page, name, className, tag, newObservationSchema, secondObservationSchema,
observationValueN, observationValueSTD, observationValueMean, parameterTMax, tableModelLength) => {

it('Sidebar Component Opened, Tests Registration Option Present', async () => {
await click(page, 'button#hamMenu');
await wait4selector(page, 'li#hamMenuTests', { visible: true , timeout : 5000})
await click(page, 'button#hamMenu');
await wait4selector(page, 'li#hamMenuTests', { visible: true , timeout : 15000})
})

it('Tests Registration Page Opened, New Tests Registration Button Present', async () => {
Expand Down
32 changes: 20 additions & 12 deletions tests/jest/user-auth-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ describe('Scidash User Authorization Tests', () => {
it('Login Button Visible', async () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

it('Sign Up Button Visible', async () => {
await wait4selector(page, 'a.signUpButton', { visible: true, timeout : 30000 })
})
})

// Tests User Registration/Sign-Up Works using the Sign-Up Button
Expand Down Expand Up @@ -73,14 +69,26 @@ describe('Scidash User Authorization Tests', () => {
}
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate(() => {
document.querySelector(".signUpButton").click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})

// Precondition: User is logout
it('Login Button Visible', async () => {
await wait4selector(page, 'a.loginButton', { visible: true, timeout : 30000 })
})

it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.querySelector(".loginButton").click()
});
await wait4selector(page, 'div.login-container', { visible: true, timeout : 30000 });
})

// Click Sign-Up button and wait for registration form to show up
it('Open Sign Up Page', async () => {
await page.evaluate( () => {
document.getElementsByName("_signup")[0].click()
});
await wait4selector(page, 'div.registration-container', { visible: true, timeout : 30000 });
})

// Perform registration form tests
signUpTests(page, newUserID, newUserEmail, newUserPassword);
Expand Down
4 changes: 2 additions & 2 deletions tests/jest/user-auth-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const loginTests = (page, newUserID, newUserPassword) => {

it('Test Validation Fields', async () => {
await page.evaluate( () => {
document.querySelector(".login-container button").click()
document.getElementsByName("_submit")[0].click()
});

await page.waitFor(2000);
Expand Down Expand Up @@ -122,7 +122,7 @@ export const loginTests = (page, newUserID, newUserPassword) => {

it('Submit User Credentials', async () => {
await page.evaluate( () => {
document.querySelector(".login-container button").click()
document.getElementsByName("_submit")[0].click()
});
await wait4selector(page, '#user-button', { visible: true, timeout : 60000 })
})
Expand Down

0 comments on commit a71f90d

Please sign in to comment.