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

Override options does not work when a suite is specified #4102

Closed
brunobg opened this issue Apr 3, 2017 · 3 comments
Closed

Override options does not work when a suite is specified #4102

brunobg opened this issue Apr 3, 2017 · 3 comments

Comments

@brunobg
Copy link

brunobg commented Apr 3, 2017

What are you trying to achieve?

Run codeception with a different port for Phantomjs, overriden on the command line.

What do you get instead?

The override made by -o does not work if the suite is specified.

Provide console output if related. Use -vvv mode for more details.

This should replace the ports from 4555 to 4556.

$ codecept config:validate acceptance -o 'env: phantom: modules: config: WebDriver: port: 4556' -o 'env: phantom: modules: config: AppHelper: port: 4556'
Validating acceptance config... Ok
------------------------------

acceptance Suite Config:

Array
(
    env => Array
        (
            phantom => Array
                (
                    modules => Array
                        (
                            config => Array
                                (
                                    AppHelper => Array
                                        (
                                            port => 4555
                                            browser => phantomjs
                                        )

                                    WebDriver => Array
                                        (
                                            port => 4555
                                            browser => phantomjs
                                        )

exact same command, but suite acceptance is not specified. Notice it works correctly:

$ codecept config:validate -o 'env: phantom: modules: config: WebDriver: port: 4556' -o 'env: phantom: modules: config: AppHelper: port: 4556' -o 'modules: config: WebDriver: port: 4556'  -vvv           
Validating global config... env: phantom: modules: config: WebDriver: port: 4556
env: phantom: modules: config: AppHelper: port: 4556
modules: config: WebDriver: port: 4556
Ok
------------------------------

Codeception Config:

Array
(
    env => Array
        (
            phantom => Array
                (
                    modules => Array
                        (
                            config => Array
                                (
                                    WebDriver => Array
                                        (
                                            port => 4556
                                        )

                                    AppHelper => Array
                                        (
                                            port => 4556

Details

  • Codeception version: 2.2.10
  • PHP Version: 7.0.5
  • Operating System: Linux
  • Installation type: Composer

This is _envs/phantom.yml

modules:
    config:
        AppHelper:
            port: 4555
            browser: 'phantomjs'
        WebDriver:
            port: 4555
            browser: 'phantomjs'

This is codeception.yml

paths:
    tests: tests
    log: tests/_log
    data: tests/_data
    helpers: tests/_helpers
    envs: _envs
settings:
    bootstrap: _bootstrap.php
    suite_class: \PHPUnit_Framework_TestSuite
    colors: true
    memory_limit: 1024M
    log: true
modules:
    enabled:
        - AppHelper
        - Asserts
    config:
        AppHelper:
            url: 'http://site.local'
            browser: firefox
            window_size: 1366x768
coverage:
    enabled: false
    remote: false

and finally tests/acceptance.suite.yml

class_name: WebGuy

I found #3740 in which @DavertMik says "Unfortunately it works for global config only. Suite configs are overriding global configs." Is it the same issue? If so, what is a possible fix or workaround? How can I change the phantomjs port on the command line?

@DavertMik
Copy link
Member

Why so complicated? Why don't you just use

codecept config:validate acceptance -o 'modules: config: WebDriver: port: 4556'

?

@zachleigh
Copy link

I can confirm the original issue. On version 2.5.2, when I run a specific suite, the '-o' flag does nothing.

With shuffle not set in codeception.yml file...

codecept config:validate -o 'settings: shuffle: true'

Codeception Config:

Array
(
    settings => Array
        (
            shuffle => 1
            bootstrap => _bootstrap.php
            suite_class => \PHPUnit_Framework_TestSuite
            colors => 1
            memory_limit => 1024M
            log => 1
            strict_xml =>
            lint => 1
            backup_globals => 1
            log_incomplete_skipped =>
            report_useless_tests =>
            disallow_test_output =>
            be_strict_about_changes_to_global_state =>
        )
        ...

Works as expected.

codecept config:validate acceptance -o 'settings: shuffle: true'

...
    bootstrap => _bootstrap.php
    suite_class => \PHPUnit_Framework_TestSuite
    colors => 1
    memory_limit => 1024M
    log => 1
    strict_xml =>
    lint => 1
    backup_globals => 1
    log_incomplete_skipped =>
    report_useless_tests =>
    disallow_test_output =>
    be_strict_about_changes_to_global_state =>
    shuffle =>
    coverage => Array
...

No change.

@eXorus
Copy link
Member

eXorus commented May 14, 2021

We are now at 4.1 and soon 5.0.
I'm closing this issue, feel free to reopen if it is not resolved on the next version.

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

4 participants