Environments
Similarly to page objects, environments can be set up to properly organize your desired environments. They may include different URLs and different users for each environment. They will be stored in a special file called oxygen.env.js

setting up our environments:

1
module.exports = {
2
3
TEST: {
4
url: 'https://test.app.com',
5
con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=test;',
6
username: 'testuser',
7
password: 'test123'
8
},
9
10
PREP: {
11
url: 'https://prep.app.com',
12
con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=prep;',
13
username: 'prepuser',
14
password: 'prep123'
15
}
16
17
}
Copied!
now that we've set them up, we can choose them by clicking on the settings icon on the top right
let's choose the PREP environment and use it in our script:
1
web.init()
2
web.open(env.url) // https://prep.app.com
3
4
db.setConnectionString(env.con_string)
5
6
web.type('id=username', env.username)
7
web.type('id=password', env.password)
Copied!
Last modified 7mo ago
Copy link