Movatterモバイル変換


[0]ホーム

URL:


Packt
Search iconClose icon
Search icon CANCEL
Subscription
0
Cart icon
Your Cart(0 item)
Close icon
You have no products in your basket yet
Save more on your purchases!discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Profile icon
Account
Close icon

Change country

Modal Close icon
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timerSALE ENDS IN
0Days
:
00Hours
:
00Minutes
:
00Seconds
Home> Programming> Programming Language> Enhanced Test Automation with WebdriverIO
Enhanced Test Automation with WebdriverIO
Enhanced Test Automation with WebdriverIO

Enhanced Test Automation with WebdriverIO: Unlock the superpowers of hybrid testing frameworks

Arrow left icon
Profile Icon Paul M. GrossmanProfile Icon Larry C. Goddard
Arrow right icon
€24.99€27.99
Full star iconFull star iconFull star iconFull star iconFull star icon5(7 Ratings)
eBookNov 2023328 pages1st Edition
eBook
€24.99 €27.99
Paperback
€34.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Paul M. GrossmanProfile Icon Larry C. Goddard
Arrow right icon
€24.99€27.99
Full star iconFull star iconFull star iconFull star iconFull star icon5(7 Ratings)
eBookNov 2023328 pages1st Edition
eBook
€24.99 €27.99
Paperback
€34.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€24.99 €27.99
Paperback
€34.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Table of content iconView table of contentsPreview book icon Preview Book

Enhanced Test Automation with WebdriverIO

Fortress of Solitude – Configuring WebdriverIO

In this chapter, we will install WebdriverIO and its dependencies. There are two approaches, and we will discuss the advantages of each. It is also important to keep the versions of the dependencies up to date. To help with this, we will use Yarn to keep our package.json and yarn.lock files upto date.

