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

Confirm this plugin works with wildcard spec parameter #10

Open
bahmutov opened this issue Jan 24, 2023 · 5 comments
Open

Confirm this plugin works with wildcard spec parameter #10

bahmutov opened this issue Jan 24, 2023 · 5 comments

Comments

@bahmutov
Copy link
Owner

- name: Run bonus tests 🧪
  # https://github.com/cypress-io/github-action
  uses: cypress-io/github-action@v4
  with:
    spec: 'cypress/integration/bonus*.js'
  env:
    SPLIT: ${{ strategy.job-total }}
    SPLIT_INDEX: ${{ strategy.job-index }}
@dannyskoog
Copy link

Hi @bahmutov. I can confirm that this does not work. In my case my step looks like this:

    - name: Cypress run
      uses: cypress-io/github-action@v5
      with:
        install: false
        start: npx serve -l 8080
        wait-on: http://localhost:8080
        browser: chrome
        spec: cypress/e2e/staging/**/*.spec.ts
      env:
        SPLIT: ${{ strategy.job-total }}
        SPLIT_INDEX: ${{ strategy.job-index }}
        SERVICE_ACCOUNT: ${{ secrets.FIREBASE_ADMIN_SA_STAGE }}
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

But specs outside of the staging folder where ran anyway

@dannyskoog
Copy link

What did work, though, was using the config.specPattern parameter, i.e:

    - name: Cypress run
      uses: cypress-io/github-action@v5
      with:
        install: false
        start: npx serve -l 8080
        wait-on: http://localhost:8080
        browser: chrome
        config: specPattern=cypress/e2e/staging/**/*.spec.ts
      env:
        SPLIT: ${{ strategy.job-total }}
        SPLIT_INDEX: ${{ strategy.job-index }}
        SERVICE_ACCOUNT: ${{ secrets.FIREBASE_ADMIN_SA_STAGE }}
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@bahmutov
Copy link
Owner Author

Yup, Cypress does not pass spec CLI argument anywhere, thus this plugin has no idea what to do, there is an issue I opened cypress-io/cypress#26032

I think for now I will work around it by asking the to pass the spec argument via env variable too, something like

    - name: Cypress run
      uses: cypress-io/github-action@v5
      with:
        install: false
        start: npx serve -l 8080
        wait-on: http://localhost:8080
        browser: chrome
        spec: cypress/e2e/staging/**/*.spec.ts
      env:
        SPLIT: ${{ strategy.job-total }}
        SPLIT_INDEX: ${{ strategy.job-index }}
        SPLIT_SPECS: cypress/e2e/staging/**/*.spec.ts

@dannyskoog
Copy link

I understand.

Yes, that could be reasonable. In my case (as seen above) I went with passing config.specPattern (which allowed me to just specify my pattern once) to the action since I noticed that your plugin had access to and was using it

@karfau
Copy link

karfau commented Sep 13, 2023

What is the current status of this?
I tried the suggested things but nothing worked.
I'm still on cypress v9.1.1 which is most likely the reason that the specPattern config option is not accepted by cypress.
Docs are hard to find for the old version, so what are my options?
Would it help to modify the testFiles property of the config object to fit my spec pattern before passing it to the cypress=split plugin?
It seems to be a string (from the config file) when it is passed in and a list of files when it is returned. But i tried to use the spec pattern there without success...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants