Commit Graph

32310 Commits

Author SHA1 Message Date
Naz
6ef5e6a7e0 Fixed local environment for playwright tests
refs https://github.com/TryGhost/Toolbox/issues/479

- this includes a handful of improvements to get Playwright working on a
  local environment including:
  - adding `testing-browser` environment so we don't nuke `development`
    environments, and makes all the necessary changes to get Ghost to
    behave when this is running
  - stopped running one global instance of Ghost as this doesn't provide
    a clean environment
  - copies a few default fixtures that are needed for the new
    environment
2022-12-07 09:44:05 +07:00
Ronald Langeveld
a302e8289f
Added Unsplash API config to Lexical (#15948)
no issue

- added default headers and app_id for React-Koenig-Lexical to consume.
2022-12-07 09:20:11 +07:00
Kevin Ansfield
1f06407878 Fixed "Cannot destructure property 'ratio'" errors
sentry ADMIN-C05

- resizing the window (or changing orientation) when viewing a single photo inside the Unsplash image selector was throwing errors because the event handler `setZoomedSize()` call was not passed the same arguments as the typical call made in `modify()`
- moved the `element` and `ratio` properties onto the class so they are preserved and ready to be used without being explicitly passed in when `setZoomedSize()` is called as part of an event
2022-12-06 17:23:38 +00:00
Kevin Ansfield
65de55ae89
Fixed unnecessary identity requests and 403s for non-Owner accounts (#15949)
no issue

`<GhBillingIframe>` generates a request to the `/identities/` endpoint every time Admin is accessed for all users, however that endpoint is only accessible to users with the Owner role meaning we have a lot of unnecessary 403 errors in event logs and the developer console.

- added early exit when we know the logged in user doesn't have the Owner role
- removed the subscription fetching code that wasn't reachable (`token` was always `undefined`)
  - the BMA sends subscription data as soon as it's available so the extra fetch isn't necessary
2022-12-06 15:20:57 +00:00
Daniel Lockyer
d04abc90b4
Added test group names
- this helps differentiate between the different tests we have available
2022-12-06 19:18:16 +07:00
Daniel Lockyer
97e5ca1de6
Extracted Playwright tests into separate files
- we should start to keep tests grouped by their area, so first we split
  by Admin tests and then Portal tests, and within that we split into
  setup/Tiers/Offers etc
2022-12-06 19:08:09 +07:00
Kevin Ansfield
b68686fe9c Fixed 403 newsletters request for contributors when opening editor
closes https://github.com/TryGhost/Team/issues/2242

Contributors don't have permission to fetch `/newsletters/` but the publish flow was sending a request every time a contributor opened a post in the editor creating noise in event logs and in the developer console.

- disabled the newsletters fetch when the logged in user is a contributor
- contributors can't publish so the "missing" data has no effect on the publish flow as it's not used
2022-12-06 11:18:29 +00:00
Simon Backx
58ba154ed7 🐛 Hid the analtyics page for editors
fixes https://github.com/TryGhost/Team/issues/2302

The analytics page should not be visible for Editors (and doesn't work currently anyway). This commit removes the button that goes to the analytics page for editors and authors.
2022-12-06 11:10:58 +01:00
Elena Baidakova
62681037f0
Added email_suppression property to response for PUT api/member method (#15946)
closes TryGhost/Team#2359
- Keep the same response structure for `api/member` GET and PUT methods
2022-12-06 13:51:26 +04:00
Naz
0ab652b768
Fixed playwright port
refs https://github.com/TryGhost/Toolbox/issues/479

- e2e and integration test suites are running on port 2369. Playwright was not following this convention, without good reason.
- Port 2368 is the default port for development and production processes, so using it for test environment is not ideal
2022-12-06 16:14:37 +07:00
Daniel Lockyer
f8dbda4629
Disabled browser tests on pull requests
- these tests shouldn't be running on pull requests yet as they don't
  have access to the environment secrets they currently require
2022-12-06 15:49:23 +07:00
Daniel Lockyer
8812ed6116
Revert "Lock file maintenance"
- this reverts commit 5187fc40ad as we
  seem to be getting failing tests now
2022-12-06 13:37:24 +07:00
Ghost CI
54b693a359 Merged v5.25.1 into main 2022-12-06 05:14:41 +00:00
Ghost CI
55b0f564ba v5.25.1 2022-12-06 05:14:37 +00:00
Simon Backx
c47891c3f6
🐛 Fixed setting delivered_at to null after hard bounce (#15942)
refs https://ghost.slack.com/archives/C02G9E68C/p1670075366333929?thread_ts=1669963540.980309&cid=C02G9E68C

When we receive a permanent bounce/failure, we set delivered_at to null.
But we don't want to lose this information.

Instead we should be able to handle recipients that both have failed_at
and delivered_at set.
2022-12-06 10:26:54 +05:30
renovate[bot]
5187fc40ad Lock file maintenance 2022-12-05 21:32:59 +00:00
Kevin Ansfield
1685a84a27 Fixed incorrect property access
refs 0e181c84b2

- the code is already running in the `session` service so it shouldn't access the role property via a non-existing injection
2022-12-05 17:17:47 +00:00
Kevin Ansfield
0e181c84b2 Added user role to captured Sentry data
closes https://github.com/TryGhost/Team/issues/2241

- as part of the authenticated application setup, update the captured Sentry data with the user role
- helps narrow things down when we see permission errors pop up due to requests being made for endpoints that the current user doesn't have permission to access
2022-12-05 17:15:55 +00:00
Sam Lord
fe99a000f1 Enable browser job on workflow_dispatch
refs: https://github.com/TryGhost/Toolbox/issues/481
2022-12-05 14:48:39 +00:00
Sam Lord
d3716007bf
Fixed browser-based tests running in CI
refs: https://github.com/TryGhost/Toolbox/issues/481

* Correctly setup environment variable to run both local & staging browser-based tests
* Use non-production Ghost Admin build, since production builds require HTTPS to use Stripe Connect
2022-12-05 13:39:10 +00:00
Simon Backx
bededf4520
🐛 Fixed errors of old events from deleted members (#15944)
refs https://ghost.slack.com/archives/C02G9E68C/p1670215917451249

When a member is deleted, and we receive an opened event for an email to
that member. We threw an uncaught Bookshelf EmptyResponse error.

- This change makes fetching the member not a requirement when handling
that event in the last seen at updater.
- It also adds try catches for all event listeners in the last seen at
updater
2022-12-05 14:36:23 +01:00
Elena Baidakova
5e973688bf
Added redirect to Email Preferences in Portal after resubscribing (#15940)
closes TryGhost/Team#2360
- Redirect member to Email Preferences after email removed from
suppression list.
2022-12-05 15:58:55 +04:00
Kevin Ansfield
3817f583fa 🐛 Fixed unexpected "unsaved changes" modal when deleting a member
closes https://github.com/TryGhost/Team/issues/2275

When deleting a member, after confirming deletion another "unsaved changes" modal popped up. From that point, if you clicked to stay you remained on the member screen with stale data (the member was still deleted) resulting in further errors when any attempt to make changes was made.

- prevented the unsaved changes check running for a deleted member because it would always return `true` in that case
- ensured the data setup for the unsaved changes check still occurs when a member is accessed directly via the URL
  - previously it was skipped because the data setup only occurred inside `fetchMemberTask` but that isn't called when the route already loaded the model via it's `model()` hook
2022-12-05 11:48:37 +00:00
Naz
879aad263d
Added email verification trigger test
refs https://github.com/TryGhost/Toolbox/issues/476

- The email verification trigger and host settings related bugs have been a cause of bugs in past releases.  The admin client verification source did not have any test coverage in the past.
- The members test suite size is getting out of hand. This test is quite verbose, because of the state it's trying to check.
- In the future we should consider splitting up Member API (and probably other) test suites into smaller pieces.
2022-12-05 18:24:28 +07:00
Simon Backx
2519f4b20d Disabled autoRefresh for batch sending service to increase performance
fixes https://github.com/TryGhost/Team/issues/2363
2022-12-05 12:09:30 +01:00
Naz
e170f293e3
Extracted sleep method to e2e framework module
no issue

- The sleep method has been used in 8 modules reimplementing the same thing over and over again. It's usually a sign of async event processing outside of the request/response loop. It's good to have a single point of implementation for a "hack" like this, so we could track it easier and address the even processing delay in a more optimal way centrally if it ever becomes a bottleneck
2022-12-05 17:26:29 +07:00
Elena Baidakova
0caf8bff18
Renamed all references to "Flagged as spam email" (#15938)
closes TryGhost/Team#2352
2022-12-05 12:07:26 +04:00
Elena Baidakova
f09ed78af2
Fixing the misalignment of avatar between member activity and member detail (#15939)
closes TryGhost/Team#2356
2022-12-05 11:59:17 +04:00
renovate[bot]
82722bbf43
Update dependency fastq to v1.14.0 2022-12-05 04:20:14 +00:00
renovate[bot]
b8ab57b692 Update dependency expect to v29 2022-12-05 11:16:46 +07:00
renovate[bot]
7f169cdd96 Update dependency html-validate to v7.10.1 2022-12-05 10:21:00 +07:00
renovate[bot]
1e2c45f208 Update dependency terser to v5.16.1 2022-12-05 10:20:15 +07:00
renovate[bot]
c203f1da7a Update dependency lint-staged to v13.1.0 2022-12-05 09:23:47 +07:00
renovate[bot]
cdca9d73b3
Update Test & linting packages 2022-12-02 23:05:46 +00:00
Sam Lord
74d0fee125 Set a default environment for browser tests
no issue
2022-12-02 17:04:04 +00:00
Sam Lord
00d223991d Improved browser test CI integration
refs: https://github.com/TryGhost/Toolbox/issues/481
2022-12-02 17:04:04 +00:00
Sam Lord
7bfe5db716 Ensure tests pass when pointing at a remote server
no issue

This will need some work, since we are introducing a 500ms delay to wait for a network request to return. Ideally the tier expander should eventually populate itself.
2022-12-02 17:04:04 +00:00
Sam Lord
47526bc175 Fixed Portal test in browser suite
no issue
2022-12-02 17:04:04 +00:00
Sam Lord
40903c3136 Fixed browser-based tests in local context
no issue

Local tests can now setup Stripe during the global setup process, and the webhook server is run out-of-process.
Running tests in CI against localhost will use environment variables to setup Stripe.
Providing a test URL will avoid setting up Stripe and will assume that it is already done.
2022-12-02 17:04:04 +00:00
Daniel Lockyer
bc0b1f6adc Added CI for running Playwright tests
🚧
2022-12-02 17:04:04 +00:00
Sam Lord
668e523ab4 Allow playwright tests to run locally and remotely
no issue

This commit allows tests to run remotely by replacing selectors with production-suitable ones (no [data-test...]).

It also allows running locally with Stripe webhooks by adding a new global setup function.
2022-12-02 17:04:04 +00:00
Rishabh
e74ba81276 Refined email debug screen error handling
refs https://github.com/TryGhost/Team/issues/2327
2022-12-02 21:29:07 +05:30
Simon Backx
6ae9b49e73 Added post title to email debug page 2022-12-02 16:51:51 +01:00
Peter Zimon
cd5a85021a Fixed member name alignment on email debug screen
refs. https://github.com/TryGhost/Team/issues/2327

- on the first two tabs of the email debug screen, the member email wasn't aligned properly when there was no name for a member
2022-12-02 16:16:01 +01:00
Rishabh
ddb61c3b3c Wired static expand error logic on email debug
refs https://github.com/TryGhost/Team/issues/2327

- wires the static handling of error message on debug screen with real error
2022-12-02 20:41:08 +05:30
Ghost CI
d9ed6bcdb8 v5.25.0 2022-12-02 15:00:48 +00:00
Peter Zimon
768ba2be50 Minor UI fixes on email debug screen
refs. https://github.com/TryGhost/Team/issues/2327
2022-12-02 15:49:23 +01:00
Peter Zimon
c7600407bd Fixed text color bug in box button links 2022-12-02 15:46:52 +01:00
Simon Backx
ea72934c41
Improved email concurrency sending (#15923)
no issue

Send 10 batches at the same time
2022-12-02 15:30:02 +01:00
Peter Zimon
f562d19f3c Updated error display styles for error debug
refs. https://github.com/TryGhost/Team/issues/2327

- Some minor CSS style changes were needed for errors on the email debug screen. Also we weren't showing any message i - for whatever reason - there was no data for batches.
2022-12-02 15:13:07 +01:00