Disable Screenshot-generation when creating a Cypress-Report - integration-testing

I using Cypress combined with mochawesome-report / mochareports for to generate reports automatically.
I'm starting the tests by executing npx cypress run --config video=false --browser chrome on the terminal.
Screenshots shall not be created.
Is there a flag, similar to video=false, concerning screenshots?
Or: How can I disable screenshot-generation?

You can set this in your configuration
Capturing of screenshots when a test fails can be turned off entirely by setting screenshotOnRunFailure to false from within your configuration or by setting screenshotOnRunFailure to false in the Cypress.Screenshot.defaults().
Screenshots

Related

Cypress/Next.js E2E test with --watch option works well, but failed with --headless

Thanks for the cypress team.
I have one issue with e2e headless test on command.
When I run the test with --watch option, it passes well.
But it is failed for the --headless option.
I need to run this on CI, so it has to resolve this issues soon.
Here are commands that I run.
yarn nx run checkout-e2e:e2e --watch
yarn nx run checkout-e2e:e2e --headless
I have 3 test files totally, and the specific thing is that the first test doesn't pass after long time delay(around 60 sec) but the rest ones pass.
Here is one code file to run.
The other files are almost same.
const classname = 'buybox--buy-box-example-one-size'
const url = `?path=/story/${classname}`
describe('BuyBox Example visual regression', () => {
it('Matches the snapshot', () => {
cy.visit(url)
cy.viewport(1000, 1500)
cy.get(`#${classname}`)
cy.get('body').type('S')
cy.get('body').type('A')
cy.wait(3000)
cy.get('body').matchImageSnapshot('buyboxOneSizeDesktopExample')
cy.viewport(375, 667)
cy.get(`#${classname}`)
cy.get('body').type('S')
cy.get('body').type('A')
cy.wait(5000)
cy.get('body').matchImageSnapshot('buyboxOneSizeExample')
})
})
My Dev Env:
Windows 10
VS code
Cypress 6.0.1
Node 14.16.1
Storybook 6.2.8
Here is the error screenshot in headless mode.
https://prnt.sc/131k32j
Please reply if anyone knows its reason and solution.
Thanks.
I've tried to solve this issue and found it finally.
Go to plugin/index.js and comment this line...
// on('file:preprocessor', preprocessTypescript(config))
Fixing e2e test failed on headless mode
I am not sure why this works for me but I hope that this will be helped for everyone who has same issue.
If anyone knows the reason of this solution, comment here please.
Thanks.

Disable file output of hydra

I'm using hydra to log hyperparameters of experiments.
#hydra.main(config_name="config", config_path="../conf")
def evaluate_experiment(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg))
...
Sometimes I want to do a dry run to check something. For this I don't need any saved parameters, so I'm wondering how I can disable the savings to the filesystem completely in this case?
The answer from Omry Yadan works well if you want to solve this using the CLI. However, you can also add these flags to your config file such that you don't have to type them every time you run your script. If you want to go this route, make sure you add the following items in your root config file:
defaults:
- _self_
- override hydra/hydra_logging: disabled
- override hydra/job_logging: disabled
hydra:
output_subdir: null
run:
dir: .
There is an enhancement request aimed at Hydra 1.1 to support disabling working directory management.
Working directory management is doing many things:
Creating a working directory for the run
Changing the working directory to the created dir.
There are other related features:
Saving log files
Saving files like config.yaml and hydra.yaml into .hydra in the working directory.
Different features has different ways to disable them:
To prevent the creation of a working directory, you can override hydra.run.dir to ..
To prevent saving the files into .hydra, override hydra.output_subdir to null.
To prevent the creation of logging files, you can disable logging output of hydra/hydra_logging and hydra/job_logging, see this.
A complete example might look like:
$ python foo.py hydra.run.dir=. hydra.output_subdir=null hydra/job_logging=disabled hydra/hydra_logging=disabled
Note that as always you can also override those config values through your config file.

UNIX/vim - Verify syntax error

How can I verify if my code on vim (Unix) has syntax errors?
Is there any command to test the code?
Thank you in advance!
Use a plugin which checks your code.
The one I use, and I'm not alone, is syntactic: https://github.com/vim-syntastic/syntastic
This works for a tons of different languages and even has multiple "lint" engines to choose from for each language. For instance, I use python and can configure syntactic to use one of the following checkers: flake8, pyflakes, pylint and the native python checker. And, yes, it checks vim script as well.
If you can't use any plugins AND only want to debug your vim-scripts, then your best bet is to use vim's own debugger (help debug-scripts). To use this mode:
Start vim in debug mode: vim -D my_broken_script.vim
use :debug to switch into debug mode.
use Ex commands to inspect local variables, echo idx, or global ones: echo g:idx, where idx is the var.
set breakpoints with :breakadd on either functions or files. And delete them with :breakdel
Use profile to investigate performance issues (help :profile): :profile start func and :profile stop

unable to launch custom brackets.exe

I have created a desktop app using brackets-shell version sprint-38. I have done the following changes.
config.h -changed APP_NAME from 'Brackets' to 'MyBrackets'.
appshell_config.gypi - changed appname from 'Brackets' to 'MyBrackets'.
Gruntfile - changed build.name from 'Brackets' to 'MyBrackets'.
After building brackets-shell with these changes i used to get 'MyBrackets.exe'
inside brackets-shell/release folder.
while executing the exe one file chooser popup comes, and node & MyBrackets.exe processes will start in the background.
his works fine with Sprint38,But after migrating to brackets-shell tag version release-1.3 or master, this dose not work. The file chooser is not coming as well as no node process starts.
Is any thing i am missing with the latest release ?
Bingo!!!
I got the problem. actually xcopy command is not generating properly in MyBrackets.vscsproj file. and this is well know problem i think so. To fix this problem one fix-msvc.sh file has written.
Since brackets.vscsproj name is hardcoded here so changes is not reflecting in my MyBrackets.vscsproj

How to pass command line arguments to a Meteor app?

I would like to pass command line arguments to my Meteor app on start up.
For example --dev, --test or --prod indicating whether or not it is running in dev, test or prod environments. It can then load different resources on start up, etc...
I tried something like this in a /server/server.js
var arguments = process.argv.splice(2);
console.log('cmd args: ' + JSON.stringify(arguments,0,4));
The I ran a test. And quite a few others with just random command line arguments.
meteor --dev
The output in the console is only this.
cmd args: [
"--keepalive"
]
What is the best way to get command line arguments into a Meteor app?
Or, is this even the correct way to solve the higher level problem? and if not, what is the correct way to solve this problem of distinguishing between running enviro?
Meteor doesn't forward command line args to your app, if it doesn't know them. You have multiple possibilities:
Rewrite parts of meteor.js to forward unrecognized args. This shouldn't be too hard, but it's not a pretty solution. And if updates occur you are in trouble. :D
You could write a small config file and change the behaviour of your app based on the configuration options in there. Take a look at this question.
The easiest thing to do is using environment variables. You can read env vars in node like this. After that you can start your app the "express.js" way: $ METEOR_ENV=production meteor
I hope I could help you! :)
The reason it doesn't work is because the meteor command starts a proxy (which gets the arguments you give) and then it starts the meteor app with --keepalive.
process.argv will have correct values if you build Meteor with meteor build --directory /my/build/path and run it.

Resources