bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
54 stars 10 forks source link

Passing command line parameters #127

Closed BenPowerProfessional closed 2 years ago

BenPowerProfessional commented 4 years ago

How can I pass command line parameters, for example:

cypress run --browser chrome

I would like to force Cypress to run in Chrome instead of Electron, because it's a bit buggy.

I tried this, but it didn't work: npm run cypress-ntlm --browser chrome

bjowes commented 4 years ago

Hi @BenPowerProfessional

Given that you have used the package.json scripts from the readme, you can modify them to pass environment variables. On windows, with the parameter from your question, the script would then become: "cypress-ntlm-chrome": "npm run ntlm-proxy && (cypress-ntlm run --browser chrome & ntlm-proxy-exit)"

BenPowerProfessional commented 4 years ago

Thank you very much, I will give this a try.

hari49951 commented 4 years ago

@bjowes how to run specific cucumber scenarios by tags? I am trying with below syntax to run scenarios tagged with @user-admin but all the scenarios are being executed (scenarios with different tags). I tried the same syntax on different project where cypress-ntlm-auth is not required and I see that only specific scenarios with tags are being executed. Is there anything missing in the below syntax? Thanks!

"test:tags": "npm run ntlm-proxy && (cypress-ntlm run --headed --browser chrome --env TAGS='@user-admin' configFile=test --spec 'cypress/integration/cucumber-tests/Offices/OfficeList/TestA.feature' & ntlm-proxy-exit)"

bjowes commented 4 years ago

Generally you should be able to pass any command line argument also when executing through cypress-ntlm, but I remember that there have been issues with more complex variants. It should be possible to resolve with proper escaping, since qoutes won't work the same way as when entered directly on the command line. Some points to consider:

hari49951 commented 4 years ago

@bjowes Thanks for the quick response. I tried your suggestion for configFile flag and getting "error: unknown option: --configFile" and TAGS value without quotes. Still not able to execute specific scenarios.

From cypress-cucumber-preprocessor doc I see that to execute scenarios using tags syntax is "cypress-tags" but to use ntlm-auth it is "cypress-ntlm". Example: ./node_modules/.bin/cypress-tags run -e TAGS='not @foo and (@bar or @zap)' https://github.com/TheBrainFamily/cypress-cucumber-preprocessor#smart-tagging

bar commented 4 years ago

@hari49951 I think you meant to at handle somebody else?

bjowes commented 2 years ago

Is this still an issue @hari49951 ?

hari49951 commented 2 years ago

no, can we close this issue? Thanks for checking.