From 5c05ebe6cb69e2b62c2b6774fb8b3b28da5051b9 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 8 Apr 2024 15:15:04 +0100 Subject: [PATCH] Fixed browser tests broken by onboarding changes (#19998) ref https://github.com/TryGhost/Ghost/commit/78311591d0947d3510b5c8584be39b1777a0bb60 - updated tests to not click a button on the setup/done screen that is no longer shown - fixed setup flow showing an alert bar due to not handling the `TransitionAborted` error that is thrown by the setup/done->dashboard redirect --- ghost/admin/app/controllers/setup.js | 10 ++++++++++ ghost/core/test/e2e-browser/utils/e2e-browser-utils.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/controllers/setup.js b/ghost/admin/app/controllers/setup.js index ec5386b8a5f1..7a63fe71a855 100644 --- a/ghost/admin/app/controllers/setup.js +++ b/ghost/admin/app/controllers/setup.js @@ -61,6 +61,11 @@ export default class SetupController extends Controller.extend(ValidationEngine) return true; } catch (error) { + // handle setup/done route redirecting to dashboard + if (error.message === 'TransitionAborted') { + return true; + } + if (error && error.payload && error.payload.errors) { if (isVersionMismatchError(error)) { return this.notifications.showAPIError(error); @@ -141,6 +146,11 @@ export default class SetupController extends Controller.extend(ValidationEngine) let [apiError] = error.payload.errors; this.set('flowErrors', [apiError.message, apiError.context].join(' ')); } else { + // ignore setup/done route redirecting to dashboard + if (error.message === 'TransitionAborted') { + return true; + } + // Connection errors don't return proper status message, only req.body this.notifications.showAlert('There was a problem on the server.', {type: 'error', key: 'setup.authenticate.failed'}); } diff --git a/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js b/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js index 2a59b842b381..ab3fa2d81266 100644 --- a/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js +++ b/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js @@ -60,7 +60,7 @@ const setupGhost = async (page) => { await page.getByPlaceholder('At least 10 characters').fill(ownerUser.password); await page.getByPlaceholder('At least 10 characters').press('Enter'); - await page.locator('.gh-done-pink').click(); + await page.locator('.gh-nav').waitFor(options); } };