Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not override a config option from the command line in a suite #6613

Open
schmunk42 opened this issue Dec 6, 2022 · 2 comments
Open

Can not override a config option from the command line in a suite #6613

schmunk42 opened this issue Dec 6, 2022 · 2 comments

Comments

@schmunk42
Copy link
Contributor

What are you trying to achieve?

I want to override a config option from the command line in a suite.
In my case actually the base-URL for the WebDriver.

What do you get instead?

codecept config:validate -o 'foo: bar'

root@de43a6b7a5fc:/project/tests# codecept config:validate -o 'foo: bar'
Validating global config... foo: bar
Ok
------------------------------

Codeception Config:

Array
(
    foo => bar
    actor => Test
[...]

The above works, I can see foo: bar in the output, it's also shown in the first line.

codecept config:validate -o 'foo: bar' idp

root@de43a6b7a5fc:/project/tests# codecept config:validate -o 'foo: bar' idp
Validating idp config... Ok
------------------------------

idp Suite Config:
[...]

No override is applied, I tried several different formats eg. modules: config: ..., env: chrome: modules: ...

Details

  • Codeception version: tested latest version for v3, v4, v5 (Docker image) - output above is from 5.0.5
  • Suite configuration:
class_name: XyzTester
modules:
    enabled:
        - WebDriver
        - Asserts
        - Helper\Xyz
    config:
        WebDriver:
            host: chrome
            url: https://www-test.mydomain.de
            browser: chrome
            port: 4444
            window_size: 1024x768
            restart: true
env:
    chrome:
        modules:
            config:
                WebDriver:
                    browser: 'chrome'
                    host: chrome
                    window_size: 1440x960

    firefox:
    # nothing changed

Related issues:

@terrylinooo
Copy link

Try modifying your class_name: XyzTester to actor: XyzTester

@schmunk42
Copy link
Contributor Author

Using actor made no difference.

From my latest tests it looks like the suite config overrides the options from the command line.
If I move the relevant part from suite-config to global-config, I can use the command line options.

Example:

 codecept run -o "modules: config: WebDriver: url: http://example.com" -- e2e

Is this an intended behavior?

CC: @Naktibalda @handcode @eluhr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants