How do I run a specific feature file using cucumber and cypress 9.7.0 - automation

I have multiple feature files, I need to run a single feature file using cli. I don't want to use tags to control the file that I want to run. I want a command using that I should be able to run a specific feature. I am using cucumber preprocessor with cypress

Related

How to refresh Cucumber Output file in IntelliJ while using multiple feature files?

I am using the BDD framework using Cucumber,
There are multiple feature files.
But am not able to get the output in the HTML file. (However, I can see the output in my console. )
Where am going wrong? How to keep this file(CucmberExtentReport.html) updated in IntelliJ IDEA?
Screenshot of the folders:
Am getting the HTML output only on running the whole configuration from here
But I want to run a single feature file and see the output which IntelliJ is not updating...
I am running single feature by clicking run like this:

How can I run all test files that are in different folders using mocha?

I want to run my mocha test using npm test the problem is that the tests may vary their location.
The locations may be lib/modules/somefolder/test/*-test.js or lib/modules/somefolder/anotherfolder/test/*-test.js
Currently my test script is like this node_modules/.bin/mocha lib/modules/*/test/*-test.js --reporter spec but this won't find the test files located in the second location.
Is there any way to find the tests in both locations?
You should be able to accomplish this by doing ./**/*-test.js. This should find any files with -test.js in the name in any directory relative to the one you are in.

Is there a way for me to write a script in Robot Framework that utilize's the command line functions?

I'm currently working in Linux, and I know you can use Run Process to run certain applications, but I was wondering if there's a possible way to have my script running, open command line, input, for example: "clean" which in my case processes a few functions in my bash.rc. That would be extremely helpful in my automation right now.
Well essentially, what I did was I created a separate .sh executable file. Opened my .bashrc and copied my functions / aliases into my .sh file using the gedit editor. Then from my Robot Script, I used the Run Process command (I don't have my exact code at the moment) and called my executable file.

How to group together certain tests or files when doing a run in Cypress?

I am currently running Cypress and I have folders inside of it, where I have tests located for different applications.
I have a folder entitled "smhw-qa" which contains sub-folders and tests files for this specific application.
This directory apps will also include other applications too in future.
What I wish to do
In order to avoid having to run every test for a run, I wish to only run this specific folder. The location of the folder is as such:
'cypress/integration/apps/smhw-qa'
Over time, there will be more folders and tests added to the apps directory.
I am familiar with how to run a specific file, so doing the following works:
npx cypress run --spec 'cypress/integration/apps/smhw-qa/banners_promos_global/global_search.js'
How can I specify to Cypress which folder to run specifically when I use the npx cypress -run command?
What I have tried already
To run a specific test file I tried:
npx cypress run --project 'cypress/integration/apps/smhw-qa'
But this provides an error instead:
Can't run because no spec files were found.
We searched for any files inside of this folder:
/Users/jaswindersingh/Documents/cypress-automation/automation/cypress/integration/apps/smhw-qa/cypress/integration
Running specific sets of tests by their folders will be much easier for me, and will save time when running a specific suite of tests on our CI platform for example. I will also not need to specify the individual files since this is time-consuming.
It would also mean I can split out my tests and run them on different machines
Do I need to put anything into my test files, or inside of cypress.json or modify anything else, or can this be achieved through the terminal?
What options must I use instead?
Thanks
I think the clue is in the error message, you call
cypress/integration/apps/smhw-qa
and the error message shows
cypress/integration/apps/smhw-qa/cypress/integration
so to use the --project flag you need to replicate the /cypress folder per project, as per this example cypress-test-nested-projects
Folder structure:
package.json
node_modules
src/
clients/
foo/
cypress.json
cypress/
bar/
cypress.json
cypress/
However, I think you might want to use the --spec flag instead. If I understand it correctly, the glob pattern will allow you to keep the current folder structure. Docs
cypress run --spec 'cypress/integration/apps/smhw-qa/**/*'
Through --project you can manage different cypress.json files, the docs says
This enables you to install Cypress in a top level node_modules folder but run Cypress in a nested folder. This is also helpful when you have multiple Cypress projects in your repo.
so you're on the right way, just prepare some project-related cypress.json files

Include an angular module in all.spec files via karma

I have an angular module that has some angular configuration that I want all tests to have before running. I could go in all the files and include that module via angular.mock.module but I was wondering if I could do it via karma somehow.
make a new file with a suitable name. lets say required.ts. in this file, include all the required modules/dependencies which you want to include in your tests.
Now in karma.conf, add the required.ts in files and preprocess it to get the desired result.
you could also decide to make a require.js in which case you would not have to preprocess it in karma.conf.