From 960e91c8e545f3fdd484002aa85f14216d142445 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Corvo Date: Thu, 14 Oct 2021 10:35:28 -0700 Subject: [PATCH] Change the way we check we are in targets section. Now we check the url rather than the h2 title --- ui/desktop/tests/end2end/authentication.spec.js | 11 ++++++----- ui/desktop/tests/end2end/targets.spec.js | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ui/desktop/tests/end2end/authentication.spec.js b/ui/desktop/tests/end2end/authentication.spec.js index 553a4b5cd..9986b0773 100644 --- a/ui/desktop/tests/end2end/authentication.spec.js +++ b/ui/desktop/tests/end2end/authentication.spec.js @@ -10,7 +10,7 @@ const generateScreenshotPath = (fileName) => { return path.join(screenshotPath, fileName).concat(screenshotFormat); }; -// Todo: move this function to a test helpers file so it could be used by other tests. +// TODO: move this function to a test helpers file so it could be used by other tests. // Returns the executable path for the Boundary binary the test suite will run. const returnExecutablePath = (platform, arch) => { try { @@ -91,11 +91,12 @@ test.describe('Authentication end to end test suite', async () => { await boundaryWindow.$eval('button[type="submit"]', (element) => element.click() ); + // Check we are in Targets - await boundaryWindow.waitForSelector('h2 >> text=Targets'); - expect(await boundaryWindow.innerText('h2 >> text=Targets')).toEqual( - 'Targets ' - ); + await boundaryWindow.waitForURL('**/#/scopes/global/projects/targets'); + const windowUrl = new URL(await boundaryWindow.url()); + expect(windowUrl.hash).toEqual('#/scopes/global/projects/targets'); + // Take screenshot await boundaryWindow.screenshot({ path: generateScreenshotPath('afterLogin'), diff --git a/ui/desktop/tests/end2end/targets.spec.js b/ui/desktop/tests/end2end/targets.spec.js index 340a94d33..56411e15c 100644 --- a/ui/desktop/tests/end2end/targets.spec.js +++ b/ui/desktop/tests/end2end/targets.spec.js @@ -58,11 +58,11 @@ test.describe('Targets end to end test suite', async () => { await boundaryWindow.$eval('button[type="submit"]', (element) => element.click() ); + // Check we are in Targets - await boundaryWindow.waitForSelector('h2 >> text=Targets'); - expect(await boundaryWindow.innerText('h2 >> text=Targets')).toEqual( - 'Targets ' - ); + await boundaryWindow.waitForURL('**/#/scopes/global/projects/targets'); + const windowUrl = new URL(await boundaryWindow.url()); + expect(windowUrl.hash).toEqual('#/scopes/global/projects/targets'); // Click connect to a target await boundaryWindow.waitForSelector('table.rose-table');