Enhanced Test Automation with WebdriverIO Unlock the Superpowers of Hybrid Testing Frameworks

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 y...

Descripción completa

Detalles Bibliográficos
Otros Autores: Grossman, Paul M., author (author), Goddard, Larry C., author, Jones, Angie, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England : Packt Publishing Ltd [2023]
Edición:First edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009785404706719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • Dedication
  • Foreword
  • Contributors
  • Table of Contents
  • Preface
  • 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 Node.js and npm
  • Alternate node package managers - Yarn versus npm
  • Configuring the coding environment with GitHub Desktop
  • GitHub and the GitHub Desktop tool
  • Getting a GitHub account
  • Installing GitHub Desktop
  • Choosing your TypeScript development environment - Microsoft Visual Studio Code versus JetBrains Aqua
  • Installing Visual Studio Code for your operating system
  • Initializing the Node project
  • Configuring Visual Studio Code
  • X-ray vision - writing better code with Prettier, ESLint, and GitLens
  • Installing Visual Studio Code add-ons - Prettier
  • Installing Visual Studio Code add-ons - GitLens
  • Installing Visual Studio Code add-ons - ESLint
  • Installing Chrome extensions
  • Adding the SelectorsHub Chrome extension
  • Adding the EditThisCookie Chrome extension
  • Pinning Chrome extensions to the browser title bar
  • Installing WebdriverIO
  • Summary
  • Chapter 2: Fortress of Solitude - Configuring WebdriverIO
  • WebdriverIO setup
  • Option 1 - cloning WebdriverIO from a boilerplate project
  • Building and installing the project dependencies
  • Making our first commit
  • Summary
  • Chapter 3: Cybernetic Enhancements - WebdriverIO Config and Debug Tips
  • The three main files of a WebdriverIO node project
  • The package.json file
  • The yarn.lock file
  • The wdio.conf.ts file and webhooks
  • Rule of thumb - match your developer's hardware
  • Letting Yarn help keep files up to date
  • Configuring debugging with VS Code
  • browser.debug()
  • Dynamic configuration
  • A note about template strings.
  • Reducing the signal-to-noise ratio
  • Our first custom wrapper method - global.log()
  • Rules to enforce coding standards
  • Strict mode
  • Turning on individual TypeScript subset rule checks
  • CodeGPT
  • Summary
  • 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
  • Keep it simple with async and await
  • Summary
  • Chapter 5: Alter Egos - The ClickAdv Wrapper
  • Adding a helpers file
  • The "Hello, World!" of test automation
  • ES6 helper modules versus overriding intrinsic methods
  • Overriding intrinsic element methods
  • Adding a custom element method
  • 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?
  • "I don't always use Pause(), but when I do, It's less than 1000 milliseconds"
  • Highlighting elements
  • 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 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
  • Detecting and masking passwords in your output
  • Putting it all together
  • Summary.
  • 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
  • Using selectByVisibleText
  • Using selectByAttribute
  • Using selectByIndex
  • 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 Details
  • expect, assert, and should -how did we get here?
  • What is Jasmine?
  • What is Jest?
  • What is Chai?
  • Timeout - delay of game
  • What is expect-webdriverio?
  • What are hard and soft expect assertions?
  • Putting it all together
  • What are soft assertions and why would we need them?
  • Soft asserts - allowing a test to continue after an assertion fails
  • Introduction to Allure reports
  • Summary
  • 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
  • // LoginPage.ts
  • // HomePage.ts
  • module.exports = new HomePage()
  • Calling methods to be used in the test
  • // TestName.ts
  • Reducing code with common objects and methods
  • POM using Klassi-js
  • Project structure
  • Cucumber feature files
  • Page objects
  • Cucumber step definitions
  • Running tests
  • Summary
  • Chapter 10: Increased Flexibility - Writing Robust Selectors and Reducing Maintenance
  • Technical requirements
  • Reducing page object maintenance with generic selectors
  • Anatomy of an XPath selector
  • Relative selectors
  • Node test functions - text() versus normalize-space()
  • Broken strings
  • Leveraging data-qa and ARIA attributes
  • Finding an element only by text.
  • Writing an XPath element that contains a textual substring
  • Finding an element relative to another element
  • Case-insensitive partial matches
  • Finding only visible elements
  • Second chances - getting valid objects from stale selectors
  • Self healing techniques
  • On thin ice
  • Summary
  • Chapter 11: Echo Location - Skipping the Page Object Model
  • A reduced code base
  • Automation in plain English
  • Getting a named button
  • Getting a named input field
  • Getting a named list
  • 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 Options
  • Technical requirements
  • Using system variables
  • Adding data configuration files
  • Where data is stored for test use
  • Organizing test data
  • Setting up TypeScript configuration
  • Reading data from files
  • Using test data in tests
  • Beyond masking - making confidential data invisible
  • Spec and Allure - cub reporter versus star journalist
  • Configuring Allure reporting
  • Adding custom comments to the Allure report
  • Webhooks and screen captures
  • Summary
  • 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
  • Extending the wdio config file so that it supports multiple browsers
  • Handling browser-specific issues
  • Test responsiveness
  • Using LambdaTest online to automate the browser testing grid
  • Live interactive testing
  • Automated screenshot testing
  • Using Selenium Standalone server to locally build the testing grid
  • Cross-environment testing with a shared configuration file
  • 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 Journeys
  • Technical requirements
  • Divide and conquer!
  • Simplifying the complexities of a dynamic journey
  • The happy path
  • The big driver loop
  • It's all in the details
  • 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 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
  • Configuring LambdaTest using Jenkins
  • Creating a freestyle project and job
  • Parameterizing
  • Reporting in Slack from Jenkins
  • Adding the Slack notifications plugin to Jenkins
  • Adding the Jenkins CI app to Slack
  • Adding the post-build Slack action
  • On-demand and scheduled suite runs
  • Types of debugging runs with Jenkins
  • Additional suite categories
  • Linking Allure reports to a Jenkins run
  • CI/CD pipeline
  • What is continuous testing?
  • What does a CI/CD pipeline look like?
  • Code repository
  • CI
  • Artifact generation
  • Deployment
  • CD
  • Continuous feedback
  • Jenkins for CI/CD
  • Summary
  • Appendix: The Ultimate Guide to TypeScript Error Messages, Causes, and Solutions
  • Problem: Install default WDIO settings by passing "--yes" parameter still asks configuration questions
  • Problem: Missing script "wdio".
  • Problem: "node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.".