This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 70288994 authored by Eduard Frankford's avatar Eduard Frankford
Browse files

testing

parent 6ff21474
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
...@@ -104,11 +104,14 @@ frontend-test: ...@@ -104,11 +104,14 @@ frontend-test:
e2e-test: e2e-test:
services: services:
- selenium/standalone-chrome - selenium/standalone-chrome
image: ubuntu:20.04
stage: e2e stage: e2e
cache: {} cache: {}
dependencies: dependencies:
- frontend-test - frontend-test
script: script:
- apt-get install default-jre
- apt-get -f install
- npm run e2e - npm run e2e
# sonar-analyze: # sonar-analyze:
# stage: analyze # stage: analyze
......
...@@ -13,7 +13,9 @@ describe('account', () => { ...@@ -13,7 +13,9 @@ describe('account', () => {
let settingsPage: SettingsPage; let settingsPage: SettingsPage;
before(async () => { before(async () => {
browser.waitForAngularEnabled(true);
await browser.get('/'); await browser.get('/');
browser.waitForAngularEnabled(false);
await browser.sleep(2000); await browser.sleep(2000);
// browser.ignoreSynchronization = true; // browser.ignoreSynchronization = true;
...@@ -21,22 +23,27 @@ describe('account', () => { ...@@ -21,22 +23,27 @@ describe('account', () => {
}); });
it('should fail to login with bad password', async () => { it('should fail to login with bad password', async () => {
// browser.waitForAngularEnabled(false);
signInPage = await navBarPage.getSignInPage(); signInPage = await navBarPage.getSignInPage();
await signInPage.autoSignInUsing(username, 'foo'); await signInPage.autoSignInUsing(username, 'foo');
await browser.sleep(2000);
const expect2 = 'login.messages.error.authentication'; const expect2 = 'login.messages.error.authentication';
const value2 = await element(by.css('.alert-danger')).getAttribute('jhiTranslate'); const value2 = await element(by.css('.alert-danger')).getAttribute('jhiTranslate');
console.log(expect2); console.log(expect2);
console.log(value2); console.log(value2);
await browser.sleep(2000);
expect(value2).to.eq(expect2); expect(value2).to.eq(expect2);
}); });
it('should login successfully with admin account', async () => { it('should login successfully with admin account', async () => {
browser.waitForAngularEnabled(true);
await browser.get('/'); await browser.get('/');
browser.waitForAngularEnabled(false);
signInPage = await navBarPage.getSignInPage(); signInPage = await navBarPage.getSignInPage();
await signInPage.autoSignInUsing(username, password); await signInPage.autoSignInUsing(username, password);
await browser.sleep(2000);
const expect2 = 'home.logged.message'; const expect2 = 'home.logged.message';
await browser.wait(ec.visibilityOf(element(by.id('home-logged-message')))); await browser.wait(ec.visibilityOf(element(by.id('home-logged-message'))));
const value2 = await element(by.id('home-logged-message')).getAttribute('jhiTranslate'); const value2 = await element(by.id('home-logged-message')).getAttribute('jhiTranslate');
...@@ -46,12 +53,14 @@ describe('account', () => { ...@@ -46,12 +53,14 @@ describe('account', () => {
it('should be able to update settings', async () => { it('should be able to update settings', async () => {
await navBarPage.clickOnAccountMenu(); await navBarPage.clickOnAccountMenu();
settingsPage = await navBarPage.getSettingsPage(); settingsPage = await navBarPage.getSettingsPage();
await browser.sleep(2000);
const expect1 = 'settings.title'; const expect1 = 'settings.title';
const value1 = await settingsPage.getTitle(); const value1 = await settingsPage.getTitle();
expect(value1).to.eq(expect1); expect(value1).to.eq(expect1);
await settingsPage.save(); await settingsPage.save();
await browser.sleep(500); await browser.sleep(500);
await browser.sleep(2000);
const expect2 = 'settings.messages.success'; const expect2 = 'settings.messages.success';
const alert = element(by.css('.alert-success')); const alert = element(by.css('.alert-success'));
const value2 = await alert.getAttribute('jhiTranslate'); const value2 = await alert.getAttribute('jhiTranslate');
...@@ -60,6 +69,7 @@ describe('account', () => { ...@@ -60,6 +69,7 @@ describe('account', () => {
it('should fail to update password when using incorrect current password', async () => { it('should fail to update password when using incorrect current password', async () => {
passwordPage = await navBarPage.getPasswordPage(); passwordPage = await navBarPage.getPasswordPage();
await browser.sleep(2000);
expect(await passwordPage.getTitle()).to.eq('password.title'); expect(await passwordPage.getTitle()).to.eq('password.title');
...@@ -67,6 +77,7 @@ describe('account', () => { ...@@ -67,6 +77,7 @@ describe('account', () => {
await passwordPage.setPassword('new_password'); await passwordPage.setPassword('new_password');
await passwordPage.setConfirmPassword('new_password'); await passwordPage.setConfirmPassword('new_password');
await passwordPage.save(); await passwordPage.save();
await browser.sleep(2000);
const expect2 = 'password.messages.error'; const expect2 = 'password.messages.error';
const alert = element(by.css('.alert-danger')); const alert = element(by.css('.alert-danger'));
...@@ -77,21 +88,25 @@ describe('account', () => { ...@@ -77,21 +88,25 @@ describe('account', () => {
it('should be able to update password', async () => { it('should be able to update password', async () => {
passwordPage = await navBarPage.getPasswordPage(); passwordPage = await navBarPage.getPasswordPage();
await browser.sleep(2000);
expect(await passwordPage.getTitle()).to.eq('password.title'); expect(await passwordPage.getTitle()).to.eq('password.title');
await passwordPage.setCurrentPassword(password); await passwordPage.setCurrentPassword(password);
await passwordPage.setPassword('newpassword'); await passwordPage.setPassword('newpassword');
await passwordPage.setConfirmPassword('newpassword'); await passwordPage.setConfirmPassword('newpassword');
await passwordPage.save(); await passwordPage.save();
await browser.sleep(2000);
const successMsg = 'password.messages.success'; const successMsg = 'password.messages.success';
const alert = element(by.css('.alert-success')); const alert = element(by.css('.alert-success'));
const alertValue = await alert.getAttribute('jhiTranslate'); const alertValue = await alert.getAttribute('jhiTranslate');
expect(alertValue).to.eq(successMsg); expect(alertValue).to.eq(successMsg);
await navBarPage.autoSignOut(); await navBarPage.autoSignOut();
await browser.sleep(2000);
signInPage = await navBarPage.getSignInPage(); signInPage = await navBarPage.getSignInPage();
await signInPage.autoSignInUsing(username, 'newpassword'); await signInPage.autoSignInUsing(username, 'newpassword');
await browser.sleep(2000);
// change back to default // change back to default
await navBarPage.clickOnPasswordMenu(); await navBarPage.clickOnPasswordMenu();
...@@ -100,6 +115,8 @@ describe('account', () => { ...@@ -100,6 +115,8 @@ describe('account', () => {
await passwordPage.setPassword(password); await passwordPage.setPassword(password);
await passwordPage.setConfirmPassword(password); await passwordPage.setConfirmPassword(password);
await passwordPage.save(); await passwordPage.save();
await browser.sleep(2000);
// wait for success message // wait for success message
const alertValue2 = await alert.getAttribute('jhiTranslate'); const alertValue2 = await alert.getAttribute('jhiTranslate');
expect(alertValue2).to.eq(successMsg); expect(alertValue2).to.eq(successMsg);
...@@ -107,8 +124,9 @@ describe('account', () => { ...@@ -107,8 +124,9 @@ describe('account', () => {
it('should navigate to 404 not found error page on non existing route and show user own navbar if valid authentication exists', async () => { it('should navigate to 404 not found error page on non existing route and show user own navbar if valid authentication exists', async () => {
// don't sign out and refresh page with non existing route // don't sign out and refresh page with non existing route
browser.waitForAngularEnabled(true);
await browser.get('/this-is-link-to-non-existing-page'); await browser.get('/this-is-link-to-non-existing-page');
browser.waitForAngularEnabled(false);
// should navigate to 404 not found page // should navigate to 404 not found page
const url = await browser.getCurrentUrl(); const url = await browser.getCurrentUrl();
expect(url).to.endWith('404'); expect(url).to.endWith('404');
...@@ -118,6 +136,8 @@ describe('account', () => { ...@@ -118,6 +136,8 @@ describe('account', () => {
}); });
after(async () => { after(async () => {
browser.waitForAngularEnabled(true);
await navBarPage.autoSignOut(); await navBarPage.autoSignOut();
browser.waitForAngularEnabled(false);
}); });
}); });
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment