Commit Graph

23 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
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
661acdee95 Made portal tests run fully parallelised
refs: https://github.com/TryGhost/DevOps/issues/78
2023-10-12 14:33:20 +01: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
bf815adc5a More test improvements
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
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
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
db36da6b5d
Increased global Playwright expect timeout to 10s
- this sometimes helps when CI is slow, and is the best way to set it
  globally
2023-02-22 12:54:26 +01:00
Elena Baidakova
9c664c8d02
Added data attributes to admin/tiers (#16095)
refs TryGhost/Team#2371
2023-01-11 11:35:55 +04:00
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
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
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
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
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
Sam Lord
60b924f173 Use headless mode by default for Playwright tests
no issue

The setting `headless: false` is superceded by using `PWDEBUG=1` as an
environment variable during debug sessions / while working on tests.
2022-11-28 10:52:38 +00:00
Sam Lord
7e02568cec Fixed PlayWright config
no issue

Using multiple workers could cause Stripe to be removed from one test while another test was using it.
2022-11-24 18:16:43 +00:00
Sam Lord
8b80233ae6 Added sample Portal test to PlayWright suite
refs: https://github.com/TryGhost/Toolbox/issues/479
2022-11-24 17:47:04 +00:00
Sam Lord
6fe5023e91 Added working Playwright tests
refs: https://github.com/TryGhost/Toolbox/issues/479
2022-11-24 15:11:40 +00:00
Sam Lord
f6870fa846 Added browser-based testing framework
refs: https://github.com/TryGhost/Toolbox/issues/479

Framework includes:
* command to run tests
* command to record tests
* mechanism for starting and stopping Ghost before and after each suite of tests
* mechanism for loading fixtures into Ghost before starting tests
* sample test for controlling Ghost Admin
2022-11-22 14:12:34 +00:00
Sam Lord
49605a9559 Enabled browser-based tests to start Ghost with default test fixtures
refs: https://github.com/TryGhost/Toolbox/issues/479
2022-11-17 17:00:54 +00:00