diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c3773e897894143f8723ae2942de1196148e818..77fbfce07b64fe3c5e12cd43cd3083035a4fae81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -104,7 +104,7 @@ frontend-test: e2e-test: services: - selenium/standalone-chrome - image: ubuntu:20.04 + image: node stage: e2e cache: {} dependencies: diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 4e081a2875610cab9590bec37ca25586d412a048..c783853938b3225cde6bc0fc529fff56e95ee1e9 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -113,15 +113,17 @@ </noscript> <script type="text/javascript"> // show an error message if the app loading takes more than 4 sec - window.onload = function () { - setTimeout(showError, 4000); - }; - function showError() { - var errorElm = document.getElementById('jhipster-error'); - if (errorElm && errorElm.style) { - errorElm.style.display = 'block'; + this.ngZone.runOutsideAngular(() => { + window.onload = function () { + setTimeout(showError, 4000); + }; + function showError() { + var errorElm = document.getElementById('jhipster-error'); + if (errorElm && errorElm.style) { + errorElm.style.display = 'block'; + } } - } + }); </script> </body> </html> diff --git a/src/test/javascript/e2e/account/account.spec.ts b/src/test/javascript/e2e/account/account.spec.ts index f5999a085bd4011ba137c36aebf3e46f81c5ef34..fcaf8536270d633d6d5de3b805b891f3ace99d8e 100644 --- a/src/test/javascript/e2e/account/account.spec.ts +++ b/src/test/javascript/e2e/account/account.spec.ts @@ -13,9 +13,7 @@ describe('account', () => { let settingsPage: SettingsPage; before(async () => { - browser.waitForAngularEnabled(true); await browser.get('/'); - browser.waitForAngularEnabled(false); await browser.sleep(2000); // browser.ignoreSynchronization = true; @@ -25,24 +23,18 @@ describe('account', () => { it('should fail to login with bad password', async () => { 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')))); @@ -53,14 +45,12 @@ 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'); @@ -69,15 +59,13 @@ 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'); await passwordPage.setCurrentPassword('wrong_current_password'); await passwordPage.setPassword('new_password'); await passwordPage.setConfirmPassword('new_password'); await passwordPage.save(); - await browser.sleep(2000); + await browser.sleep(1000); const expect2 = 'password.messages.error'; const alert = element(by.css('.alert-danger')); @@ -88,25 +76,22 @@ 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); + await browser.sleep(1000); 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(); @@ -115,7 +100,7 @@ describe('account', () => { await passwordPage.setPassword(password); await passwordPage.setConfirmPassword(password); await passwordPage.save(); - await browser.sleep(2000); + await browser.sleep(1000); // wait for success message const alertValue2 = await alert.getAttribute('jhiTranslate'); @@ -124,9 +109,7 @@ 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'); @@ -136,8 +119,6 @@ describe('account', () => { }); after(async () => { - browser.waitForAngularEnabled(true); await navBarPage.autoSignOut(); - browser.waitForAngularEnabled(false); }); });