Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ jobs:
outputs:
content_checksum: ${{ steps.checksum.outputs.content_checksum }}

## run-integration-tests:
## runs-on: ubuntu-latest
## env:
## STRAPI_API: "${{ secrets.STRAPI_API }}"
## STRAPI_ACCESS_KEY: "${{ secrets.STRAPI_ACCESS_KEY }}"
## CMS: STRAPI
## steps:
## - uses: actions/checkout@v4
## - uses: ./.github/actions/cached-checkout-install
## - run: npm run test:integration
integration-tests:
runs-on: ubuntu-latest
env:
STRAPI_API: "${{ secrets.STRAPI_API }}"
STRAPI_ACCESS_KEY: "${{ secrets.STRAPI_ACCESS_KEY }}"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-checkout-install
- run: npm run test:integration

verify-local-e2e:
needs: [get-content-file]
Expand All @@ -62,7 +61,7 @@ jobs:
build-push-app-image:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [code-quality, verify-local-e2e]
needs: [code-quality, verify-local-e2e, integration-tests]
permissions:
contents: read
id-token: write # for cosign w/ keyless signing
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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)

Copy link
Contributor Author

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. 😅

"typecheck": "tsc",
"typecheck:watch": "tsc -w",
"update:courtData": "tsx ./app/services/gerichtsfinder/encryptedStorage.ts updateZip",
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/runTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Get the latest content data from Strapi before run the tests
npm run build:localContent
CMS="FILE"
# After get the latest content data from Strapi, run the tests
npx vitest run --project=integration
Comment on lines +3 to +6
Copy link
Member

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Loading