-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable integration tests #1680
base: main
Are you sure you want to change the base?
Enable integration tests #1680
Conversation
npm run build:localContent | ||
CMS="FILE" | ||
# After get the latest content data from Strapi, run the tests | ||
npx vitest run --project=integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. I thought the idea is to run the test directly against strapi? why would we download content and force an offline test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was also my understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap, but I would need to make a big refactor in the tests and how Strapi gets slow after the update to the version 5 the tests might fail due the timeout (vitest problems).
So getting the all current Strapi content and tests offline it'll be the same thing as testing directly against Strapi. And it runs fast as well, because I don't need to retrieve every single flow or content from strapi to test it.
@@ -33,7 +33,7 @@ | |||
"test:e2e": "npx playwright test", | |||
"test": "vitest run --project=!integration", | |||
"test:watch": "vitest --project=!integration", | |||
"test:integration": "vitest run --project integration", | |||
"test:integration": "./tests/integration/runTests.sh", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly prefer a solution without shell script, like npm run build:localContent && CMS="FILE" vitest run --project integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you strongly prefer a solution without shell script? I did a shell script to avoid a long command line. And in case we need to add more options in the command line, adding in the shell script is easier than adding here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me: Much easier to understand whats going on + less files in the repo (especially hard-to-debug executables like shell scripts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it's much easier to read multiple lines in a shell script than to read a long single-line command. 😅
Quality Gate passedIssues Measures |
Background
We have an integration test to verify whether the pages and contexts in the on-flow configuration are available in Strapi. To obtain the latest Strapi content data, we retrieve the most recent
content.json
from production.Problem
When new fields are added to the context of existing pages, the integration test fails because these fields are not present in the latest
content.json
from production. Additionally, we cannot deploy the updated content because the system crashes if a field is not yet defined in the on-flow configuration context.Solution
Before running the integration tests, we first load the latest content data from Strapi and then execute the tests. This ensures that the tests run against the most up-to-date Strapi content, preventing failures due to missing fields.