Sample Project - Mobile
Similarly to web, a project should include 3 core files:
oxygen.conf.js, which includes the project configuration, this file contains the tools for the project such as which modules to use, creating suites to run multiple scripts, reporting type, etc.
oxygen.env.js, which includes the versions, different configurations, usernames, connection strings etc.
oxygen.po.js, which includes all the page objects, locators, functions, etc.

Let's start by creating a folder and inside it creating the oxygen.env.js and defining our app settings
module.exports = {
test_version_9: {
username: 'user',
password: 'pass',
con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;',
capabilities: {
"deviceName": "ad071702170f42d9a0",
"platformVersion": "8.0.0",
"platformName": "Android",
"appPackage": "clalit.android",
"appActivity": "clalit.android.MainActivity",
"automationName": "UIAutomator2",
"noReset": false
}
},
prod_version_9: {
username: 'user',
password: 'pass',
con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;',
capabilities: {
"deviceName": "ad071702170f42d9a0",
"platformVersion": "9.0.0",
"platformName": "Android",
"appPackage": "clalit.android",
"appActivity": "clalit.android.MainActivity",
"automationName": "UIAutomator2",
"noReset": false
}
},
}
Now let's create the oxygen.po.js file
module.exports = {
loginScreen: {
usernameInput: 'id=app.android:id/user',
passwordInput: 'id=app.android:id/pass',
loginButton: 'id=app.android:id/login_button',
},
searchScreen: {
searchInput: 'id=app.android:id/search_input',
searchButton: 'id=app.android:id/search_button',
},
searchUser: (name) => {
mob.type(po.searchScreen.searchInput, name)
mob.click(po.searchScreen.searchButton)
}
}
Finally let's create the oxygen.conf.js file
module.exports = {
suites: [{
name: 'End to End tests',
cases: [
{ path: './Scripts/01. ' },
{ path: './Scripts/02. ' },
{ path: './Scripts/03. ' },
]
}],
modules: ['mob', 'log', 'assert'],
reporting: {
reporters: ['html', 'json']
},
}
And now let's create a folder with our test scripts
Don't forget to choose an environment

mob.transaction('01. Initialize')
mob.init(env.capabilities)
mob.transaction('02. Type username & password')
mob.type(po.loginScreen.usernameInput, env.username)
mob.type(po.loginScreen.passwordInput, env.password)
mob.transaction('03. Login')
mob.click(po.loginScreen.loginButton)
mob.transaction('04. Search User')
po.searchUser('Tony')
mob.transaction('05. Assert Results')
mob.assertText('android.view.View[2]/android.widget.UserText', 'Tony')