stale-optician-85950
09/21/2022, 10:07 AMcypress.config.ts
I have /cypress/configs/cypress.mobile.config.ts
and my mobile config uses defu
node package to safely override specified values:
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',
},
e2e: {
excludeSpecPattern: ['**/e2e/site-monitoring/*', '**/e2e/keyboard-navigation/*'],
},
},
defaultConfig
)
);
You'd just need to readjust for test environment specific values.
And run command is like: cypress run --browser chrome --config-file cypress/configs/cypress.mobile.config.ts
https://docs.cypress.io/guides/guides/command-line#cypress-run-config-file-lt-configuration-file-gt