Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Your locators are fragile! Make them strong with test data attributes

Your locators are fragile! Make them strong with test data attributes

Anil shared lessons learned from WebdriverIO automation tests created for the E-commerce application. He shared mistakes to avoid, tools and strategies used to create future-friendly automation tests by creating test data attribute instead of reusing already existing locators.

[email protected]

January 21, 2020
Tweet

Other Decks in Technology

Transcript

  1. Can your Product Owner / business stack holder writing test

    cases? https://unsplash.com/photos/iv6Xbp11olc https://unsplash.com/photos/0TH1H1rq_eY
  2. Can your Product Owner / business stack holder writing test

    cases? https://unsplash.com/photos/iv6Xbp11olc https://unsplash.com/photos/0TH1H1rq_eY
  3. class WdioPage extends Page { // Locators get search() {

    return $('#search_input_react') } get helpLink() { return $('header > div > nav > ul > li:nth-child(3) > a') } } @anilbms75
  4. class WdioPage extends Page { // Actions async open(pagePath) {

    super.open(pagePath) } async navigateToHelp() { const helpLink = await this.helpLink; // actions await helpLink.click(); } } @anilbms75
  5. class WdioPage extends Page { // Locators get search() {

    return $('#search_input_react') } get helpLink() { return $('header > div > nav > ul > li:nth-child(3) > a') } // page path get gettingStartedPagePath(){return 'docs/gettingstarted.html'} // Actions async open(pagePath) { super.open(pagePath) } async navigateToHelp() { const helpLink = await this.helpLink; // actions await helpLink.click(); } } @anilbms75