a10b13916a
ref https://linear.app/tryghost/issue/ENG-845/error-attempted-to-set-lexical-on-the-deleted-record ref [https://linear.app/tryghost/issue/ENG-854/🐛-deleting-imported-posts-makes-ghost-unresponsive](https://linear.app/tryghost/issue/ENG-854/%F0%9F%90%9B-deleting-imported-posts-makes-ghost-unresponsive) - When deleting a post in the editor's Post Settings Menu, if the post has unsaved changes (indicated by the hasDirtyAttributes property in the editor), Admin will crash because it tries to save a post revision before leaving the editor, but the post has already been deleted so saving fails. - This can occur when editing a post and quickly deleting it from the Post Settings Menu before saving is completed. - It can also occur when attempting to delete an imported post, as the editor will parse the lexical from the server and may make some minor, invisible-to-the-user changes to the lexical string locally (e.g. JSON formatting, or updating the JSON to use extended version of base lexical nodes), which triggers the same error. - This fix bypasses the attempt to save a post revision when leaving the editor if the post is already deleted, which allows the transition back to the Posts route to succeed. |
||
---|---|---|
.. | ||
admin | ||
fixtures | ||
portal | ||
utils | ||
README.md |
Browser testing
Install
As per the docs, run the following to install the supported browsers for Playwright:
npx playwright install
Running tests
Run the browser test suite with yarn test:browser
.
Record test instructions
After installing PlayWright, start to record tests using yarn test:browser:record
.
Available flags:
--admin
- Runs a test starting in Ghost Admin--no-setup
- When testing Ghost Admin, prevents the automated setup from running (for testing the setup wizard)--fixtures="posts,users"
- Install a set of fixtures, given as a comma-delimited list
When the window loads, hit the record button and click around. All of the link click steps will need to be tidied up to use better selectors, and any page.goto
calls should be dropped (as they are likely a result of clicking links). The test generator is a useful assistant, but be wary of taking anything it generates as correct.
Writing tests
Recording tests will allow you to execute the steps in a browser that a user would follow. It's important to add assertions to ensure that we're not just testing that the site doesn't crash, but that we see the expected values on the page.
The test suite uses beforeAll
and afterAll
to setup Ghost and install fixtures. Each set of fixtures should have a new describe
block to start a new instance of Ghost to be tested against.