Closed dgoemans closed 2 years ago
Hi @dgoemans,
Could you please clarify why adding a new option is better than changing the working directory before executing testcafe-action
?
@miherlosev how? Any tips here would be appreciated.
using the working-directory
option only works with run
commands, not uses, and i don't want to set it globally for the entire project (we have a monolith repo, so it doesn't make sense).
Could you please share an example of the GitHub Action Workflow file illustrating that the proposed working-directory
option will be useful?
name: End2End
on:
workflow_dispatch:
inputs:
apiUrl:
description: "API to run against"
default: "MY URL"
required: false
jobs:
e2e-tests:
name: Run TestCafe Tests
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Install Deps
working-directory: ./src/frontend/FolderWithTestcafeTypescriptAndPackageJsonForTests
run: npm install
- name: Run testcafe
uses: DevExpress/testcafe-action@latest
with:
args: "-c 3"
working-directory: ./src/frontend/FolderWithTestcafeTypescriptAndPackageJsonForTests
env:
TEST_API_URL: ${{ github.event.inputs.apiUrl }}
- uses: actions/upload-artifact@v2
with:
name: TestCafeArtifacts
path: ./src/frontend/FolderWithTestcafeTypescriptAndPackageJsonForTests/testcafe-reports
Note that it's relevant for us to run it inside a different folder because not only do we have the testcaferc and tsconfig in there, but the tests also make references relative to that folder, and we install packages that we use for our testcafe tests. It's a relatively complex test setup (and application) so running it like this is the only way.
The PR looks good. However, it seems that the PR breaks the tests: https://github.com/DevExpress/testcafe-action/runs/4187350992?check_suite_focus=true
I think the cause may be that you pass the cwd
parameter every time, even if it is undefined. Please fix the tests, and we will merge the PR.
haven't had time to revisit this, and the tests don't work locally for me at all, so i'm going to close this.
Worked out how to test this by directly referencing my repo, seems to work great 😄