diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index baac2ae94eaa0f3a0040fb64d10b07923cc7f106..3c3773e897894143f8723ae2942de1196148e818 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -104,11 +104,14 @@ frontend-test: e2e-test: services: - selenium/standalone-chrome + image: ubuntu:20.04 stage: e2e cache: {} dependencies: - frontend-test script: + - apt-get install default-jre + - apt-get -f install - npm run e2e # sonar-analyze: # stage: analyze diff --git a/src/test/javascript/e2e/account/account.spec.ts b/src/test/javascript/e2e/account/account.spec.ts index f22940d60464b92a8ed1555448b24bd50dbf95d9..f5999a085bd4011ba137c36aebf3e46f81c5ef34 100644 --- a/src/test/javascript/e2e/account/account.spec.ts +++ b/src/test/javascript/e2e/account/account.spec.ts @@ -13,7 +13,9 @@ describe('account', () => { let settingsPage: SettingsPage; before(async () => { + browser.waitForAngularEnabled(true); await browser.get('/'); + browser.waitForAngularEnabled(false); await browser.sleep(2000); // browser.ignoreSynchronization = true; @@ -21,22 +23,27 @@ describe('account', () => { }); it('should fail to login with bad password', async () => { - // browser.waitForAngularEnabled(false); signInPage = await navBarPage.getSignInPage(); await signInPage.autoSignInUsing(username, 'foo'); + await browser.sleep(2000); const expect2 = 'login.messages.error.authentication'; const value2 = await element(by.css('.alert-danger')).getAttribute('jhiTranslate'); console.log(expect2); console.log(value2); + await browser.sleep(2000); expect(value2).to.eq(expect2); }); it('should login successfully with admin account', async () => { + browser.waitForAngularEnabled(true); await browser.get('/'); + browser.waitForAngularEnabled(false); signInPage = await navBarPage.getSignInPage(); await signInPage.autoSignInUsing(username, password); + await browser.sleep(2000); + const expect2 = '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'); @@ -46,12 +53,14 @@ describe('account', () => { it('should be able to update settings', async () => { await navBarPage.clickOnAccountMenu(); settingsPage = await navBarPage.getSettingsPage(); + await browser.sleep(2000); const expect1 = 'settings.title'; const value1 = await settingsPage.getTitle(); expect(value1).to.eq(expect1); await settingsPage.save(); await browser.sleep(500); + await browser.sleep(2000); const expect2 = 'settings.messages.success'; const alert = element(by.css('.alert-success')); const value2 = await alert.getAttribute('jhiTranslate'); @@ -60,6 +69,7 @@ describe('account', () => { it('should fail to update password when using incorrect current password', async () => { passwordPage = await navBarPage.getPasswordPage(); + await browser.sleep(2000); expect(await passwordPage.getTitle()).to.eq('password.title'); @@ -67,6 +77,7 @@ describe('account', () => { await passwordPage.setPassword('new_password'); await passwordPage.setConfirmPassword('new_password'); await passwordPage.save(); + await browser.sleep(2000); const expect2 = 'password.messages.error'; const alert = element(by.css('.alert-danger')); @@ -77,21 +88,25 @@ describe('account', () => { it('should be able to update password', async () => { passwordPage = await navBarPage.getPasswordPage(); + await browser.sleep(2000); expect(await passwordPage.getTitle()).to.eq('password.title'); await passwordPage.setCurrentPassword(password); await passwordPage.setPassword('newpassword'); await passwordPage.setConfirmPassword('newpassword'); await passwordPage.save(); + await browser.sleep(2000); const successMsg = 'password.messages.success'; const alert = element(by.css('.alert-success')); const alertValue = await alert.getAttribute('jhiTranslate'); expect(alertValue).to.eq(successMsg); await navBarPage.autoSignOut(); + await browser.sleep(2000); signInPage = await navBarPage.getSignInPage(); await signInPage.autoSignInUsing(username, 'newpassword'); + await browser.sleep(2000); // change back to default await navBarPage.clickOnPasswordMenu(); @@ -100,6 +115,8 @@ describe('account', () => { await passwordPage.setPassword(password); await passwordPage.setConfirmPassword(password); await passwordPage.save(); + await browser.sleep(2000); + // wait for success message const alertValue2 = await alert.getAttribute('jhiTranslate'); expect(alertValue2).to.eq(successMsg); @@ -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 () => { // don't sign out and refresh page with non existing route + browser.waitForAngularEnabled(true); await browser.get('/this-is-link-to-non-existing-page'); - + browser.waitForAngularEnabled(false); // should navigate to 404 not found page const url = await browser.getCurrentUrl(); expect(url).to.endWith('404'); @@ -118,6 +136,8 @@ describe('account', () => { }); after(async () => { + browser.waitForAngularEnabled(true); await navBarPage.autoSignOut(); + browser.waitForAngularEnabled(false); }); });