Online Training: Web test automation with CodeceptJS. Sign up now!

Configuración por Ambientes con Codecptjs

Good morning, I wanted to know if it is possible to perform configuration by environments (QA - Production, Santity) in the Codecptjs.js Archive. Since different scenarios will be executed per environment.

Hi @luzmirc, welcome to the community.

Your question unfortunately is a bit vague. Handling multiple environments with codeceptjs can be done in multiple ways.

v1 - Have multiple config files stored in a folder and whenever you run your tests you use a command like below, passing in the specific env config.

npx codeceptjs run -c my.codecept.conf.js
npx codeceptjs run --config path/to/codecept.json

v2 - Make use of environment variables and dynamically change your config values based on those

example:

    iOS: {
        desiredCapabilities: {
            deviceName: process.env.DEVICE || 'iPhone 11 Pro Max',
            platformName: process.env.PLATFORM || 'iOS',
            platformVersion: process.env.OS_VERSION || '13.1',
            automationName: process.env.ENGINE || 'XCUITest',
            launchTimeout: 30000,
            autoAcceptAlerts: true,
            showIOSLog: true,
            enableAsyncExecuteFromHttps: true,
        },
    },

There are more ways of doing and controlling this, so a bit more specificity would help to answer more clearly on this

Hola muchas gracias por responder. decia como se puede configurar para realizar ejecuciones por ambientes por decir, en un ambiente QA ejecutar 3 tests, y en Producción ejecutar 5 Test ambos del mismo proyecto.