From e47511def61b35bd2e6f769db5985eb2998d67c4 Mon Sep 17 00:00:00 2001 From: Noel Light-Hilary Date: Fri, 10 Jan 2025 17:07:07 +0000 Subject: [PATCH] =?UTF-8?q?DON-998=20=E2=80=93=20standalone=20login=20page?= =?UTF-8?q?:=20skip=20captcha=20in=20Regression=20to=20allow=20automated?= =?UTF-8?q?=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/login/login.component.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 9add5612d..acf9930d9 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -112,18 +112,23 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{ this.pageInitialised = true; } - private friendlyCaptchaWiget: WidgetInstance; + private friendlyCaptchaWidget: WidgetInstance; async ngAfterViewInit() { if (! isPlatformBrowser(this.platformId)) { return } + if (environment.environmentId === 'regression') { + this.captchaCode = 'dummy-captcha-code'; + return; + } + if (! this.friendlyCaptcha) { return; } - this.friendlyCaptchaWiget = new WidgetInstance(this.friendlyCaptcha.nativeElement, { + this.friendlyCaptchaWidget = new WidgetInstance(this.friendlyCaptcha.nativeElement, { doneCallback: (solution) => { this.captchaCode = solution; }, @@ -133,7 +138,7 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{ }, }); - await this.friendlyCaptchaWiget.start() + await this.friendlyCaptchaWidget.start() } @@ -183,8 +188,8 @@ export class LoginComponent implements OnInit, AfterViewInit, OnDestroy{ this.loggingIn = false; this.captchaCode = undefined; - this.friendlyCaptchaWiget.reset(); - await this.friendlyCaptchaWiget.start(); + this.friendlyCaptchaWidget.reset(); + await this.friendlyCaptchaWidget.start(); } }); this.loggingIn = true;