From 5fa241c4fefa01531fc4da77403cb44c56af7843 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio@bekerle.com> Date: Wed, 3 Feb 2021 13:18:50 +0100 Subject: [PATCH] Inject window.DBPAuth variable for cypress --- packages/auth/src/auth-keycloak.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/auth/src/auth-keycloak.js b/packages/auth/src/auth-keycloak.js index cb8cedf9..fd4ddfea 100644 --- a/packages/auth/src/auth-keycloak.js +++ b/packages/auth/src/auth-keycloak.js @@ -112,13 +112,20 @@ export class AuthKeycloak extends AdapterLitElement { } sendSetPropertyEvents() { - this.sendSetPropertyEvent('auth', { + const auth = { 'subject': this.subject, 'token': this.token, 'user-full-name': this.name, 'person-id': this.personId, 'person': this.person, - }); + }; + + // inject a window.DBPAuth variable for cypress + if (window.Cypress) { + window.DBPAuth = auth; + } + + this.sendSetPropertyEvent('auth', auth); // this.sendSetPropertyEvent('auth-subject', this.subject); // this.sendSetPropertyEvent('auth-token', this.token); -- GitLab