Repository navigation
Expand file tree
/
Copy pathsection_21_notes.txt
More file actions
33 lines (24 loc) · 1.61 KB
/
Copy pathsection_21_notes.txt
File metadata and controls
33 lines (24 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Page Object Model(POM)
1. POM can be broken up into three phases:
Phase 1
-------
Centralizing Selectors
Improving our Existing Commands
Phase 2
-------
Creating Seperate POM Classes
Link Test with POM Classes
Directly call POM Commands via Tests
Phase 3
-------
Centralizing all Selectors & Commands inside the POM Class(further Abstraction)
Simplifying Tests by applying all concepts from Phase 1, 2 & 3
--------------------------------------------------------------------------------
Phase 2 - Creating Seperate Classes - Create a new folder in the root directory and call it 'pageObjects'. To centralize our
resourses, we will create a class file in the new folder and move our selectors and other reusuable resources in this file using 'get' method.
After creating the file with get methods, we will update our 'wdio.conf.js' file. In the 'specs' object modify the path to read './tests/*.js' and
in the 'exclude' object add the new path to './pageObjects' folder with files, 'pageObjects/*_Page.js'. Go to the new file we creatd, 'ContactUs_Page.js'
and at the end add 'module.export = new ContactUs_Page();' so we can use this file in our project. In the 'contactUsTest.js' file, remove unecessary
selectors and add 'var ContactUs_Page = require("./pageObjects/ContactUs_Page.js");' at the top of the file. On the method located inside the decribe
block on the 'contactUsTest.js' file, we will remove the 'browser.setValue()' and replace it with 'ContactUs_Page.firstname.setValue()'.
Phase 3 - In the 3rd pahse, we cetralize all selectors and commnds inside the POM class and simply the test by applying all concepts.