The setup instructions for WDIO can be found in theGetting Started section on the officialwebsite (https://webdriver.io/docs/gettingstarted):

Figure 2.1 – Getting Started

Figure 2.1 – Getting Started

Figure 2.2 – Current documentation indicators for version 7.x

Figure 2.2 – Current documentation indicators for version 7.x

In this section, we'll cover the followingmain topics:

  • WebdriverIO setup
  • Building and installing the project dependencies
  • Making outfirst commit

Tip

Be sure you are viewing the latest version of WDIO 8.0. Googling questions about WDIO features can lead to support pages ofprior versions.

WebdriverIO setup

The WDIO team works hard to make everything easy to install, as described in the documentation. WDIO can be set up intwo ways:

  • Custom configuration while answering a seriesof questions
  • Cloned from an existing projecton GitHub

For this project, we will show the questions and the selected answers. The second option, cloning the boilerplate project approach, is described in thefollowing section.

Option 1 – required steps to start installing WebdriverIO 8.0for TypeScript

Navigate from theTERMINAL window to the\repos\wdio folder. The quickest way to set up a WDIO project quickly from Yarn is to typeyarn create wdio, ending with adot (.):

> yarn create wdio .

The WDIO robot will appear, and a list of configuration questions willbe presented:

Figure 2.3 – WDIO initialization from the code TERMINAL window

Figure 2.3 – WDIO initialization from the code TERMINAL window

The initialization will ask how to configure WDIO from scratch. Here is the list of settings for WebDriver 8.0. There are several options, and many will use the default. Each item with a star (*) shows the choice selectedat setup:

Note

WebdriverIO is always being updated. These questions themselves should be similar for both Mac and Windows users. However, the order, phrasing, and selection details do change slightly as new featuresare added.

Figure 2.4 – Settings

Figure 2.4 – Settings

? What type of testing would you like to do? (Usearrow keys)

  • > (*) E2E Testing - of Web orMobile Applications
  • ( ) Component or Unit Testing - inthe browser
  • >https://webdriver.io/docs/component-testing
  • ( ) Desktop Testing - ofElectron Applications
  • >https://webdriver.io/docs/desktop-testing/electron
  • ( ) Desktop Testing - ofMacOS Applications
  • >https://webdriver.io/docs/desktop-testing/macos

? Where is your automation backend located? (Usearrow keys)

  • > (*) On my localmachine (default)
  • ( ) In the cloudusing Experitest
  • ( ) In the cloud usingSauce Labs
  • ( ) In the cloud using Browserstack or Testingbot or LambdaTest or adifferent service
  • ( ) I have my ownSelenium cloud

Today, there are many cloud options, includingExperitest,Sauce Labs,BrowserStack,Testingbot, andLambdaTest. For this book, we will install the automation backend on our local Mac orWindows machine.

Next is the environment type. For these purposes, we willuseWeb:

? Which environment would you like to automate? (Usearrow keys)

  • (*) Web - web applications inthe browser
  • ( ) Mobile - native, hybrid, and mobile web apps, on Androidor iOS

Then, select the browser(s) wewill be using. Select the default of Chrome. Note that we can addothers later:

? With which browser should we start? (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter>to proceed)

  • (*)Chrome
  • ( )Firefox
  • ( )Safari
  • ( )Microsoft Edge

Next is the reporting framework type. For this book, we will be using Jasmine. However, much of the code that’s supplied will apply to alllisted frameworks:

? Which framework do you want to use? (Usearrow keys)

  • ( )Mocha (https://mochajs.org/)
  • ( ) Mocha withSerenity/JS (https://serenity-js.org/)
  • (*)Jasmine (https://jasmine.github.io/)
  • ( ) Jasmine withSerenity/JS (https://serenity-js.org/)
  • ( )Cucumber (https://cucumber.io/)
  • ( ) Cucumber withSerenity/JS (https://serenity-js.org/)

Out of the box, WebdriverIO uses Mocha by default. However, it also supports Jasmine and can be combined with Chai for advanced assertions. Cucumber is an extra layer of abstraction framework that hides the core code. This allows fewer technical resources to create tests from Feature files. Cucumber is outside the scope of this book, but the techniques described can be implemented in a Cucumber WDIO project. Next, we will tell WDIO this is aTypescript project:

? Do you want to use a compiler? (Usearrow keys

  • ( )Babel (https://babeljs.io/)
  • (*)TypeScript (https://www.typescriptlang.org/)
  • ( )No!

Question: What is Babel and isit needed?

Babel (https://babeljs.io/) is aJavaScript transpiler. Because JavaScript is implemented differently in differentbrowsers, a transpiler is used to transform our code to an older JavaScript version. Some features are not implemented in certain browsers, such as async/await, depending on what browser version we are testing against. So, a transpiler allows us to have our framework be backward compatible. Although this is a TypeScript project, we do not need theTypeScript transpiler.

Question: How to know what features are available in different browsersand versions?

Thecaniuse.com website provides descriptive tables of the different ECMAScript features thatare supported:

We will be creating our tests in TypeScript, which is a superset of JavaScript. The Typescript transpiler will be used. Now to get a quick startupsample script.

? Do you want WebdriverIO to autogenerate sometest files?

(Y/n) Yes

This will automatically set up a sample test to run to ensure WebdriverIO is working. It is also where we will build a framework unit test to check features are working. Oh yes, we are developers, and our automation project has its own unit andintegration tests.

The following is the default path for the TypeScript sample test cases and should notbe changed:

? Where should be the location of yourspecs files?

./test/specs/**/*.ts

Tests can be organized into feature sub-folders and smoke tests under the specs folder. Notice that because we selected TypeScript in the prior question, the test extensions (.js) replacedwith .ts.

? Do you want to use pageobjects (https://martinfowler.com/bliki/PageObject.html)?

Yes

This sets up a Page Object Model folder structure forour project.

? Where are your page objectslocated? ./test/pageobjects/**/*.ts

Now, we want to configureour reporters.

Which reporter do you wantto use?

  • (*)spec
  • ( )dot
  • ( )junit
  • (*)allure
  • ( )video
  • ( )mochawesome
  • ( )slack

WebdriverIO supports a wide variety of reporters. For this small sample, we will start with the spec and allure reporters. Note that WDIO even supports aVideo option. You may notice that Slack is included. In the final chapter of this book, we will be using Jenkins to send update messages to aSlack channel.

? Do you want to add a plugin to yourtest setup?

  • ( ) wait-for: utilities that provide functionalities to wait for certain conditions till a defined taskis complete.
  • >https://www.npmjs.com/package/wdio-wait-for
  • ( ) angular-component-harnesses: support for Angular componenttest harnesses
  • >https://www.npmjs.com/package/@badisi/wdio-harness
  • ( ) Testing Library: utilities that encourage good testing practices laid downby dom-testing-library.
  • >https://testing-library.com/docs/webdriverio-testing-library/intro

In our framework, we will have an advanced approach for waiting for page synchronization. This option will beleft as-is.

If the application under test (AUT) is an Angular project, it is recommended to use the Angular ComponentHarnesses configuration.

? Do you want to add a service to yourtest setup?

  • ( )vscode
  • ( )eslinter-service
  • ( )lambdatest
  • ( )crossbrowsertesting
  • ( )vscode
  • ( )docker
  • ( )slack

Note

34 additional services are integrated into WDIO, including Slack, Cross Browser Testing (Selenium Standalone), and ES-Linter. Covering them all is beyond the scope ofthis book.

The WebdriverIOVisual Studio Code (VS Code) service allows us to seamlessly test extensions from end to end in the VS Code Desktop ID. By providing a path to your extension, the service does the rest,as follows:

  • 🏗 Installs VS Code (either stable, insiders, or aspecified version).
  • ⬇ Download Chromedriver specific to the given VSCode version.
  • 🚀 Enables you to access the VS Code API fromyour tests.
  • 🖥 Starts VS Code with custom user settings (including support for VS Code on Ubuntu, macOS,and Windows).
  • 🌐 Serves VS Code from a server to be accessed by any browser for testingweb extensions.
  • 📔 Bootstraps page objects with locators that match your VSCode version.

The nextquestion asks you to enter the landing page for the application under test. For this, we will use the default provided as the sample tests use this to navigate internally to a websitefor testing.

? What is thebase URL?

http://localhost

This is the base landingpage that our testswill launch.

A base landing page ensures we do not repeatedly add code to navigate to the same landing page. Later in this book, we will see how to customize this value. For the moment, we will use the internet sandboxfor testing.

The final installation step is to have npm download and install all the packages. While this part can be performed by the installer, we need to make one modification. Choose No for thefinal question.

? Do you want me to run `npminstall` (Y/n)

No

We will be using Yarn rather than npm as our package manager due to its speed. This completes the setup for installing and configuring WebdriverIO from the wizard. Another option is to clone an existing project, which will be covered next. Skip to theInstalling and configuring WebdriverIO section if you do not plan to clone from anexisting project.

Because weare using Yarn as our package manager instead of npm, we will need to remove the package-lock.json file and run the yarn install command to build the equivalentyarn.lock file.

> yarn install

Option 1 – cloning WebdriverIO from a boilerplate project

An alternate way toset up WDIO is to use a preconfiguredWDIO boilerplate project from the WDIO GitHub repo. This means that less troubleshooting might be needed. We can choose from many preconfigured boilerplate projects with all thenecessary components.

For this project, we will fork theJasmine TypeScript Boilerplate projectfrom GitHub:

Figure 2.5 – The Jasmine TypeScript boilerplate project on GitHub

Figure 2.5 – The Jasmine TypeScript boilerplate project on GitHub

Click thejasmine-boilerplate link. This will allow us to create our own version via theCode button:

Figure 2.6 – Copying the project URL from GitHub

Figure 2.6 – Copying the project URL from GitHub

ClickCode. Multiple choices for cloning the project will bedisplayed. SelectOpen withGitHub Desktop:

Figure 2.7 – Cloning from the source path to the local destination

Figure 2.7 – Cloning from the source path to the local destination

ClickClone; the project will be put in therepos path.

Next, we will change theLocal path directory so that it points to where our project lives. We can do this by clickingChoose..., changing the directory torepo\wdio, andclickingClone:

Figure 2.8 – The project’s Explorer icon in VS Code

Figure 2.8 – The project’s Explorer icon in VS Code

Click theExplorer icon in the top-left corner of VS Code and open theWDIO folder.

Then, clickOpen Folder, navigate to therepo\wdio folder, andclickOpen:

Figure 2.9 – Trusting the authors of a project

Figure 2.9 – Trusting the authors of a project

If thisdialogue appears, check theTrust the authors of all files in the parent folder ‘repos’ option and clickYes, I trustthe authors.

With that, we have covered the clone installation approach. Next, we willinstall everything.

Building and installing the project dependencies

If you installedWebdriverIO from an existing project, this is where we continue. We need to build the project before we can run our first test. From the Terminal, typethe following:

> yarn install

This will bring in all the associated packages to run the project. Sometime in the future, vulnerabilities may occur and we will have to update our packages. We can use Yarn to check which packages are current and whichare outdated:

> yarn outdated

The output can be seen in thefollowing screenshot:

Figure 2.10 – Displaying the outdated package

Figure 2.10 – Displaying the outdated package

Incompatibility could occur if we upgrade all packages blindly. Fortunately, there is the yarn upgrade command, which allows the packages to beupgraded individually:

> yarn upgrade-interactive

We will see thefollowing output:

Figure 2.11 – Interactive package list for upgrading

Figure 2.11 – Interactive package list for upgrading

This gives us the most flexibility when we’re keeping our project packages upto date.

Quick tip

If you want to clear the Terminal, use cls in Windows or Ctrl + K or clearon Mac.

After the installation, the yarn.lock file will be updated and the node_modules folder will have all the supporting dependencies downloaded. This contains the expanded list of packages, which has been included to support the packages in package.json. Theyarn.lock file will never need tobe edited.

At this point, we should point out that the WebdriverIO setup assumes that a novice user may not know what to do to bring in all thesupporting packages:

Figure 2.12 – WebdriverIO with TypeScript successfully installed

Figure 2.12 – WebdriverIO with TypeScript successfully installed

Lastly, we can confirm theversion of WebdriverIOthat is installed with theversion flag.

ForWindows users:

> npx wdio --version

ForMac users:

> wdio --version

We made it! All the supported features have been added to the package.json file. WDIO even gives us a hint to try out our first test –npmrun wdio:

Figure 2.13 – WebdriverIO gives us a hint on how to run the first test

Figure 2.13 – WebdriverIO gives us a hint on how to run the first test

This has set up WebdriverIO and created a sample test that can be executed with the followingyarn command:

> yarn wdio

This results in thefollowing output:

Figure 2.14 – Output of yard command

Tests can also be executed by running a command. Let’s take a look at the options for both Windowsand Mac:

ForWindows users:

> npx wdio run test/wdio.conf.ts

ForMac users:

> wdio run test/wdio.conf.ts

All the test examples can be found in this book’s GitHubrepository:https://github.com/PacktPublishing/Enhanced-Test-Automation-with-WebdriverIO.

This runs the sample tests with basic output detail to the Terminal window from thespecReporter window:

Figure 2.15 – Pass results shown in the spec report from the sample WDIO test

Figure 2.15 – Pass results shown in the spec report from the sample WDIO test

Now that wehave set up our project, either by answering the initialconfiguration questions or cloning an existing project, we are ready to look at the configurations and filesettings of our new WDIOautomation project:

Figure 2.16 – All project files

Figure 2.16 – All project files

This will display all the files and folders in the project. There are quite a lot of them, so we will cover the important ones here. Open theREADME.mdfile first.

For any project, theREADME file is the best place to start. It gives us critical information about how the project is configured, its features, and, most importantly, how to quick-start asample test.

Next, open thepackage.json file.

This is where much of theNode.jsconfiguration occurs:

Figure 2.17 – All devDependancies in the wdio project

Figure 2.17 – All devDependancies in the wdio project

What is theyarn.lock file?

Theyarn.lock filecontains the full list of required project packages, includingones that support other packages in package.json. It is massive, but don’t worry – you will never have to change it. Yarn Package Manager handles all ofthis. Whew!

Let’s run Yarn Package Manager with theinstall command to get everything loaded and upto date:

> yarn install

This can be seen in thefollowing screenshot:

Figure 2.18 – Building the project using Yarn Package Manager

Figure 2.18 – Building the project using Yarn Package Manager

Making our first commit

Now that we have our first test running, it is time to bring it all to our fortress of solitude – by committing it to our local repo and then to theGitHub repository.

Ignoring files in the Git repository

Before we make our first commit to the Git repo, we need to ignore some files. Once we have set up our WDIO project, VS Code might suggest that thenode_modules folder should be included in thegitignore file:

Figure 2.19 – VS Code detects that the node_modules folder can be ignored

Figure 2.19 – VS Code detects that the node_modules folder can be ignored

We never want to commit this folder to our Git repo as it gets updated constantly by npm. Havingnpm create the folder contents on the fly with the most up-to-date versionsis better:

Figure 2.20 – GitHub Desktop indicates over 12,000 files to be committed to the new repo

Figure 2.20 – GitHub Desktop indicates over 12,000 files to be committed to the new repo

This is far more files thanwe need.

To tell Git toignore this project folder, simply create a.gitignore file in the root of the project and enter thenode_modulesfolder name:

Figure 2.21 – A .gitignore file contains files and folders that should not be committed

Figure 2.21 – A .gitignore file contains files and folders that should not be committed

The same goes for our Allure report and results folders. These files will be rebuilt repeatedly after each test and will not need to be under version control. Once these tests are run from Jenkins, prior runs can be preserved there temporarilyor permanently.

By simply adding and saving the.gitignore file, the list of fileschanges dramatically:

Figure 2.22 – The repo now only stores the files

Figure 2.22 – The repo now only stores the files

Once this.gitignore file is saved, we will see the changes reflected in GitHub Desktop with a manageable size of justeight files.

Tip

Never store passwords in the repo. A password should be provided by a secure data provider service such as Vault or AWS Secrets. If no such option exists, then a password file could be referenced in the folder above the project. Otherwise, storing such a credential file in the project requires adding it to the.gitignore filefor security.

One of the first bugs I found in my career was related to passwords. Here, the user had the option to reset their password with a random string of characters. This page would occasionally crash. The reason was that the requirement had the password generated from all 128 ASCII characters. This included BELL, unprintable characters, as well as ones that were difficult to type on the keyboard. The real problem was that this set included angle brackets (< and>). The page would only crash when a new password was generated with one of those two characters, as they were interpreted as opening or closing HTML tags onthe page.

There are tools that IT security uses to detect passwords in repos, but they often only check themain ormaster repos and ignore the laterfeature branches. This, too, is a security risk. Always clean up old branches, as this can be considered asecurity operations center (SOC) II compliance violation, even if the passwords have longsince expired.

We can now add a summary description and optional details. Simply clickCommit to main – all our new files will be committed to our localmain branch:

Figure 2.23 – Adding a comment and details to a local commit

Figure 2.23 – Adding a comment and details to a local commit

However, this is just stagedon our local Git repo. The final step is to clickPush origin, which will push it up to GitHub for our team topull down:

Figure 2.24 – GitHub Desktop shows that all changes have been committed and suggests pushing any new changes

Figure 2.24 – GitHub Desktop shows that all changes have been committed and suggests pushing any new changes

Congratulations! You have made your first commit to your Git repo. Your team members can now pull your changes to be sure all their tests arerunning smoothly.

But what if you need to add new functionality that will take a few daysto complete?

Branching out

To be a part of an automation team, you may be asked to add new and complex functionality. If this takes a few days, we might consider feature branching. A new branch is created frommain. Your changes will be committed to your branch, and changes frommain will be broughtin periodically:

Figure 2.25 – Adding a new branch in GitHub Desktop from main

Figure 2.25 – Adding a new branch in GitHub Desktop from main

When your changes are complete, a pull request will be made to pull your changes into themain branch, and thefeature branch maybe deleted.

For this book, the final state of the framework will be in a branch named after this chapter. Themain branch will contain thefinal project.

Summary

In this chapter, we installed WebdriverIO with several options added to a set of configuration questions. We also showed how Yarn can keep dependencies current. Lastly, we showed how to make a commit to the repo fromGitHub Desktop.

If you run into issues, check theAppendix at the end of this book. There, you will find a detailed list of common and arcane issues with causes, explanations, and resolutions. It also includes a node command cheatsheet for many of theseinitial processes.

In the next chapter, we will explore the files and connections in thewdio config file and look at different ways to debugour code.

Left arrow icon

Page1 of 4

Right arrow icon
Download code iconDownload Code

Key benefits

  • Improve your coding skills and empower your automation journey
  • Leverage self-healing objects and adaptive frameworks for cutting-edge WebdriverIO automation
  • Overcome script stability challenges and ensure robust, dependable test execution
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

This book helps you embark on a comprehensive journey to master the art of WebdriverIO automation, from installation through to advanced framework development.You’ll start by following step-by-step instructions on installing WebdriverIO, configuring Node packages, and creating a simple test. Here you’ll gain an understanding of the mechanics while also learning to add reporting and screen captures to your test results to enhance your test case documentation. In the next set of chapters, you’ll delve into the intricacies of configuring and developing robust method wrappers, a crucial skill for supporting multiple test suites. The book goes beyond the basics, exploring testing techniques tailored for Jenkins as well as LambdaTest cloud environments. As you progress, you’ll gain a deep understanding of both TypeScript and JavaScript languages and acquire versatile coding skills.By the end of this book, you’ll have developed the expertise to construct a sophisticated test automation framework capable of executing an entire suite of tests using WebdriverIO in either TypeScript or JavaScript, as well as excel in your test automation endeavors and deliver reliable, efficient testing solutions.

Who is this book for?

Whether you are a novice software development engineer in test (SDET) joining your first WebdriverIO automation project building test cases in TypeScript, or a seasoned lead framework architect experienced in solutioning daily test automation challenges, this book is for you. This book will also help developers and framework architects with basic knowledge of JavaScript or TypeScript who are looking to gain expertise in functional frontend testing. A basic understanding of CSS and XPath will help you get the most out of this book.

What you will learn

  • Discover techniques to efficiently maintain and enhance your Page Object Model, saving time and effort
  • Gain insight into diagnosing and resolving script instability issues to ensure reliable test execution
  • Improve test resilience by building objects that adapt to changing element locators
  • Enhance your testing productivity by learning to write effective test cases with TypeScript
  • Explore strategies for comprehensive result analysis to enable data-driven decision-making
  • Develop frameworks that adapt to evolving user journeys, ensuring long-term test sustainability

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date :Nov 30, 2023
Length:328 pages
Edition :1st
Language :English
ISBN-13 :9781837630486
Category :

What do you get with eBook?

Product feature iconInstant access to your Digital eBook purchase
Product feature icon Download this book inEPUB andPDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature iconDRM FREE - Read whenever, wherever and however you want
Product feature iconAI Assistant (beta) to help accelerate your learning
OR

Contact Details

Modal Close icon
Payment Processing...
tickCompleted

Billing Address

Product Details

Publication date :Nov 30, 2023
Length:328 pages
Edition :1st
Language :English
ISBN-13 :9781837630486
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99billed monthly
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconSimple pricing, no contract
€189.99billed annually
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts
€264.99billed in 18 months
Feature tick iconUnlimited access to Packt's library of 7,000+ practical books and videos
Feature tick iconConstantly refreshed with 50+ new titles a month
Feature tick iconExclusive Early access to books as they're written
Feature tick iconSolve problems while you work with advanced search and reference features
Feature tick iconOffline reading on the mobile app
Feature tick iconChoose a DRM-free eBook or Video every month to keep
Feature tick iconPLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick iconExclusive print discounts

Frequently bought together


Enhanced Test Automation with WebdriverIO
Enhanced Test Automation with WebdriverIO
Read more
Nov 2023328 pages
Full star icon5 (7)
eBook
eBook
€24.99€27.99
€34.99
Software Test Design
Software Test Design
Read more
Dec 2022426 pages
Full star icon4.9 (8)
eBook
eBook
€25.99€28.99
€35.99
€35.99
Software Testing Strategies
Software Testing Strategies
Read more
Dec 2023378 pages
Full star icon4.9 (9)
eBook
eBook
€22.99€25.99
€31.99
Stars icon
Total102.97
Enhanced Test Automation with WebdriverIO
€34.99
Software Test Design
€35.99
Software Testing Strategies
€31.99
Total102.97Stars icon

Table of Contents

18 Chapters
Chapter 1: The Utility Belt – Tools Every Superhero SDET NeedsChevron down iconChevron up icon
Chapter 1: The Utility Belt – Tools Every Superhero SDET Needs
Virgin machine setup
Rule of thumb – the hardware resources and access rights must match the development team
Installing Visual Studio Code for your operating system
X-ray vision – writing better code with Prettier, ESLint, and GitLens
Installing Chrome extensions
Installing WebdriverIO
Summary
Chapter 2: Fortress of Solitude – Configuring WebdriverIOChevron down iconChevron up icon
Chapter 2: Fortress of Solitude – Configuring WebdriverIO
WebdriverIO setup
Building and installing the project dependencies
Summary
Chapter 3: Cybernetic Enhancements – WebdriverIO Config and Debug TipsChevron down iconChevron up icon
Chapter 3: Cybernetic Enhancements – WebdriverIO Config and Debug Tips
The three main files of a WebdriverIO node project
Rule of thumb – match your developer’s hardware
Letting Yarn help keep files up to date
Configuring debugging with VS Code
Dynamic configuration
Our first custom wrapper method – global.log()
Rules to enforce coding standards
Summary
Chapter 4: Super Speed – Time-Travel Paradoxes and Broken PromisesChevron down iconChevron up icon
Chapter 4: Super Speed – Time-Travel Paradoxes and Broken Promises
Technical requirements
The time-travel dilemma
Schrödinger and the quantum mechanics of test automation
Callbacks, promises, and async/await
The death of fibers and synchronous mode
Summary
Chapter 5: Alter Egos – The ClickAdv WrapperChevron down iconChevron up icon
Chapter 5: Alter Egos – The ClickAdv Wrapper
Adding a helpers file
The “Hello, World!” of test automation
ES6 helper modules versus overriding intrinsic methods
Who tests the SDET’s code? Sanity testing of the automation framework
Extending our ES module helper file with a custom click method
Why are waits difficult to implement correctly?
Expanding the click method wrapper
Supercharged scroll before a click event
Expanding the click method wrapper
The importance of metrics
Self-healing elements
Stubbing out methods with the “alreadyFailed” switchboard key
Summary
Chapter 6: The setValue Wrapper – Entering Text and Dynamic Data ReplacementChevron down iconChevron up icon
Chapter 6: The setValue Wrapper – Entering Text and Dynamic Data Replacement
Normalizing the element type
Adding the setValue() method wrapper
Is this trip really necessary?
Coal into diamonds – replacing dynamic data tags
Injecting versus typing text into a field
Checking whether the field is pre-populated for speed
Behind the mask – SetValuePassword() to keep data secure
Putting it all together
Summary
Chapter 7: The Select Wrapper – Choosing Values in Lists and ComboboxesChevron down iconChevron up icon
Chapter 7: The Select Wrapper – Choosing Values in Lists and Comboboxes
Adding the base functionality of clickAdv() and setValueAdv() to selectAdv()
Selecting an item from the list
Selecting from a combobox
Inspecting a list that closes when it loses focus with SelectorsHub
Writing a locator that is an element inside a list
Summary
Chapter 8: The Assert Wrapper – the Importance of Embedded DetailsChevron down iconChevron up icon
Chapter 8: The Assert Wrapper – the Importance of Embedded Details
expect, assert, and should –how did we get here?
Timeout – delay of game
What are hard and soft expect assertions?
Introduction to Allure reports
Summary
Chapter 9: The Ancient Spell Book – Building the Page Object ModelChevron down iconChevron up icon
Chapter 9: The Ancient Spell Book – Building the Page Object Model
Technical requirements
What is Page Object Model?
What constitutes a good Page Object pattern?
Creating a page class for the tests
Adding object selectors
module.exports = new HomePage();Calling methods to be used in the test
Reducing code with common objects and methods
POM using Klassi-js
Summary
Chapter 10: Increased Flexibility – Writing Robust Selectors and Reducing MaintenanceChevron down iconChevron up icon
Chapter 10: Increased Flexibility – Writing Robust Selectors and Reducing Maintenance
Technical requirements
Reducing page object maintenance with generic selectors
Anatomy of an XPath selector
Leveraging data-qa and ARIA attributes
Writing an XPath element that contains a textual substring
Second chances – getting valid objects from stale selectors
Summary
Chapter 11: Echo Location – Skipping the Page Object ModelChevron down iconChevron up icon
Chapter 11: Echo Location – Skipping the Page Object Model
A reduced code base
Automation in plain English
Getting a visible button by name
Getting a visible field by name
Getting a visible list by name
Getting a visible element from a collection
Beware the endless rabbit hole!
Summary
Chapter 12: Superhero Landing – Setting Up Flexible Navigation OptionsChevron down iconChevron up icon
Chapter 12: Superhero Landing – Setting Up Flexible Navigation Options
Technical requirements
Using system variables
Adding data configuration files
Configuring Allure reporting
Summary
Chapter 13: The Multiverses – Cross-Browser Testing and Cross-Environment TestingChevron down iconChevron up icon
Chapter 13: The Multiverses – Cross-Browser Testing and Cross-Environment Testing
Horizontal scaling – cross-browser testing
Using built-in functionality via the wdio config file
Using LambdaTest online to automate the browser testing grid
Using Selenium Standalone server to locally build the testing grid
Avoiding the rabbit hole of horizontal scaling
Handling environment-specific logic
The multiverse – one test, two environments
Summary
Chapter 14: The Time-Traveler’s Dilemma – State-Driven End to End User JourneysChevron down iconChevron up icon
Chapter 14: The Time-Traveler’s Dilemma – State-Driven End to End User Journeys
Technical requirements
Divide and conquer!
Simplifying the complexities of a dynamic journey
The happy path
Changing decision points
Wash, rinse, repeat
Why not generate these Artifacts with API calls?
Summary
Chapter 15: The Sentient Cape – Running Tests in a CI/CD Pipeline with Jenkins and LambdaTestChevron down iconChevron up icon
Chapter 15: The Sentient Cape – Running Tests in a CI/CD Pipeline with Jenkins and LambdaTest
Technical requirements
What are Jenkins and Slack?
Installing OpenJDK for Jenkins
Installing Jenkins as a standalone application
Installing Jenkins
Creating a WebdriverIO project with Jenkins
Installing the Jenkins plugin for LambdaTest
Creating a freestyle project and job
Reporting in Slack from Jenkins
On-demand and scheduled suite runs
Types of debugging runs with Jenkins
CI/CD pipeline
Summary
EpilogueChevron down iconChevron up icon
Epilogue
IndexChevron down iconChevron up icon
Index
Why subscribe?
Other Books You May EnjoyChevron down iconChevron up icon
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book

Recommendations for you

Left arrow icon
Debunking C++ Myths
Debunking C++ Myths
Read more
Dec 2024226 pages
Full star icon5 (1)
eBook
eBook
€20.99€23.99
€29.99
Go Recipes for Developers
Go Recipes for Developers
Read more
Dec 2024350 pages
eBook
eBook
€20.99€23.99
€29.99
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (68)
eBook
eBook
€26.98€29.99
€37.99
€37.99
Asynchronous Programming with C++
Asynchronous Programming with C++
Read more
Nov 2024424 pages
Full star icon5 (1)
eBook
eBook
€22.99€25.99
€31.99
Modern CMake for C++
Modern CMake for C++
Read more
May 2024504 pages
Full star icon4.7 (12)
eBook
eBook
€26.98€29.99
€37.99
Learn Python Programming
Learn Python Programming
Read more
Nov 2024616 pages
Full star icon5 (1)
eBook
eBook
€20.99€23.99
€29.99
Learn to Code with Rust
Learn to Code with Rust
Read more
Nov 202457hrs 40mins
Video
Video
€56.99
Modern Python Cookbook
Modern Python Cookbook
Read more
Jul 2024818 pages
Full star icon4.9 (21)
eBook
eBook
€28.99€32.99
€41.99
Right arrow icon

Customer reviews

Top Reviews
Rating distribution
Full star iconFull star iconFull star iconFull star iconFull star icon5
(7 Ratings)
5 star100%
4 star0%
3 star0%
2 star0%
1 star0%
Filter icon Filter
Top Reviews

Filter reviews by




Paul M. GrossmanDec 14, 2023
Full star iconFull star iconFull star iconFull star iconFull star icon5
The media could not be loaded. I used this book to learn more about Typescript, Yarn and Node.It has 15 chapters that start from basic installation, through intermediate method wrappers to advanced test execution from Jenkins and LambdaTest. It includes extras in each chapter. The Click method utilizes a unique object count to determine when the page build is completed. The setValue() chapter shows how to implement a tag that is replaced by a future or past date in multiple formatting. The select() chapter addresses both lists and combo boxes.It covers other tools including SelectorsHub for writing robust element selectors. It features self-healing techniques. This can find elements when the class type or property has changed. This reduces maintenance time as scripts can try to find elements on the fly.It also has an advanced loop technique that can move through User Journeys even when the order of the pages changes without writing and maintaining hundreds of bespoke tests.Lastly it features small code snippets that can mask passwords, highlight elements and output colored text to the console. It also describes how to resize a browser so that the output can be seen at the same time as a test run even on a small single monitor. This helps debug analysis at run time.And there are some real life stories the authors share that are entertaining.
Amazon Verified reviewAmazon
Somesh OjhaJan 29, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
I have just started reading this book and already convinced that this book isna must have for anyone who in capacity enthusiastic about Test Automation. Game changer is the code examples which makes it more interesting. Loving it so far.
Amazon Verified reviewAmazon
Sri Priya PJan 31, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
The book is drafted with clear practical examples with source code. The overall final thoughts on the book is authors have articulated the book to help the SDETs and Automation Testers to enhance the Test Automation skills. Even the complex concepts are explained in an easy way with step by step approach.
Amazon Verified reviewAmazon
Matthew R. HeusserJan 12, 2024
Full star iconFull star iconFull star iconFull star iconFull star icon5
The media could not be loaded. It's rare that you find a book that -A) Covers a tool in depth,B) Said tool will last and not get out of date,C) Gives you advice on how to deal with complex installs,D) Tells you how to deal with the common problems you'll have using the tool (such as wait states and concurrency),E) Gives advice on how to integrate the work into your build pipeline.If you're anything like me, (D) is the slog, where you end up going down blind alleys and trying things you read on stackoverflow and crossing your fingers. This happens on install too, and, come to think of it, upgrade on just about every version of every dependency of the framework.I found this book well-written, easy to read, and actually addresses my concerns with a new framework. Of particular value is the Appendix "The ultimate guide to TypeScript error messages, causes, and solutions", to prevent google-and-stackoverflow driven development.Two weeks ago, when it came to books printed on paper that get into the specifics of a tool framework, I'm afraid I couldn't recommend any.Today I can recommend one.If you want to get started writing code to drive a browser in JavaScript, this is your book. Five stars. Buy it today.
Amazon Verified reviewAmazon
LarryGDec 18, 2023
Full star iconFull star iconFull star iconFull star iconFull star icon5
With its superhero theme, this book is for newbies and advance users alike, well written and fully recommended
Amazon Verified reviewAmazon
  • Arrow left icon Previous
  • 1
  • 2
  • Arrow right icon Next

People who bought this also bought

Left arrow icon
50 Algorithms Every Programmer Should Know
50 Algorithms Every Programmer Should Know
Read more
Sep 2023538 pages
Full star icon4.5 (68)
eBook
eBook
€26.98€29.99
€37.99
€37.99
Event-Driven Architecture in Golang
Event-Driven Architecture in Golang
Read more
Nov 2022384 pages
Full star icon4.9 (11)
eBook
eBook
€26.98€29.99
€37.99
The Python Workshop Second Edition
The Python Workshop Second Edition
Read more
Nov 2022600 pages
Full star icon4.6 (22)
eBook
eBook
€27.99€31.99
€38.99
Template Metaprogramming with C++
Template Metaprogramming with C++
Read more
Aug 2022480 pages
Full star icon4.6 (14)
eBook
eBook
€25.99€28.99
€35.99
Domain-Driven Design with Golang
Domain-Driven Design with Golang
Read more
Dec 2022204 pages
Full star icon4.4 (19)
eBook
eBook
€23.99€26.99
€33.99
Right arrow icon

About the authors

Left arrow icon
Profile icon Paul M. Grossman
Paul M. Grossman
LinkedIn iconGithub icon
Paul M. Grossman is a test automation framework architect, project manager, and conference speaker with a love of stage magic. Since 2001, he has worked with numerous toolsets, including WebdriverIO in TypeScript, Selenium in Java, OpenText UFT in VBScript, and WinRunner in C++. He advocates for low-code automation tools for manual testers, including testRigor. He is also the creator of the CandyMapper sandbox website, where he invites novice users to try their hand at automating common challenges.
Read more
See other products by Paul M. Grossman
Profile icon Larry C. Goddard
Larry C. Goddard
LinkedIn iconGithub icon
Larry C. Goddard, aka “LarryG,” is the creator of Klassi-js. He boasts a stellar career as an award-winning test automation framework architect, mentor, career coach, and speaker since 2000. His expertise spans diverse toolsets, including AI, ML, WebdriverIO, JavaScript, TypeScript, and Selenium. With a profound journey across aviation, software testing, and telecommunications sectors, he has also lent his technical prowess to a major fashion house and served as an expert witness for an international law firm. He's a father of five, an ex-international rugby player for Trinidad and Tobago, ex-military, and a certified physical training instructor.
Read more
See other products by Larry C. Goddard
Right arrow icon
Getfree access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook?Chevron down iconChevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website?Chevron down iconChevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook?Chevron down iconChevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support?Chevron down iconChevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks?Chevron down iconChevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook?Chevron down iconChevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.


[8]ページ先頭

©2009-2025 Movatter.jp