import * as master from '@eui/automation/wdio.conf.js'
import EuiReporter from '@eui/automation/core/reporter/eui-reporter.js'
import testSuites from './suites.json' assert { type: "json" }
import userData from './userdata.json' assert { type: "json" }

export const config = Object.assign(master.config, {
  screenshot: 'fail',  // never, fail or always
  saveScreenshotToJson: false,
  browserlog: 'always',  // never, fail or always
  baseUrl: 'https://eui.ecdevops.eu/eui-showcase-ux-10.x',
  specs: ['./tests/**/*.spec.js'],
  logLevel: 'error',
  suites: testSuites,
  maxInstances: 3,
  capabilities: [
    {
      browserName: "chrome",
      "goog:chromeOptions": {
        args: ['disable-infobars', '--headless=new', '--window-size=1920,1080', '--incognito'],
      },
      "goog:loggingPrefs": { browser: "ALL", driver: "ALL", performance: "ALL" },
    },
  ],
  app: 'EUI',
  env: 'TST',
  userenv: 'ACC',
  testUsers: ['xxx', 'yyy'],
  testUserData: userData,
  automationProtocol:'devtools',
  services: [],
  puppeteerNetworkCapture: { saveResponse: true, captureMimeTypes: ['text/html', 'text/plain', 'application/json', 'text/event-stream'] }, //only works on local executions
  networkAdditionalChecks: {
    threshholds: {
      blocked: 1000,
      dns: 200,
      connect: 200,
      send: 2000,
      wait: 6000,
      receive: 4000,
      ssl: 200
    }
  },
  reporters: ['spec',
    ['allure', {
      outputDir: 'allure-results-tst',
      reportDir: 'allure-report-tst',
      cleanBefore: true,
      disableWebdriverStepsReporting: true,
      disableWebdriverScreenshotsReporting: false,
      openReport: false // CAREFULL, should be false when run on CI execution or other execution agent
    }],
    [EuiReporter, {
      loggerOptions: {
        reportDir: 'jsonReportTst'
      },
      publishers: []
    }]]
});