ryanrosello-og/playwright-slack-report

[FEATURE] Add support for javascript config when running through the CLI

Opened this issue · 2 comments

As a user I would like to parse in dynamic values into the config with more power. I am currently not able to do the following (as far as im aware) without doing some sorcery..

  • Make the webhook URL an environment variable (this needs to be baked in as a string in the config.json)
  • Do string manipulation in the config; Id love to be able to use a regex match to set a key name for example
  • Local testing means I cannot use the same config file due to how the _ENV replacement works - theres no way to initialise my custom environment variables locally

Expected:
Allow the config to support a javascript module, instead of enforcing it to be json, in my case it would look something like the below
config.js

module.exports= {
  "sendResults": "always",
  "slackLogLevel": "error",
  "sendUsingWebhook": {
    "webhookUrl": process.env.slackURL
  },
  "meta": [
    {
      "key": "title",
      "value: `Playwright Test Results ${(new Date()).toLocaleDateString('en-AU')}
    },
    {
      "key": "Environment",
      "value": process.env.rootURL.match(/(?<=\/\/)[^\.]+/)
    }
  ]
}

@willbertSmillbert these are all good ideas 👍, I will implement these soonish.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.