exception - codeceptjs 3 run-workers with 11 worker threads encounter session out or time out problem - Stack Overflow

admin2025-04-30  0

Trying to upgrade my test from codeceptjs2 to codeceptjs3 and run lots of test files with run-worker command:

npx codeceptjs run-workers 15 --plugins allure

The command seems to be working very well and test is running and passed/failed according to log.

About 10 mins later, below exception start appearing only for worker thread 6/7/10

invalid session id: session timed out or not found
    at getErrorFromResponseBody (file:///home/jenkins/agent/workspace/QA-BOSE-UI-Automation/node_modules/webdriver/build/utils.js:195:12)
    at NodeJSRequest._request (file:///home/jenkins/agent/workspace/QA-BOSE-UI-Automation/node_modules/webdriver/build/request/index.js:193:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Browser.wrapCommandFn (file:///home/jenkins/agent/workspace/QA-BOSE-UI-Automation/node_modules/webdriverio/node_modules/@wdio/utils/build/shim.js:88:29)
    at async Browser.wrapCommandFn (file:///home/jenkins/agent/workspace/QA-BOSE-UI-Automation/node_modules/webdriverio/node_modules/@wdio/utils/build/shim.js:88:29)

From 0 to 10 mins everything looks good, not sure why the exception throws later.

My webdriver configuration is as follows:

{
  tests: testFiles,
  output: "./output",
  helpers: {
    WebDriver: {
    uniqueScreenshotNames: true,
    url: ";,
    browser: "chrome",
    restart: true,
    windowSize: "maximize",
    keepBrowserState: false,
    keepCookies: false,
    waitForTimeout: 30000,
    smartWait: 5000,
    timeouts: {
        script: 30000,
        'page load': 15000,
    },
    desiredCapabilities: {
        browserName: 'chrome',
        acceptInsecureCerts: true,
        'selenoid:options': {
            version: '131',
            enableVNC: true,
            enableVideo: true,
            name: "test",
            timeZone: "America/Los_Angeles"
        },
        chromeOptions
    },
    host: "selenoidServerIp",
    port: 8081
    },
    MyHelper: {
      require: "./custom/MyHelper.js",
    },
    ChaiWrapper: {
      require: "codeceptjs-chai",
    },
  },
  include: {
    I: "./custom/steps/",
    pages: "./pages/",
    api: "./utils/API",
    common: "./utils/common.js",
    date: "./utils/date.js",
  },
  bootstrap: require('./global.js'),
  bootstrapAll: require('./global.js'),
  // teardownAll: require("./teardown.js"),
  mocha: {},
  name: "test",
  plugins: {
    retryFailedStep: {
      enabled: true,
      retries: 2,
    },
    autoDelay: {
      enabled: true,
    },
    screenshotOnFail: {
      enabled: true,
      fullPageScreenshots: true,
    },
    allure: {
      outputDir: "./allure-results",
      enabled: true,
      require: "allure-codeceptjs",
    },
    pauseOnFail: {},
  },
  hooks: [
    require("./hooks/skip.js"),
    require("./hooks/failed.js"),
    // require("./global.js"),
    require("./hooks/networkRequestValidation.js"),
    require("./hooks/reloadSelenoidConfig.js"),
    require("./hooks/getSessionId.js"),
  ],
}

The same configuration is working for codeceptjs2 run-workers, expected it should works on codeceptjs3 run-workers.

转载请注明原文地址:http://anycun.com/QandA/1746020767a91448.html