Improve login

This commit is contained in:
Peter Maquiran
2021-07-18 14:21:56 +01:00
parent dba721ec50
commit c2e7ea799e
2 changed files with 20 additions and 5 deletions
+5 -3
View File
@@ -26,7 +26,6 @@ export class LoginPage implements OnInit {
hasSession = false
setPin = false
constructor(
private notificatinsservice: NotificationsService,
private router: Router,
@@ -208,9 +207,12 @@ export class LoginPage implements OnInit {
localStorage.setItem('PIN', encrypted)
// this.router.navigate(['/home/events']);
//
if(window['cy']) {
this.router.navigate(['/home/events']);
} else {
window.location.pathname = '/home/events'
}
}
+13
View File
@@ -1,6 +1,16 @@
import { environment } from './../src/environments/environment'
const windowSet = (page, name, value) => {
page.evaluateOnNewDocument(`
Object.defineProperty(window, '${name}', {
get() {
return '${value}'
}
})
`)
}
export const loginTest = async (page) => {
await page.setViewport({width: 1200, height: 720});
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
@@ -21,6 +31,9 @@ export const loginTest = async (page) => {
await page.type('input[type="text"]', environment.defaultuser);
await page.type('input[type="password"]', environment.defaultuserpwd);
// click and wait for navigation
windowSet(page, 'cy', true)
await Promise.all([
page.click('.btn-ok'),
// page.waitForNavigation({ waitUntil: 'networkidle0' }),