Commit Graph

15 Commits

Author SHA1 Message Date
Naz
09bf5804ad Fixed e2e-framework to correctly compare headers
refs https://github.com/TryGhost/Toolbox/issues/209
refs https://github.com/TryGhost/Toolbox/issues/210

- Fixed request header processing by the e2e-framework where it failed to lowercase incoming header keys. This bug made it harder to test code paths which involve header checking, e.g. following code: `req.headers['stripe-signature']` would not get a correct value if the header was specified as Stripe-Signature
- Additional output to the status code assertions was added - this allows to have more context when an invalid response code comes back in a test.
2022-02-15 18:38:45 +07:00
Hannah Wolfe
2ea7d5432b
Updated casper test fixture to latest version
closes: https://github.com/TryGhost/Toolbox/issues/193

- Our Casper fixture was several years out of date.
- I'd already updated the ghost-api to point to the latest API version, which was the main difference
- This makes sure the full fixture is up to date and correct, and therefore that we're truly testing if Ghost right now works
- It also adds instructions for how to update it in future

GOTCHA: the mock-express-style tests are failing if the API difference between test-theme and casper are different
- I've tried to look into why this is - it's something to do with the overridden route settings not working properly if the API version changes
- Given that we may not keep this style of testing AND we are definitely not keeping API versions, I'm ignoreing this for now
- To get around it, I'm setting both themes to be v4 API, so that Casper is exactly as in main
2022-01-25 14:10:53 +00:00
Hannah Wolfe
034f7d9a55
Renamed & cleaned up price data test theme fixture
refs: https://github.com/TryGhost/Toolbox/issues/168

- Having large theme fixtures makes tests run slower, so we're working to reduce them
- This fixture was a full copy of a very old version of Casper, but all we needed was a handful of files so that the tests can run
- This theme is also used for testing members, not just price data so I've renamed it for clarity
- The remaining files is the bare minimum we need to test these features
2022-01-24 09:55:21 +00:00
Hannah Wolfe
7c7e38f8e8
Fixed overly specific default routes test
- This test failed after updating Casper, because Casper has changed how it outputs next/previous type posts at the bottom
- This test was overly specific. If we want to test if the next and previous posts are output, we should have a particular assertion/test that clearly does that
- I've changed the test to not use cheerio and just do a couple of checks to make sure that head and body contain something sensible
- This will still be specific to the fixtures though
2022-01-21 12:31:45 +00:00
Fabien 'egg' O'Carroll
10c214c148
Switched AMP to be 'off' by default in all new Ghost instances (#13907)
refs https://github.com/TryGhost/Team/issues/1189

Support for AMP is slowly in decline, and makes developing new cards trickier,
since AMP no longer has an effect of SEO we're going to disable it by default
as a first step toward moving away from it.

Co-authored-by: Thibaut Patel <thibaut@ghost.org>
2022-01-14 18:55:48 +02:00
Sam Lord
af075c063e Revert "Improve the performance of prepareContentFolder"
This reverts commit bfacca3035.
2022-01-04 11:34:42 +00:00
Sam Lord
bfacca3035 Improve the performance of prepareContentFolder
refs: https://github.com/TryGhost/Toolbox/issues/150

Instead of loading all themes for each set of tests in the e2e suite, only load the frontend at all for frontend tests, and only load themes for the theme tests.
2022-01-04 09:27:04 +00:00
Naz
21219fff2f Removed unused sinon referece
https://github.com/TryGhost/Toolbox/issues/140

- There is no need for sinon usage in this test suite
2021-11-30 20:14:51 +13:00
Naz
6e395291fe Moved custom routes test to e2e frontend suite
https://github.com/TryGhost/Toolbox/issues/140

- This test was bloating the regression/site suite and was using hacks (calling the Admin API) to create a custom redirects state
- It suits way better in e2e frontend test suite with less hacky approach to start the Ghsot instance  - using custom routes file path to initialize the instance
2021-11-30 20:14:51 +13:00
Naz
6b81b3db02 Unified RSS frontend tests
refs https://github.com/TryGhost/Toolbox/issues/140

- Same/similar RSS tests were present in regression and e2e tests suites. It made sense to move missing cases from regression to e2e. This saves us time bootstraping db state in multiple places and keeps all test cases regarding single feature in same place
2021-11-30 20:14:51 +13:00
Hannah Wolfe
0799f02e80
Rewritten HTMLErrorRenderer w/o asset helper & template
refs: 2af9e2e12

- This new HTMLErrorRenderer is borrowed heavily from finalHandler
   - This is the module that express uses to render errors if there is no custom errorhandler
- It just renders a really simple html page wrapping err.stack in a <pre>
   - This results in a nicely formatted, but unstyled error page
- I also updated BasicErrorRenderer to use the same res.statusCode + err.stack pattern rather than err.message

Note: This error renderer is _only_ used for renderering errors on the `/ghost/` route
 - In almost all cases, errors here are rendered by Ember
 - The only error that can be rendered here is a missing template error see: 2af9e2e12
2021-11-24 13:01:06 +00:00
Sam Lord
d4e0ae14f1 Force start in email route tests to pick up stubbed API
refs: https://github.com/TryGhost/Toolbox/issues/130

The API version stays at v2 unless we stub the getFrontendApiVersion method. But stubbing the method doesn't get picked up unless we actually restart Ghost.

TODO: Maybe change the default here so we don't need to restart Ghost just to test the current version's API
2021-11-17 10:51:46 +00:00
Hannah Wolfe
8902cc85d6
Updated e2e tests to be async/await
- These test files were moved from regression, and were not up to date
- Ensured they follow the right patterns
2021-10-06 15:51:05 +01:00
Hannah Wolfe
e4074286df
Cleaned up some e2e/integration tests
- e2e tests are tests that cover critical functionality by booting ghost
- integration tests are more like unit tests, but need to initialise and use a db
- so settings shouldn't start Ghost, url service is critical and should be in integration, and preview is critical and should be in e2e
2021-10-06 14:40:39 +01:00
Hannah Wolfe
1dec3d56b1
Renamed our acceptance tests to "e2e"
- These are end-to-end tests, make it clearer what they are and what they are supposed to do
2021-10-06 12:40:52 +01:00