There is a Cypress project with 250 test cases and it was working fine with bulk execution with tags or individual feature files. All of a sudden when executing the entire suite, it started to throw the error like "the command is too long" (refer the below screenshot for more console information.)
Later tried with a temporary solution to rename and reduce the length of the feature files and it started to work well with the test suite.
Example: LoadQuantity to LoadQty
But in a longer run, we would be adding more test cases and this temporary rename solution would not support. Do we have any best approach to solve this issue or missing any settings/attribute/flags here?
Appreciate all your suggestions and thoughts.
cypress.json
{
"testFiles":"features/**/**/*.feature",
"viewportWidth":1920,
"viewportHeight":1080,
"supportFile":"./cypress/support/index.ts",
"chromeWebSecurity":false,
"watchForFileChanges":false,
"defaultCommandTimeout":20000,
"taskTimeout":300000,
"baseUrl":"https://test.com"
}
package.json
{
"name":"Project",
"version":"1.0.0",
"description":"Cypress project",
"main":"index",
"typings":"index",
"scripts":{
"qa":"npx cypress run --env configFile=qa",
"stg":"npx cypress run --env configFile=stg",
"stg2":"npx cypress run --env configFile=stg2",
"runTests":"npx cypress run --browser chrome --env configFile=stg2 allure=true,allureResultsPath=reports/allure-results",
"allureReport:generate":"allure generate ./reports/allure-results --clean -o ./reports/allure-report",
"allureReport:clean":"if exist reports\\allure-results rmdir /q /s reports\\allure-results && if exist reports\\allure-report rmdir /q /s reports\\allure-report && if exist cypress\\screenshots rmdir /q /s cypress\\screenshots && if exist cypress\\videos rmdir /q /s cypress\\videos",
"pretest":"npm run allureReport:clean",
"test":"npx cypress-tags run TAGS=\"#smoke\" --env configFile=stg2 --browser chrome --headed || npm run posttest",
"test:runAll":"npm run runTests || npm run posttest",
"posttest":"npm run allureReport:generate"
},
"author":"",
"license":"ISC",
"devDependencies":{
"#4tw/cypress-drag-drop":"^2.0.0",
"#cypress/webpack-preprocessor":"^5.9.1",
"#shelex/cypress-allure-plugin":"^2.19.5",
"#types/node":"^16.9.0",
"allure-commandline":"^2.13.8",
"cypress":"^8.5.0",
"cypress-cucumber-preprocessor":"^4.2.0",
"cypress-plugin-tab":"^1.0.5",
"cypress-sql-server":"^1.0.0",
"cypress-xpath":"^1.6.2",
"fs-extra":"^10.0.0",
"mssql":"^7.2.1",
"mysql2":"^2.3.0",
"tsify":"^5.0.4",
"typescript":"^4.4.2"
},
"cypress-cucumber-preprocessor":{
"nonGlobalStepDefinitions":false
}
}
Is there a way to increase the command line string length via Cypress CLI or any
Related
I have the below msbuild deploy command which is working local:
msbuild "Database Services\Database Services.sqlproj" /t:deploy /p:TargetConnectionString="Data Source=TEST,111;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False" /p:BlockOnPossibleDataLoss=False /p:TargetDatabase="test_db"
what is correct syntax to run it in jenkisfile.groovy?
I'm running against my windows machine, so I guess it should start with bat "msbuild ......."
I tried many syntax but they all failed
I'd advise to go multiline then, to have more flexibility and freedom
bat (
label: 'Run Tests',
script: """
set ASPNETCORE_ENVIRONMENT=Pipeline
dotnet test
if errorlevel 1 exit /b 1
"""
)
Note that for multiline you have to keep track of exit code of every line, so while it is not necessary here, you can split your other lines by this to make sure build stops on a first failure.
bat ' msbuild "Database Services\\Database Services.sqlproj" /t:deploy /p:TargetConnectionString="Data Source=TEST,111;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False" /p:BlockOnPossibleDataLoss=False /p:TargetDatabase="test_db" '
I am running cucumber java tests in jenkins job using maven build as below
After its done in post step under windows batch command execution script I am rerunning failures
mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2"
After this step every time execution fails. I have read somewhere that if I add any of the below line it should pass but still it fails every time.
echo "exit script"
true
command || true
exit 0
Also added #!/bin/sh at start of script
Please advise.
Since this is supposed to be executed on Windows you may try
mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2" & echo note: ignoring exit code
or
cmd /c mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2" & echo note: ignoring exit code
(sorry, don't have Jenkins with Windows agent to test this at hand).
I have having trouble chaining scripts in npm. I am using webpack, running a build script then would like to run a bash file after. Both commands are working, but not if chaining them.
In my package.json I have this:
"scripts": {
"build-staging": "webpack --config webpack-staging.config.js -p || ./build-staging.sh"
},
If I run npm run build-staging it webpack runs the build and works fine. It does not run my build-staing.sh however. If I manually run this bash file it runs, so my issue is having it chain and run after the webpack script is finished. I've seen that the pipe || should do this, but no luck.
Am I doing the pipe wrong, or does the bash script not run because webpack does not 'kill' the script once finished? I am not able to run any more commands unless I use Crtl+C, maybe that's the issue?
Thanks!
|| is only used to run a program if the previous command failed (returned a non-zero status).
$ bash -c "exit 0" || echo "This won't run"
$ bash -c "exit 1" || echo "This will run"
This will run
$
If you want your second script to run regardless, you could use
"scripts": {
"build-staging": "webpack --config webpack-staging.config.js -p ; ./build-staging.sh"
},
Or if you only want it to run on success (which is more likely), you could use && instead of ||. Note that ; may not be supported by your platform. As mentioned in the comments, ; doesn't work on Windows, but && does.
hi i am working with yeoman package
i need to automate few thing
this is the my code
i have two batch files
file one
echo *****npm install -g generator-%1*****
start /wait mybatch.bat %1
echo *****creata app folder*****
mkdir cmdtestnew
cd cmdtestnew
echo *****run new app*****
yo %1
cd ..
file two
#echo OFF
npm install -g generator-%1
exit
i am calling this batch file using bellow command in command prompt
> fileone anugular
problem 1 : how can i exit that popup command prompt automatically and complete process in first command prompt
problem 2: how can i stop displaying output of that command in pop-up command line (file two )
NPM has a command line switch to turn off logging:
◾-s or –silent to turn off console logging
i.e. npm install -g generator-%1 -silent
I am using the scripts feature of npm to conveniently start my service by typing npm start. In my package.json file, I have this:
{
...
"scripts": {
"start": "NODE_PATH=. node index.js",
....
}
}
The NODE_PATH is the troublesome part. I do this so I can write in my javascript files: require('lib/mymodule'); instead of require('../lib/mymodule'); or some variant. There is a different syntax for setting an environment variable for a command on Windows. It would be cmd /C "set NODE_PATH=. && node index.js".
How can I accomplish running the right start command based on the operating system?