question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Applitools webdriverio service does not work with CodeceptJS

See original GitHub issue

What are you trying to achieve?

  • I am trying to use the Webdriverio Applitools service, so that I can integrate Applitools into our existing CodeceptJS tests

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

client.takeSnapshot is not a function

Provide test source code if related


const Helper = codeceptjs.helper;

class Applitools extends Helper {

  async takeScreenshot() {
    let client = this.helpers['WebDriver'].browser;
    return client.takeSnapshot('test');
  }

}

module.exports = Applitools;


Scenario.only(
  'User can navigate to the buy page from the homepage',
  (I, HomePage) => {
    HomePage.goToHomePage(); // opens main page of website
    I.click(HomePage.buttons.buy);
    I.seeCurrentUrlEquals('/buy');
    I.waitForText('Let Us Guide You Home', 5);
    I.takeScreenshot();
  },
).tag('@smoke');

Details

  • CodeceptJS version: 2.1.0
  • NodeJS Version: 10.15.3
  • Operating System: mac OSX
  • Protractor || WebDriverIO || Nightmare version (if related): Webdriverio 5.7.2
  • Configuration file:
const { resolve } = require('path');

const getConfig = require('./end-to-end/buildConfig');

if (!process.env.SAUCE_ACCESS_KEY || !process.env.SAUCE_USERNAME) {
  require('dotenv').config({
    path: resolve('./config/.saucelabs.env'),
  });
}

if (!process.env.LOGIN_WALL_PASSWORD) {
  require('dotenv').config({
    path: resolve('./config/.env'),
  });
}

const {
  SITE_URL,
  BUILD_ID,
  IS_LOCAL,
  TEST_TAG,
  CIRCLE_LINK,
  GITHUB_LINK,
} = getConfig(process.env);

// eslint-disable-next-line no-console
console.log('Testing against:', SITE_URL);

exports.config = {
  tests: './end-to-end/tests/*.js',
  timeout: 100000,
  output: './end-to-end/output',
  plugins: {
    wdio: {
      services: ['applitools'],
      applitoolsKey: 'XXXXXXXXXXXXXXXXXX',
    },
    retryFailedStep: {
      enabled: true,
    },
    screenshotOnFail: {
      enabled: true,
    },
    autoDelay: {
      enabled: true,
    },
  },
  helpers: {
    WebDriver: {
      // desiredCapabilities: {
      //   browserName: 'chrome',
      //   version: 'latest',
      //   platform: 'Windows 10',
      //   screenResolution: '1920x1080',
      // },
      url: SITE_URL,
      smartWait: 5000,
      browser: 'chrome',
      windowSize: '1920x1080',
      // user: process.env.SAUCE_USERNAME,
      // key: process.env.SAUCE_ACCESS_KEY,
    },
    Applitools: {
      require: './end-to-end/helpers/applitools_helper.js',
    },
    // SauceLabs: {
    //   require: './end-to-end/helpers/SauceLabs.js',
    //   BUILD_ID,
    //   IS_LOCAL,
    //   TEST_TAG,
    //   CIRCLE_LINK,
    //   GITHUB_LINK,
    // },
  },
  multiple: {
    chrome: {
      chunks: 4,
      browsers: ['chrome'],
    },
    firefox: {
      chunks: 4,
      browsers: ['firefox'],
    },
  },
  include: {
    I: './end-to-end/steps.js',
    PropertyDetailsPage: './end-to-end/pages/propertyDetailsPage.js',
    SearchPage: './end-to-end/pages/searchPage.js',
    HomePage: './end-to-end/pages/homePage.js',
    AccountPage: './end-to-end/pages/accountPage.js',
    AgentsPage: './end-to-end/pages/agentsPage.js',
    AgentResultsPage: './end-to-end/pages/agentSearchPage.js',
    ContactPage: './end-to-end/pages/contactPage.js',
    BuyPage: './end-to-end/pages/buyPage.js',
    MortgagePage: './end-to-end/pages/mortgagePage.js',
    SellPage: './end-to-end/pages/sellPage.js',
    CareersPage: './end-to-end/pages/careersPage.js',
    TitleServicesPage: './end-to-end/pages/titleServicesPage.js',
    InsurancePage: './end-to-end/pages/insurancePage.js',
    HomeWarrantyPage: './end-to-end/pages/homeWarrantyPage.js',
    RelocationPage: './end-to-end/pages/relocationPage.js',
  },
  bootstrap: false,
  name: 'Merlin',
};

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
PeterNgTrcommented, Apr 29, 2019
0reactions
elgalucommented, Jan 11, 2020

Is codeceptjs-applitoolshelper the way to go then? ping @yuriieasternpeak @amitzur

Read more comments on GitHub >

github_iconTop Results From Across the Web

Applitools webdriverio service does not work with CodeceptJS
I am trying to use the Webdriverio Applitools service, so that I can ... Applitools webdriverio service does not work with CodeceptJS #1616....
Read more >
WebDriver - CodeceptJS
WebDriver helper which wraps webdriverio library to manipulate browser using Selenium WebDriver or PhantomJS. WebDriver requires Selenium ...
Read more >
Testing web apps using WebdriverIO 6 | Applitools Tutorials
This will first set your APPLITOOLS_API_KEY into the node process then run npm test . Adding Applitools Eyes to an Existing Node.js WebdriverIO...
Read more >
CodeceptJS vs WebdriverIO | What are the differences?
CodeceptJS - Modern End 2 End Testing Framework for NodeJS. WebdriverIO - Webdriver/Selenium 2.0 JavaScript bindings for Node.js.
Read more >
How to setup WebdriverIO
Probably the simplest form to run WebdriverIO is in standalone mode. This has nothing to do with the Selenium server file (which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found