1.0.5 • Published 6 years ago
atheliumjs v1.0.5
Atheliumjs setup guide
- Run the command to install atheliumjs npm install atheliumjs
- Run the command to install atheliumjs webdriver io npm install atheliumjs webdriverio --save-dev
- Run the command to install atheliumjs puppetter npm install puppeteer --save-dev
- Open the command prompt and move to the folder where config.json exists.
- Run
npx atheliumjs init
in the command prompt and finish the initail setup with the directory structure. - In the
config.json
file, update 'name' flag to the corresponding folder name. - Start selenium standalone server by running
selenium-standalone start
in another command promp. - Run the test using
npx atheliumjs run --steps
. - If tests succeed, you are good to go.
Page Objects
Create json files under PageObjects directory. sample Json File. - LoginPageObject.json
[ {
"class": "TextField",
"locator": {
"id": "USERNAME",
"tag_name": "input"
},
"name": "username"
},
{
"class": "TextField",
"locator": {
"id": "PASSWORD",
"tag_name": "input"
},
"name": "password"
},
{
"class": "Button",
"locator": {
"id": "loginbutton",
"tag_name": "button"
},
"name": "login"
}
]
Code Generator Generated Page Class
Run the command `npx atheliumjs gpo`.
Page Object Code Generator plugin will get all JSON files from /main/PageObjects folder and generate the page class file as shown below snippet in the main/Pages/ directory.
Page class will have the default action functions for their respective web elements defined in the json file.
Auto Generated Page Class file for LoginPageObject.JSON to LoginPage.js
const BaseUtils = require('atheliumjs/main/base/baseclass.js')
class loginPage extends BaseUtils {
constructor(I){
const path = "./main/PageObjects/loginPageObject.json";
super(I);
this.I = I;
this.locators = this.getLocators(path);
}
setUsernameTextField(usernamevalue){
this.I.fillField(this.locators.username,usernamevalue)
}
getUsernameTextFieldValue(){
this.I.grabTextFrom(this.locators.username)
}
clearUsernameTextField(){
this.I.clearField(this.locators.username)
}
checkUsernameTextFieldValue(){
this.I.seeInField(this.locators.username)
}
waitForUsernameTextFieldVisible(){
this.I.waitForVisible(this.locators.username)
}
setPasswordTextField(passwordvalue){
this.I.fillField(this.locators.password,passwordvalue)
}
getPasswordTextFieldValue(){
this.I.grabTextFrom(this.locators.password)
}
clearPasswordTextField(){
this.I.clearField(this.locators.password)
}
checkPasswordTextFieldValue(){
this.I.seeInField(this.locators.password)
}
waitForPasswordTextFieldVisible(){
this.I.waitForVisible(this.locators.password)
}
clickLoginButtonElement(){
this.I.click(this.locators.login)
}
waitForLoginButtonVisible(){
this.I.waitForVisible(this.locators.login) }
}
module.exports = loginPage;
{
"tests": "./test/Login_test.js",
"timeout": 60000,
"output": "./output",
"helpers": {
"WebDriver": {
"url": "http://localhost",
"browser":"chrome",
"smartWait": 60000
}
},
"include": {
"I": "./steps_file.js"
},
"plugins": {
"wdio": {
"services": ["selenium-standalone"]
},
"screenshotOnFail": {
"enabled": true
},
"autoDelay": {
"enabled": true
},
"allure": {"enabled": true}
},
"bootstrap": false,
"mocha": {},
"tests": "./test/Login_test.js",
"timeout": 60000,
"name": "codeceptjsDemo"
}