DevExpress / testcafe-action

TestCafe test runner for GitHub Actions
https://testcafe.io
MIT License
36 stars 16 forks source link

Bug: cannot use --app on windows #16

Closed eli88fine closed 1 year ago

eli88fine commented 4 years ago

Hello, I'm using VueJS/Nuxt (although I'm sure this applies to other frameworks as well) and I typically use the --app command in TestCafe to launch npm run dev to start the server running in the background that I then test.

Using the TestCafe action, this works fine in the Linux environments in Github, but on Windows I get errors that I haven't been able to resolve: 'cannot find command npm', 'cannot find command nuxt'. I tried switching npm to npx since you use npx in your index.js file, but that didn't work either: 'cannot find command npx'.

Is there a way to be able to support the --app flag for this action in Windows environments?

AlexKamaev commented 4 years ago

Hello. I was able to reproduce an issue in my sample. However, I am not sure that it is the same issue. Please check the following repository: https://github.com/AlexKamaev/gh-action-16. Here are the results of running actions: https://github.com/AlexKamaev/gh-action-16/runs/1213939967?check_suite_focus=true Like in your case, it works on ubuntu-latest but does not work on windows-latest. So, the cause of the issue is unclear, and we need to research it.   Could you confirm that you have a similar issue?   As a workaround, you can remove the TestCafe action from your workflow file and replace it with the following commands:

- run: npx testcafe chrome tests --app "npm run start"
eli88fine commented 4 years ago

Yes, that looks like you are reproducing the same issue I had. Sorry I forgot to link to my repo: https://github.com/CuriBio/mantarray-frontend-components/

I tried the run npx command, but I can't seem to get it working. You can see in the action logs a variety of errors.

I tried: run: npx testcafe "chrome:headless:emulation:width=1920;height=930;cdpPort=9223;" ${{ matrix.e2e-tests }} --screenshots path=./tests/e2e/screenshots --app "npm run dev" --app-init-delay 35000

run: npx testcafe \"chrome:headless:emulation:width=1920;height=930;cdpPort=9223;\" ${{ matrix.e2e-tests }} --screenshots path=./tests/e2e/screenshots --app \"npm run dev\" --app-init-delay 35000

run: npx testcafe "chrome:headless:emulation:width=1920;height=930;cdpPort=9223;" ${{ matrix.e2e-tests }} --screenshots path=./tests/e2e/screenshots --app "npx nuxt dev --spa" --app-init-delay 35000

I'll be trying some other things, but just wanted to give you an update

AlexKamaev commented 4 years ago

Thank you for your cooperation. I reviewed your repository and found that you already have TestCafe in dependencies. It means that you can use the already installed TestCafe instead of the TestCafe action.

I modified my example from https://github.com/AlexKamaev/gh-action-16. Now, it works as expected. Please take a look at package.json:

"scripts": {
    "start": "npx http-server pages",
    "test": "node ./node_modules/testcafe/bin/testcafe chrome tests --app \"npm run start\" --app-init-delay 10000"
  },

Also, see yml:

steps:
  - name: Check out the repository
    uses: actions/checkout@v1
  - name: Npm install
    run: npm install
  - name: Run TestCafe
    run : npm test

So, it looks like the issue is not with TestCafe itself, but only with the TestCafe action.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] commented 1 year ago

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.