Commit Graph

67 Commits

Author SHA1 Message Date
Sam Lord
4815aa6e7f
Parallelise browser tests
refs: https://github.com/TryGhost/DevOps/issues/78

Re-introduce parallel browser tests

These were adding in a previous PR, but the difference between local
running tests and using CI introduced failures.

Added additional fixes to ensure the Stripe API key is used in the CLI when running in CI.
2023-10-13 11:42:39 +00:00
Jono M
b75a6d0e7f
Revert "Updated old admin acceptance tests to E2E with AdminX" (#18604)
Reverts TryGhost/Ghost#18599

There seems to be a timezone issue with one of the tests
2023-10-13 10:16:28 +01:00
Jono M
f0efbb7fbb
Updated old admin acceptance tests to E2E with AdminX (#18599)
refs https://github.com/TryGhost/Product/issues/3831

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 5af23a9</samp>

This pull request updates and adds some test cases for the editor and
the publishing flow in Ghost. It uses a helper function to test the date
picker component in the editor, and removes a redundant test case from
the `publish-flow-test.js` file. It also adds two test cases to the
`publishing.spec.js` file, using the Playwright framework, to check the
publish time and the newsletter settings of a post.
2023-10-12 20:27:16 +01:00
Sam Lord
0e47ae03e1
Revert "Enable parallel running of browser tests" (#18594)
Reverts TryGhost/Ghost#18544
2023-10-12 14:55:39 +00:00
Sam Lord
09a77f4939 Fixed Ghost Admin browser tests
refs: https://github.com/TryGhost/DevOps/issues/78

Some tests needed to disconnect Stripe + reconnect, so the code had to be changed to match the new Stripe Connect method.

Some tests in publishing.spec have been modified to work out-of-order, which will enable us to use fullyParallel in future (a change which brings test runs down from 85~ seconds to 50~ seconds).
2023-10-12 14:33:20 +01:00
Sam Lord
a497d2ed85 Make sure page.goto is always awaited
no issue
2023-10-12 14:33:20 +01:00
Sam Lord
cb38a2d997 Enable parallel running of browser tests
refs: https://github.com/TryGhost/DevOps/issues/78

Instead of running a single instance of Ghost, we now run an instance of Ghost for each test worker.

This has the unfortunate effect that a test failing will close and restart a new instance of Ghost, but in general will be multiple times faster than sequential execution of tests.
2023-10-12 14:33:20 +01:00
Peter Zimon
e68db848dc
AdminX: reroute settings-x to settings (#18360)
refs. https://github.com/TryGhost/Product/issues/3949

---------

Co-authored-by: Jono Mingard <reason.koan@gmail.com>
Co-authored-by: Daniel Lockyer <hi@daniellockyer.com>
2023-10-09 08:12:46 +01:00
Kevin Ansfield
89a3774983 Fixed e2e-browser publishing tests
refs https://github.com/TryGhost/Ghost/pull/18422

- now that we're using the externally-loaded editor we need to wait for it to load and be ready before moving focus to it and starting to type
2023-10-04 13:20:05 +01:00
Chris Raible
f9edbc22f0
Updated browser tests to use class names from Source theme (#18459)
no issue

- After updating the default theme to be Source instead of Casper, the
browser tests broke because they depended on the class names in Casper,
which have changed
- This fixes that by updating the classes to be compatible with the
Source theme
2023-10-03 20:03:57 +00:00
Sag
4ace11a441
Added logic to load Portal when Tips & Donations are enabled (#17659)
closes https://github.com/TryGhost/Product/issues/3661

- until now, Portal was not loaded if members were disabled. With the
introduction of Tips & Donations, signed-off readers can also make
payments, using the Portal link /#/portal/support.
- now, Portal is loaded when Tips & Donations are enabled, even if
Memberships are disabled
- depending on the member signup access, the top bar / trigger button
Portal buttons are hidden as before (signup/subscribe hidden if access is set to none, subscribe hidden if
access is set to invite-only)
- for any other signup / signin Portal links (e.g., added by the theme,
or added via a Post/Page), a new popup informs the reader when
Memberships are disabled: "Memberships unavailable, contact the site
owner for access".
2023-08-10 15:45:02 +02:00
Elena Baidakova
4207c9d0d1
Added browser tests for announcement bar (#16742)
refs TryGhost/Team#3122

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 87727d9</samp>

Added `data-testid` attributes to various elements in the announcement
bar settings feature to enable Playwright testing. Fixed a potential bug
with the `visibilitySettings` getter in the `visibility.js` component.
Added Playwright tests for the announcement bar settings feature in
`announcement-bar-settings.spec.js`.
2023-05-05 14:11:26 +04:00
Chris Raible
d49241dd29
Fixing error in browser test (#16583) 2023-04-07 01:11:37 -07:00
Chris Raible
563793c7ed
Added retries for all known flaky tests (#16582)
refs TryGhost/Team#2833

- for mocha tests, we can add `this.retries(1)` to any flaky tests
- for playwright tests, we can add `test.describe.configure({ retries:
1})` to any `describe` block
- not a long-term solution, but it should help mitigate issues with flaky
tests in short term
2023-04-07 00:37:01 -07:00
Elena Baidakova
60b3731199 Separated admin and portal tests to different projects
refs TryGhost/Team#2667
- Portal tests are much more stable when running in the separate DB from admin tests.
2023-03-16 18:35:09 +04:00
Daniel Lockyer
89493893d1 Removed all unused variables from test files
- this cleans up all imports or variables that aren't currently being used
- this really helps keep the tests clean by only allowing what is needed
- I've left `should` as an exemption for now because we need to clean up
  how it is used
2023-03-10 14:29:55 +01:00
Simon Backx
62ab5073ac Fixed Playwright test not awaiting Stripe setup
no issue

The test closed the setup modal to fast, which caused the @task to be cancelled and the save would not complete (portalPlans not saved).
2023-01-31 11:26:42 +01:00
Rishabh Garg
755e031017
Fixed hidden free tier in Portal settings (#16072)
closes https://github.com/TryGhost/Team/issues/2338

If a site has the Free tier hidden from the Portal, and subsequently the Stripe connection is disconnected, this produces a dead-end state where no new members can sign up and the Free tier cannot be reactivated again in Portal settings as its hidden. This change -

- enables free tier toggle to be always shown on site irrespective of Stripe connection
2023-01-12 19:29:17 +05:30
Rishabh
28bea791dd Added playwright tests for portal links
refs https://github.com/TryGhost/Team/issues/2371
2023-01-12 13:02:41 +05:30
Elena Baidakova
1aae5ba2eb
Added e2e tests for default tier (#16103)
refs TryGhost/Team#2371
2023-01-11 15:44:34 +04:00
Elena Baidakova
a3f7188369
Added e2e tests for archive/unarchive tiers (#16101)
refs TryGhost/Team#2371
2023-01-11 13:53:07 +04:00
Elena Baidakova
9c664c8d02
Added data attributes to admin/tiers (#16095)
refs TryGhost/Team#2371
2023-01-11 11:35:55 +04:00
Rishabh
7a74ec8daa Updated playwright tests to use updated data ids
refs https://github.com/TryGhost/Team/issues/2371

- cleans up and adds comments for portal playwright tests
- updates data test attributes for portal trigger and popup selectors for consistency
- updates data attribute usage for offers
2023-01-10 13:33:12 +05:30
Simon Backx
f6e463ea43 Fixed missing awaits in publishing Playwright test
no issue
2023-01-06 14:18:54 +01:00
Rishabh
30c9dfd68d Fixed failing playwright test to remove member labels
- the test was using incorrect test state that was copied over from adding label test
- also adds guard for empty newsletters in member filters as in some cases it might not exist as found by test
2023-01-06 16:17:34 +05:30
Ronald Langeveld
e52f29231f Added Playwright test - remove labels from members
ref https://github.com/TryGhost/Team/issues/2371

- check that a fitered list of members can have a label removed from
  them at once.
2023-01-06 14:36:13 +08:00
Rishabh
f5aa07a095 🐛 Removed free trial message shown on portal for invite only sites
closes https://github.com/TryGhost/Team/issues/2361

If a free trial tier existed on site and its set to 'Invite only' in membership settings, the free trial copy still showed on portal.

- removes free trial copy from portal if site is invite only
- adds playwright test to make sure free trial copy is not shown for invite only sites
2023-01-04 17:11:55 +05:30
Kevin Ansfield
0b80a7f9eb
Fixed new tier creation browser tests (#16066)
refs https://github.com/TryGhost/Ghost/pull/16013

- ordering of tiers changed so newly added tiers are no longer always at the end of the list in Admin
2023-01-03 17:59:33 +00:00
Rishabh Garg
2eac41b1f4
🐛 Fixed invalid email getting saved for members (#16021)
refs https://github.com/TryGhost/Team/issues/2235

We found some cases which can cause a site to have member emails that have invalid characters like `member@example.com�`. This happened due to the `validator` version used by Ghost not able to catch some specific cases as invalid email, allowing members to be created with them either via Admin or Importer or direct signup. Portal UI already blocked these email as invalid. This change:

- updates `@tryghost/validator` to include a latest version of email validator that catches these invalid cases
- doesn't allow member creation with invalid email like above
- doesn't allow existing member emails to be edited to invalid
2022-12-16 16:47:52 +05:30
Kevin Ansfield
a69ffb94c1 Added playwright test for publishing posts for specific tiers
refs https://github.com/TryGhost/Team/issues/2371

- test publishes a post with access for a single tier then checks the front-end with no member, member on wrong tier, and member on right tier
2022-12-14 12:20:55 +00:00
Elena Baidakova
7ef157b17f
Improved count of items in e2e tests (#15986)
refs TryGhost/Team#2371
- We need to wait selectors before count them
https://github.com/microsoft/playwright/issues/14278

These changes needed to make the results of tests more stable on the CI
2022-12-12 16:51:31 +04:00
Rishabh
4e766e2584 Fixed broken playwright tests
refs https://github.com/TryGhost/Team/issues/2371

- playwright tests were broken due to state changes based on prev tests that were not accounted for
- in case of multiple newsletters, portal tests expected another step between stripe checkout for newsletter selection
- site settings test was disabling members, but not re-enabling it back
2022-12-12 14:50:34 +05:30
Ronald Langeveld
d62f09c588 Added filtered list labelling playwright test
ref https://github.com/TryGhost/Team/issues/2371

- Filters and then adds label to filtered members
2022-12-09 12:56:34 +07:00
Simon Backx
e7572fc111 Added Playwright test for disabled subscription access
refs https://github.com/TryGhost/Team/issues/2371

Portal should be disabled on the frontend, sending as a newsletter should no longer be an option when publishing
2022-12-08 17:58:03 +01:00
Djordje Vlaisavljevic
82aa9522dc Added playwright test for updating atier
refs TryGhost/Team#2371

- Tests that tier details can be updated
- Tests that the updates are reflected in Portal
2022-12-08 17:40:42 +01:00
Simon Backx
6af149120a Added Playwright test for invite only sites
refs https://github.com/TryGhost/Team/issues/2371

Tests if an invite only site disables sign up.
2022-12-08 17:27:30 +01:00
Simon Backx
08206f367f Removed publishing spec only test 2022-12-08 15:30:27 +01:00
Simon Backx
7c6e9c6ecf Added Playwright tests for scheduled post emails
refs https://github.com/TryGhost/Team/issues/2371

- Added some more utility methods to the Publishing spec
- Added tests for scheduled pusblish+send and send flows
2022-12-08 15:24:37 +01:00
Simon Backx
80258cd396 Added Playwright tests for publishing post with email
refs https://github.com/TryGhost/Team/issues/2371

- Adds a test for publishing and sending
- Adds a test for email only sending
- Updated some util methods in the publishing spec to remove the dependency on the post bookmark (which is not present for email only posts)
2022-12-08 14:38:12 +01:00
Sodbileg Gansukh
3d6753a54a Added create comped member test
refs https://github.com/TryGhost/Team/issues/2371

A member can be granted a comp in admin, that account should be able to access paid content.
2022-12-08 20:59:12 +08:00
Kevin Ansfield
1f22edb47c Removed errant page.pause() 2022-12-08 12:09:54 +00:00
Kevin Ansfield
4eeaca7ab8 Extracted openPostSettingsMenu and setPostVisibility test utils
refs https://github.com/TryGhost/Team/issues/2371

- extracting the re-used actions to utils allows tests to be self-descriptive rather than relying on comments and keeps the selectors and related actions in one place to help refactoring if/when they change
2022-12-08 12:02:22 +00:00
Kevin Ansfield
9d434b8105 Removed errant page.pause() 2022-12-08 11:27:47 +00:00
Kevin Ansfield
df72182e2d
Further attempt to fix update-published-post test in CI (#15964)
refs https://github.com/TryGhost/Team/issues/2371

- bumped timeout between saving and refreshing to account for slower
speeds in CI
- increased specificity for the frontend text comparisons so the output
when failing is smaller and easier to parse
2022-12-08 10:36:33 +00:00
Simon Backx
641364876c Added Playwright test to unschedule a post
refs https://github.com/TryGhost/Team/issues/2371

- Schedule and unschedule a post
- Also includes some extra status checks
2022-12-08 11:13:54 +01:00
Kevin Ansfield
7371addbc5 Another attempt to fix update-published-post test in CI
refs https://github.com/TryGhost/Team/issues/2371

- the 100ms timeout was enough for local tests to pass but was still failing on CI
- bumped to 200ms and skipped the creation of a new paragraph to reduce what the editor is doing
2022-12-08 09:59:20 +00:00
Kevin Ansfield
8ddf1f0215 Fixed update-published-post Playwright test
refs https://github.com/TryGhost/Team/issues/2371

- added timeout between clicking the editor and starting to type otherwise some of the typing events could be missed causing a mismatch in actual vs expected output
2022-12-08 09:39:05 +00:00
Ronald Langeveld
3e62764a64 Added csv validation, members export Playwright test
ref https://github.com/TryGhost/Team/issues/2371

- updated Member exports with csv validation
- added member fixtures to be loaded into Ghost to ensure filtering
  works correctly when downloading / exporting members csv.
2022-12-08 16:33:27 +07:00
Simon Backx
c1fc0d8888 Added Playwright test to schedule a Page
refs https://github.com/TryGhost/Team/issues/2371

Schedule a page and check if it is only published at the scheduled time.
2022-12-08 10:25:30 +01:00
Simon Backx
0dbc10a41a Added Playwright test for publishing a page
refs https://github.com/TryGhost/Team/issues/2371

Publish a page and verify that the page is published.
2022-12-08 10:24:35 +01:00