Commit Graph

58 Commits

Author SHA1 Message Date
Ronald Langeveld
61bf3ea57e
Fixed browser tests for unsaved changes (#20717)
no issue

- takes into account that there is an additional editor in the DOM -
which there is now.
2024-08-05 21:40:18 +07:00
Daniel Lockyer
60f37ed118 Fixed browser tests
refs 6378d7d66f

- the buttons have been renamed and split apart into separate ones
2024-07-01 14:49:20 +02:00
Kevin Ansfield
5c05ebe6cb
Fixed browser tests broken by onboarding changes (#19998)
ref 78311591d0

- 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
2024-04-08 15:15:04 +01:00
Steve Larson
78d2a5e3c0
🐛 Fixed flaky browser tests (#19929)
ref https://linear.app/tryghost/issue/CFR-13
- enabled saving traces on browser test failure; this makes troubleshooting a lot easier
- updated handling in offers tests to ensure the tier has fully loaded in the UI (not just `networkidle`)
- updated publishing test to examine the publish button reaction to the save action response instead of a 300ms pause

In general, our tests use a lot of watching for 'networkidle' - and sometimes just raw timeouts - which do not scale well into running tests on CI. In particular, 'networkidle' does not work if we're expecting to see React components' state updates propagate and re-render. We should always instead look to the content which encapsulates the response and the UI updates. This is something we should tackle on a larger scale.
2024-03-27 13:57:53 -05:00
Sag
59bbade630
Fixed browser tests (#19852)
no issue

- browser tests were failing due to the renaming of a button
2024-03-13 12:54:19 +01:00
Steve Larson
02edc5ad4f
Updated browser tests to be less flaky (#19701)
no refs

- Offers browser tests were subject to a race condition. I'm guessing
this dates back to when we moved to Settings X (and React), as it seems
the url for the offer is not present on the first render of the page -
despite being returned in the `POST` request of the offer creation, the
component does a `GET` on render to get the link. This is now awaited.
- The Publishing timezone test also seemed to suffer from a race
condition. This is less sure of a fix as it's a much less frequent
failure. The date time picker input is now validated in the test before
continuing.
- Offers browser tests often timed out so the timeout has been moved to
90s for these tests.
- All tests were bumped to 75s timeout as we generally would
occasionally hit the timeout.
2024-02-21 17:47:44 +00:00
Steve Larson
1ed34aebac
Added check for Stripe Pass in Stripe Connect test utils (#19633)
refs https://linear.app/tryghost/issue/ENG-599
- Portal tests occasionally failed without clear cause on CI, possibly
due to GH runner region
- Portal tests never successfully ran locally for US-based IPs because
of a required prompt for Stripe Pass
2024-01-31 11:52:09 -06:00
Ronald Langeveld
b490534983
Fixed flaky portal tests (#19596)
no issue
2024-01-28 23:04:39 +04:00
Ronald Langeveld
0c95111f8e
🎨 Admin X - Offers (#19520)
no issue

- Offers rebuilt in React and now located in Settings.
2024-01-25 12:41:54 +00:00
Daniel Lockyer
57c5f92770 Reverted "🎨 Added Offers to the new Settings (#19493)"
This reverts commit c7d7b883cc.
2024-01-18 15:04:59 +01:00
Ronald Langeveld
c7d7b883cc
🎨 Added Offers to the new Settings (#19493)
no issue

- Removes flags for the new Offers in Admin X (Settings)
- Removes old Offers from the sidebar.
- See a new version of Offers in Settings. 🎨
2024-01-18 12:56:08 +00:00
Jono M
e8e0d84d50
Deleted old Ember settings pages (#18740)
refs https://github.com/TryGhost/Product/issues/4055

---

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

Removed unused components related to announcement settings, custom theme
settings, and file upload. These components were part of a deprecated
feature or a legacy UI.
2023-11-06 06:46:31 +00:00
Sam Lord
7f67e98e28 Memoized the getStripeAccountId function
no issue

Some flaky tests found, and it seems as though they're being caused by an invalid Stripe account id.

It's possible that by re-using the worker after a test which calls `setupStripe` could cause some Stripe functionality to not work.
2023-10-16 22:14:10 +01:00
Daniel Lockyer
3a564237a5 Temporarily increased timeout for saving Offer in tests
- if Stripe is slow, this might take longer than we expect to finish
- this helps prevent flaky tests in CI
2023-10-16 17:37:42 +02:00
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
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
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
Simon Backx
13b732f905
Added Playwright tests for donations (#17699)
fixes https://github.com/TryGhost/Product/issues/3723

This also fixes usage of localhost instead of 127.0.0.1 as a test URL
for playwright. This caused issues for cookies because the member
impersonation navigated to 127.0.0.1 instead of localhost, meaning that
the next page.goto call would go to localhost and lose the cookies.
2023-08-15 15:20:18 +02:00
Fabien "egg" O'Carroll
c5dc5a2675 Fixed @tryghost/mailgun-client import
We were incorrectly specifying the path of the file rather than relying on the
package exports, and this broke in the previous commit to a file rename. It
wasn't caught by CI because the browser tests are not run on pull requests
2023-05-09 13:00:18 -04:00
Sam Lord
3718d4acda Enable labs in playwright tests
no issue

Allows us to write tests for features which are still in development.
2023-03-22 11:16:49 +00: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
Elena Baidakova
6f9f83bee8 Revert "Removed explicit timeout for offer creation helper"
This reverts commit ac427e4253.
2023-03-10 13:44:45 +04:00
Elena Baidakova
ac427e4253 Removed explicit timeout for offer creation helper
refs TryGhost/Team#2667
- Removed timeout to make it the same as a global one
2023-03-10 13:24:38 +04:00
Elena Baidakova
00cda68125
Disabled fraud detection for e2e browser tests (#16379)
refs TryGhost/Team#2667
2023-03-08 16:01:08 +04:00
Simon Backx
3d89dbb775 Fixed whistelisted domains in Playwright tests and network connectivity
no issue

- Nock doesn't support multiple calls to enableNetConnect -> only the last one counts. This fixes that issue.
- Some tests interacted directly with nock instead of using the mockManager to restore everything.
2023-03-08 12:40:21 +01:00
Simon Backx
df9df4be80 Allowed Stripe network access in Playwright tests
no issue

Previous test change that blocks network access broke the Playwright tests, that need to access the Stripe checkout page.
2023-03-08 11:49:36 +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
Simon Backx
aea127b17f Fixed Playwright tests for new Stripe connect flow
no issue
2023-01-30 17:09:09 +01:00
Simon Backx
3ac282598c Fixed Playwright tests for new email flow
no issue

Tests stopped working because the Mailgun mocker stopped working since we moved to the new email flow.

This also fixes a unit test that needed to get updated.
2023-01-20 19:00:13 +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
Elena Baidakova
1aae5ba2eb
Added e2e tests for default tier (#16103)
refs TryGhost/Team#2371
2023-01-11 15:44:34 +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
628b80778f Updated create tier playwright util for all archived tiers
refs https://github.com/TryGhost/Team/issues/2371

- in case all tiers are archived before new tier is created, the add tier section can be collapsed and will need to be opened first before going through add tier flow
2023-01-10 09:34:21 +05:30
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
Rishabh
25c530293f Added playwright tests for forever and multiple month offers
- adds test that cover creating and signing up to multiple-month/forever offers
- checks that the offer information is shown to members during signup and in account detail
2022-12-14 17:13:20 +05:30
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
Rishabh
f5aae1e2c5 Updated playwright tests for portal member upgrade
refs https://github.com/TryGhost/Team/issues/2371

- updated setup to ensure single tier for testing single tier flows
- updated portal test to use utils and new data test ids
2022-12-08 21:09:19 +05:30
Sam Lord
3449c49c10 Tidy up the mocking utility for Mailgun
no issue
Moved the mocking into the Playwright specific codebase, since this will only be used in browser based testing
2022-12-08 13:01:35 +00:00
Sam Lord
249802d62b Added mailgun mock to allow publishing workflow to run
no issue
2022-12-08 13:01:35 +00:00
Naz
4c6a86eca4 Added mocked Mailgun client to browser test env
refs https://github.com/TryGhost/Ghost/pull/15959

- To be able to test and intercept emails we need a mock in test environment - avoids making calls to the Mailgun API
2022-12-08 13:01:35 +00:00
Kevin Ansfield
88c8bf7dbc Added compedPlan option to createMember test util
refs https://github.com/TryGhost/Team/issues/2371

Usage:

```
await createTier(page, {name: 'Silver', monthlyPrice: 5, yearlyPrice: 50});
await createMember(page, {email: 'silver@example.com', compedPlan: 'Silver'});
```
2022-12-08 12:17:31 +00:00
Rishabh Garg
b6db85a5d6
Added playwright test for free member upgrade via portal (#15961)
refs https://github.com/TryGhost/Team/issues/2371

- tests that a free member can upgrade to a paid tier via stripe checkout and the payment details are reflected in portal and member detail page on admin
2022-12-07 21:41:55 +05:30
Hannah Wolfe
205664f75f
Updated Playwright createTier util to be repeatable
- we have to close the premium tier list after creating a tier, else we can't create another one
2022-12-07 14:32:26 +00:00
Sam Lord
d6072ea0e8 Record tests using same setup as the test runner
no issue
2022-12-07 10:59:45 +00:00
Daniel Lockyer
d64d8c0ddd
Added Playwright test for creating and using a free-trial Offer
refs https://www.notion.so/ghost/Critical-Paths-980dd089c3e74a6fbc619271f5a9ce42

- this test will create a free-trial Offer and go through Stripe
  checkout, ensuring the member is created as paid
- also changes some utils to support creating the free-trial offer vs
  just a discounted Offer
2022-12-07 11:29:05 +07:00
Daniel Lockyer
41e1f0b568
Removed workaround for Members modal bug
refs 3817f583fa

- this should no longer be needed because the underlying bug was fixed
  and the modal should no longer show
2022-12-07 10:51:44 +07:00
Daniel Lockyer
570b697b4a
Fixed double slashes in Stripe webhook URL
- `getSiteUrl` already returns a trailing slash so we shouldn't add
  another one in the path
2022-12-07 10:18:21 +07:00