mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve login
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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' }),
|
||||
|
||||
Reference in New Issue
Block a user