OXYGEN
HomeGitHubReleasesCommunity
  • Welcome to Oxygen
  • About
    • What is Oxygen?
    • Getting Started (Videos)
      • Oxygen IDE Controls Overview
      • Recording a Web Test
      • Oxygen Commands Explained
    • Getting help
  • Download and work with Oxygen
    • Download & Installation
      • Oxygen IDE Installation
      • Oxygen for Mobile Installation
      • Oxygen for Windows Desktop Automation Setup
      • Oxygen for Mac Installation
        • Mac Installation Troubleshooting
      • Oxygen CLI Installation
      • Java Installation Instructions
      • Recording Troubleshooting
    • Start working with Oxygen
      • Getting Started - Web
        • Introduction - Web Testing
        • Recording a Web Test
        • Creating a Web Test
        • Sample Project - Web Test
      • Getting Started - Mobile
        • Introduction - Mobile Testing
        • Recording a Test on Mobile
        • Creating a Test - Mobile
        • Sample Project - Mobile
      • Getting Started - Oxygen for Windows Desktop Automation
      • Getting Started- Oxyge CLI
        • Running a Test Script on Windows
        • Running Multiple Tests (Suites) on Windows
    • Oxygen Modules
      • assert
      • date
      • db
      • email
      • eyes
      • http
      • log
      • mailinator
      • mob
      • pdf
      • proxy
      • serial
      • shell
      • soap
      • twilio
      • utils
      • web
      • win
    • Test Parameters
  • Cloud Providers
    • Sauce Labs
    • Lambda Test
    • TestObject
  • Advanced programming in Oxygen
    • Project Configuration
    • Locating Elements
    • Page Objects
    • Environments
    • Code Components
Powered by GitBook
On this page

Was this helpful?

  1. Download and work with Oxygen
  2. Start working with Oxygen
  3. Getting Started - Web

Sample Project - Web Test

PreviousCreating a Web TestNextGetting Started - Mobile

Last updated 4 years ago

Was this helpful?

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 environments, different URLs, usernames, connection string for each environment, which can be later used by selecting the environment inside oxygen settings.

oxygen.po.js, which includes all the page objects, locators, functions, etc.

Simple web test example from scratch

Let's start by creating a folder and inside it creating the oxygen.env.js and defining our environments

module.exports = {

    TEST: { 
        url: 'https://test.wikipedia.org',
        db_con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=test;'
        username: 'test.user',
        password: 'test123'
    },

    PROD: {
        url: 'https://wikipedia.org',
        db_con_string: 'Driver={SQL Server};Server=DESKTOP\\SQLEXPRESS;Database=prod;',
        username: 'username',
        password: 'password'
    },

}

Now let's create the oxygen.po.js file

module.exports = {
    
    searchPage: {
        searchInput: 'id=searchInput',
        searchButton: '//button[@type="submit"]'
    },
    
    search: (item) => {
        web.type(po.searchPage.searchInput, item)
        web.click(po.searchPage.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: ['web', 'log', 'assert'],

    reporting: {
        reporters: ['html', 'json']
    },

}

And now let's create a folder with our test scripts, our first test will be searching for Selenium in Wikipedia

Don't forget to choose an environment

web.transaction('01. Initialize')
web.init()

web.transaction('02. Open Wikipedia Main Page')
web.open(env.url)

web.transaction('03. Seach For Selenium')
po.search('Selenium')

web.transaction('04. Assert Results')
web.assertTextPresent('Selenium')

The following repository is provided as a sample project.

https://github.com/oxygenhq/oxygen-examples-angie