WebdriverIO How to implement Page Object Model

Описание к видео WebdriverIO How to implement Page Object Model

ALL FREE COURSES ► https://automationstepbystep.com/
00:00 Intro
00:46 What is Page Object Model
03:04 Advantages of POM
03:22 DEMO How to implement POM in WebdriverIO Project
03:49 Sample demo application for testing
04:23 Sample Login test
16:20 Run demo test
16:54 Start of Page Object Model Implementation
17:08 Create class for each page
18:26 Create object locators in the login page class
21:24 Create functions for action on the objects
26:56 Refer the class in test script
30:30 Run POM test
33:06 Outro

What is POM
Design pattern to create Object Repository
A class is created for each page to identify web elements of that page
Also contains methods to do action on the objects
Separates test objects and test scripts

Advantages of POM
Makes code maintainable
Changes and updates are easier
Makes code reusable
Improves readability
Single Object Repository
Saves time and efforts
Avoid rework
Makes tests less brittle
New tests creation is easier and faster
Improves Overall quality and efficiency

Demo
How to implement Page Object Model
Step 1 - Create a class for each page
Step 2 - Create locators of all objects to be used in that page
Step 3 - Create methods or actions to be performed on the objects
Step 4 - Refer in the test scripts
Step 5 - Run and validate

class LoginPage

class LoginPage {
get username(){
return $('#username')
}
get password(){
return $('#password')
}
get loginButton(){
return $('button[type="submit"]')
}
get messageBox(){
return $('#flash')
}
async login(username, password){
await this.username.setValue(username)
await this.password.setValue(password)
await this.loginButton.click()
}
async checkLoginMessage(message){
await expect(this.messageBox).toHaveTextContaining(message)
}
}
module.exports = new LoginPage();

Login test
const LoginPage = require('../pageobjects/login.page')

describe('Demo Test', () => {
it('Login Test', async () => {
browser.url('https://the-internet.herokuapp.com/lo...)
await LoginPage.login('tomsmith', 'SuperSecretPassword!')
await LoginPage.checkLoginMessage('You logged into a secure area!')
})
})

ASK RAGHAV ► https://bit.ly/2CoJGWf

CI CD DEVOPS
JENKINS BEGINNER ► https://bit.ly/2MIn8EC
JENKINS TIPS & TRICKS ►https://bit.ly/2LRt6xC
JENKINSFILE ► https://bit.ly/3JSMSZ7
DOCKER ► https://bit.ly/2MInnzx
KUBERNETES ► http://bit.ly/2MJIlMK

UI TESTING
SELENIUM BEGINNERS ► https://bit.ly/2MGRS8K
SELENIUM JAVA FRAMEWORK ► https://bit.ly/2N9xvR6
SELENIUM PYTHON ► https://bit.ly/2oyMp5x
SELENIUM TIPS ► https://bit.ly/2owxc50
SELENIUM BUILDER ► https://bit.ly/2MKNtlq
SELENIUM 4 ► https://bit.ly/3AiJOlP

KATALON STUDIO ► https://bit.ly/2wARFdi
ROBOT FRAMEWORK with RIDE ► https://bit.ly/2Px6Ue9
ROBOT FRAMEWORK with Eclipse► http://bit.ly/2N8DZxb
PROTRACTOR ► http://bit.ly/2KtqVkU
ACCELQ ► https://bit.ly/3PlsAsh
TEST PROJECT ► http://bit.ly/2DRNJYE
CUCUMBER BDD ► https://bit.ly/3Cnno4z
CYPRESS ► https://bit.ly/3PpEukM
XPATH & WEB LOCATORS ► https://bit.ly/3PpEvoQ

API TESTING
WEB SERVICES (API) ► https://bit.ly/2MGafL7
SOAPUI ► https://bit.ly/2MGahmd
POSTMAN ► https://bit.ly/2wz8LrW
POSTMAN 2022 ► https://bit.ly/3JWm4qX
JMETER API TESTING ► https://bit.ly/3AgVPar
GENERAL ► https://bit.ly/2PYdwmV
KATALON STUDIO API ► https://bit.ly/2BwuCTN
REST ASSURED ► https://bit.ly/3zUdhRD
KARATE API ► https://bit.ly/3w3H5Ku
API MOCKING ► https://bit.ly/3bYPsjS

IDE
Visual Studio Code ► https://bit.ly/2V15yvt

PROGRAMMING
JAVASCRIPT ► http://bit.ly/2KJDZ8o
TYPESCRIPT ► https://bit.ly/3dvJBmz
MOCK INTERVIEWS ► https://bit.ly/3QGwwVJ ▬▬

RAGHAV PAL
GITHUB PROJECTS ► https://github.com/Raghav-Pal/


STORIES BY RAGHAV ► https://automationstepbystep.com/stor...
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

NEVER STOP LEARNING
Raghav Pal

Комментарии

Информация по комментариям в разработке