Skip to content

Commit

Permalink
Fixed browser tests broken by onboarding changes (#19998)
Browse files Browse the repository at this point in the history
ref 7831159

- 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
  • Loading branch information
kevinansfield committed Apr 8, 2024
1 parent 7831159 commit 5c05ebe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ghost/admin/app/controllers/setup.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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'});
}
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/test/e2e-browser/utils/e2e-browser-utils.js
Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 5c05ebe

Please sign in to comment.