Is it possible to run Angular Cypress Test with K6?

Viewed 118

We have a lot of cypress tests in our Angular Project. But we want to use k6 as our new main load testing tool. But also we want to keep our already written cypress tests.

Is it possible to execute cypress tests within k6? e.g run k6 with 1000 VUs but instead of k6 test script, use cypress test scrpts.

1 Answers

There's an article here: Using Cypress to automate k6 scripts recording

Lots of steps, but to update for Cypress v10 the syntax for the before:browser:launch hook:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      on('before:browser:launch', (browser, launchOptions) => {
        if (browser.isHeaded) {
          try {
            launchOptions.extensions.push(...);
          } catch (error) {
            console.log("extension not available"); //when in headless mode
          }
          return launchOptions;
        }
      })
  },
  // other config
}
Related