0

I am using codeceptJS with webdriverio Selenium standalone server. my problem is how do i load my unpacked chrome extension when i run tests. i’ve been searching for the solution from past 2 days but couldn’t find a solution. all i get is some java code from searches.

Coool
  • 31
  • 6

2 Answers2

2

first of all thank you very much both of you wOxxOm && Yandimirkin Vladislav

what i did was added few lines into codecept.conf.js

desiredCapabilities: {
                chromeOptions: {
                  args: [ "--load-extension=D:/Projects/dpl/dist", "--disable-gpu", "--window-size=1366,768" ]
                }
              }

Here is what codecept.conf.js looks like now:

    exports.config = {
      tests: './*_test.js',
      output: './output',
      helpers: {
        WebDriver: {
          url: 'http://localhost',
          browser: 'chrome',
          desiredCapabilities: {
            chromeOptions: {
              args: [ "--load-extension=D:/Projects/dpl/dist", "--disable-gpu", "--window-size=1366,768" ]
            }
          }
        },
        ResembleHelper : {
          require: "codeceptjs-resemblehelper",
          screenshotFolder : "./tests/output/",
          baseFolder: "./tests/screenshots/base/",
          diffFolder: "./tests/screenshots/diff/"
        }
      },
      plugins: {
        wdio: {
          enabled: true,
          services: ['selenium-standalone']
        }
      },
      include: {},
      bootstrap: null,
      mocha: {},
      name: 'codecept'
    }
Coool
  • 31
  • 6
1

1) Add to you capababilies: { extensions: extensionsToLoad }

Where extensionsToLoad is array of base64 encoded extensions, something like this

fs.readFileSync("./test.crx").toString("base64")