import S3Publisher from '@eui/automation/core/reporter/publishers/s3-publisher.js'


import * as master from '@eui/automation/linux4dev.wdio.conf.js'
import EuiReporter from '../core/reporter/eui-reporter.js'
import ZephyrPublisher from '../core/reporter/publishers/zephyr-publisher.js'
import tools from '@eui/tools/scripts/utils/tools.js'
const { vaultUser, vaultPassword } = tools.getArgs()
import * as testSuites from './suites.json' assert { type: "json" }

export const config = Object.assign(master.config, {
  vaultConfig: {
    endpoint: 'https://vault.compasscorporate.eu/v1',
    user: vaultUser,
    password: vaultPassword
  },
    // vaultEnvVars takes all entries of the given vault secret and adds them as environment variables
    vaultEnvVars: {
      s3: {
        path: "/secret/functional/aws",
        key: "default"
      }
    },
  screenshot: 'fail',  // never, fail or always
  saveScreenshotToJson: false,
  browserlog: 'always',  // never, fail or always
  baseUrl: 'https://eui.ecdevops.eu/',
  specs: ['./apps/my-workplace-e2e-wd/tests/**/*.spec.js'],
  logLevel: 'error',
  suites: testSuites,
  maxInstances: 2,
  browserheight: 1080,
  browserwidth: 1920,
  capabilities: [
    {
      browserName: "chrome",
      "goog:chromeOptions": {
        args: [
          '--disable-infobars',
          '--incognito',
          '--disable-setuid-sandbox',
          '--window-size=1920,1080',
          // '--headless=new',
          // '--proxy-server=http://127.0.0.1:3129',
          '--proxy-server=http://147.67.138.13:8012',
          '--proxy-bypass-list="localhost;127.0.0.1;*.ec.europa.eu;*.tech.ec.europa.eu;*.cc.cec;*.testa.eu;*.cec.eu.int;*:31100"'
        ],
        prefs: {
          'directory_upgrade': true,
          'prompt_for_download': false,
          'download.default_directory': tmpDir
        }
      },
      "goog:loggingPrefs": { browser: "ALL", driver: "ALL", performance: "ALL" }
    },
  ],
  devtoolsProxyCredentials: {username: process.env.proxyuser, password: process.env.proxypassword},
  env: 'PROD',
  userenv: 'PROD',
  testUsers: [],
  automationProtocol:'devtools',
  services: [],
  reporters: ['spec',
    ['allure', {
      outputDir: 'allure-results-e2e',
      reportDir: 'allure-report-e2e',
      cleanBefore: true,
      disableWebdriverStepsReporting: true,
      disableWebdriverScreenshotsReporting: false,
      openReport: true // CAREFULL, should be false when run on CI execution or other execution agent
    }],
    [EuiReporter, {
      loggerOptions: {
        reportDir: 'jsonReport'
      },
      publishers: []
    }]]
});


