Testcafe: Config file - allow to specify different config files

Created on 11 Feb 2019  路  10Comments  路  Source: DevExpress/testcafe

What is your Test Scenario?

I have different environments where I'd like to specify alternative config files.

What are you suggesting?

Allow using various config files, not only one at the root level.

What alternatives have you considered?

None

Additional context

server level 2 CLI configuration storage enhancement

Most helpful comment

I would also be happy to see this feature added for two reasons:

  1. I have a project the is nested inside of a larger one and would like to have all the configuration files in one place.
  1. I would like to have different configurations for when I debug tests and when I run them using the CI.

I think you could simply add an option to specify where the configuration file exists using a cli command such as:

testcafe --config ./config-folder/config.json

Therefore allowing the user to choose where he puts the file and what to call it.

In your package.json you would specify different scripts with different configs:

// package.json
{
  "scripts": {
    "test:production": "testcafe --config ./config-folder/prod.json",
    "test:debug": "testcafe --config ./config-folder/debug.json"
  }
}

All 10 comments

I think the way Cypress does this is really well thought out, maybe it can serve as inspiration for Testcaf茅:

https://docs.cypress.io/guides/guides/environment-variables.html#Setting

Thank you for your suggestion. We will research it and consider implementing it in the future.

I would also be happy to see this feature added for two reasons:

  1. I have a project the is nested inside of a larger one and would like to have all the configuration files in one place.
  1. I would like to have different configurations for when I debug tests and when I run them using the CI.

I think you could simply add an option to specify where the configuration file exists using a cli command such as:

testcafe --config ./config-folder/config.json

Therefore allowing the user to choose where he puts the file and what to call it.

In your package.json you would specify different scripts with different configs:

// package.json
{
  "scripts": {
    "test:production": "testcafe --config ./config-folder/prod.json",
    "test:debug": "testcafe --config ./config-folder/debug.json"
  }
}

The test metadata along with the --test-meta command line flag could be potentially used to distinguish between environments.

But support for separate configs is a really good feature to have.

Hi everyone and @miherlosev . I found this issue while digging around looking for a way to use different config files for things like local env, CI on jenkins, QA servers etc. Right now we have pretty long CLI script commands in our package.json and it's not ideal, but I would love to have this ability for all the reasons mentioned above. I'm just curious if this feature is still on the way as activity here has died down for a while.

Thank you for bringing this to our attention. This feature is on our TO-DO list. I can't, however, provide you with a precise date as to when it may be introduced. You are welcome to submit your PR with the implementation, and we will review it.

Hi @AlexanderMoiseev. As seen with @Farfurix in issue #4824, I can create a PR using confinode, but this solution needs to be discussed in the team before I start. Please tell me if you want me to work on it.

Thank you for your interest in this feature. We are going to implement it without using third-party libraries.

Same as everyone else, would like to see this feature dded. in my case i'm working in a monorepo, with several packages inside it. The goal would be to have separate config files for each package based on their needs. and be able to target which package to run e2e tests for.

Was this page helpful?
0 / 5 - 0 ratings