early-article-48946
01/24/2023, 1:12 PMstale-optician-85950
01/24/2023, 1:20 PMearly-article-48946
01/24/2023, 1:21 PMearly-article-48946
01/24/2023, 1:22 PMearly-article-48946
01/24/2023, 1:22 PMstale-optician-85950
01/24/2023, 1:26 PMcypress.config.ts
* then inside a new folder I have other config files: /cypress/configs/cypress.mobile.config.ts
Then you can use a very helpful package like defu
to handle inheritance inside the new config, to avoid key / value duplication. i.e.
import { defineConfig } from 'cypress';
import defu from 'defu';
import defaultConfig from '../../cypress.config';
export default defineConfig(
defu(
{
viewportWidth: 375,
viewportHeight: 812,
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) Mobile/15E148',
env: {
device: 'mobile',
},
},
defaultConfig
)
);
And finally here's the run command that specifies the new config file to use:
cypress run --browser chrome --config-file cypress/configs/cypress.mobile.config.ts
early-article-48946
01/24/2023, 1:29 PMstale-optician-85950
01/24/2023, 1:29 PMmobile
values example with your environment
required values.early-article-48946
01/24/2023, 1:29 PMearly-article-48946
01/24/2023, 1:30 PM