From b1398acdc833f5fd8cb4297e3d6842cec762f0f7 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 4 Dec 2024 09:59:24 +0000 Subject: [PATCH] Initial stab at JS smoke test for use (#2935) * Initial JS smoke test for use * Update AccountContext.php * Change wording of gerkin scenario --------- Co-authored-by: Adam Cooper --- service-front/web/src/index.js | 6 +++++- tests/features/actor-login.feature | 1 + tests/smoke/context/AccountContext.php | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/service-front/web/src/index.js b/service-front/web/src/index.js index a0ffcb2c21..72f98ed91b 100644 --- a/service-front/web/src/index.js +++ b/service-front/web/src/index.js @@ -42,4 +42,8 @@ if ( document.getElementById('dialog') !== null ) { new sessionDialog(document.getElementById('dialog')); -} \ No newline at end of file +} + +//used by smoke test + +window.useAnLPALoaded = true; \ No newline at end of file diff --git a/tests/features/actor-login.feature b/tests/features/actor-login.feature index ea55ee8a24..e415e352f8 100644 --- a/tests/features/actor-login.feature +++ b/tests/features/actor-login.feature @@ -13,3 +13,4 @@ Feature: A user of the system is able to login Given I access the login form When I enter correct credentials Then I am signed in + And the javascript is working diff --git a/tests/smoke/context/AccountContext.php b/tests/smoke/context/AccountContext.php index 8af75f0d71..000ec6492c 100644 --- a/tests/smoke/context/AccountContext.php +++ b/tests/smoke/context/AccountContext.php @@ -144,4 +144,18 @@ public function iAmSignedIn(): void $this->ui->assertElementOnPage('nav.signin'); } } + + /** + * @Then the javascript is working + */ + + public function scriptsWork(): void + { + if(!$this->ui->getSession()->evaluateScript("return window.useAnLPALoaded")){ + throw new ExpectationException( + 'Javascript did not parse without errors', + $this->ui->getMink()->getSession()->getDriver() + ); + } + } }