From 8a8b139a8f3bd69e178eaba12e58ce66bf93daf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20K=C3=B6hler?= Date: Fri, 8 Nov 2024 12:48:22 +0100 Subject: [PATCH 1/3] fix ckeck, improve error report fo then Website --- backend/features/step_definitions/stepdefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/features/step_definitions/stepdefs.js b/backend/features/step_definitions/stepdefs.js index df2615372..f7af1f402 100644 --- a/backend/features/step_definitions/stepdefs.js +++ b/backend/features/step_definitions/stepdefs.js @@ -622,7 +622,7 @@ Then('So I will be navigated to the website: {string}', async function checkUrl( const world = this; try { await driver.getCurrentUrl().then(async (currentUrl) => { - expect(currentUrl).to.equal(url, 'Error'); + expect(currentUrl == url , 'ERROR expected: ' + url + '; actual: ' + currentUrl).to.be.true }); } catch (e) { await driver.takeScreenshot().then(async (buffer) => { From c4b2f78f25fd1ce4544dd71ddc437bf3428cb8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20K=C3=B6hler?= Date: Thu, 14 Nov 2024 16:51:34 +0100 Subject: [PATCH 2/3] trim and ignore trailing '/' --- backend/features/step_definitions/stepdefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/features/step_definitions/stepdefs.js b/backend/features/step_definitions/stepdefs.js index f7af1f402..9d90b647e 100644 --- a/backend/features/step_definitions/stepdefs.js +++ b/backend/features/step_definitions/stepdefs.js @@ -622,7 +622,7 @@ Then('So I will be navigated to the website: {string}', async function checkUrl( const world = this; try { await driver.getCurrentUrl().then(async (currentUrl) => { - expect(currentUrl == url , 'ERROR expected: ' + url + '; actual: ' + currentUrl).to.be.true + expect(currentUrl.replace(/\/$/, '') == url.trim().replace(/\/$/, '') , 'ERROR expected: ' + url.trim() + '; actual: ' + currentUrl).to.be.true }); } catch (e) { await driver.takeScreenshot().then(async (buffer) => { From 7e0bfa54f40a880d0bb4cc810238590950cc5ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20K=C3=B6hler?= Date: Thu, 14 Nov 2024 17:03:34 +0100 Subject: [PATCH 3/3] simplify, use just regex --- backend/features/step_definitions/stepdefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/features/step_definitions/stepdefs.js b/backend/features/step_definitions/stepdefs.js index 9d90b647e..c34f9e96e 100644 --- a/backend/features/step_definitions/stepdefs.js +++ b/backend/features/step_definitions/stepdefs.js @@ -622,7 +622,7 @@ Then('So I will be navigated to the website: {string}', async function checkUrl( const world = this; try { await driver.getCurrentUrl().then(async (currentUrl) => { - expect(currentUrl.replace(/\/$/, '') == url.trim().replace(/\/$/, '') , 'ERROR expected: ' + url.trim() + '; actual: ' + currentUrl).to.be.true + expect(currentUrl.replace(/\/$/g, '') == url.replace(/[\s]|\/\s*$/g, '') , 'ERROR expected: ' + url.replace(/[\s]|\/\s*$/g, '') + '; actual: ' + currentUrl.replace(/\/$/g, '')).to.be.true }); } catch (e) { await driver.takeScreenshot().then(async (buffer) => {