Environment setup and customization
Setup
The setup for the UI automation tests is similar to the setup for the regular metadata unit tests and uses the same infrastructure.
You will need to include the latest Selenium WebDriver in your in third-party folder.
- For developers, this setting already defaults to the directory specified by the eclipse classpath variable
THIRD_PARTY. - Otherwise, specify a root folder which contains all folders prefixed with
selenium-webdriver-*from\sv-build-file\3rd Party\packages.
General procedure for automation
- Create or find the appropriate
.utestfile in your finance or relevant project. - Launch the AFL portal.
- Use the automation recorder (Ctrl + F11) to perform the use case you want to automate.
- Export the recorded script.
- Add assertions.
- Run the tests in the unit test player, and make fixes if they fail.
- Once the tests pass, have your code reviewed.
Customizations
The following table represents the properties NexJ uses to customize the UI test runs in NexJ Finance Portal.
| Property | Description | Default Value |
|---|---|---|
uitest.alarmsEnabled | Enables alarms during tests. -Dnexj.uitest.alarmsEnabled=true | false |
uitest.browsers | The list of valid browser types, defined in the properties file. | IE, CH, FF |
uitest.chrome.binary | Location of the chrome application if not default. -Dnexj.uitest.chrome.binary="C:\\Java\\chrome-81.0-win32-x64\\chrome.exe" | null |
uitest.defaultBrowser | The browser type. | CH |
uitest.hangTestFail | If set to true, the automation will stop on a failure and hang the test thread. This allows debugging of browser and application server at a failure point.
| false |
uitest.headless | Runs the test in headless mode. | true |
uitest.locale | Sets browser locale. The following runs the tests in French: | Default system language |
uitest.maximumWait | The regular action timeout for a Selenium wait in milliseconds. | 5000 |
uitest.pageLoadTimeout | The initial page load duration timeout in milliseconds. | 60000 |
uitest.screenshotDir | Root folder that screenshots should be stored into. | null |
uitest.screenshotsEnabled | Take a screenshot when the test is completed. | Defaults to true if uitest.screenshotDir is specified, or false otherwise. |
uitest.staticDelay | Adds a static delay in milliseconds between each action. This is to help with debugging or help setting a baseline delay for working with third party applications. Generally recommended to not exceed 500ms due to it's impact on overall test run times. If more delay is needed, seek alternatives.
| 0 |
uitest.time | Sets the time used by the automation application for actions. -Dnexj.uitest.time="2022-01-06 07:00:00" | null |
uitest.timezone | Sets the timezone used by the automation application for actions. -Dnexj.uitest.timezone="America/Toronto" | null |
uitest.webdriverDir | Path to the executable web driver file. A setting controlled by NexJ Studio preferences. This is the only required setting to run UI automation. | |
| Whitelisted host URLs to allow testing public and private IPs together. Can also be added through environment file property | host URL (eg: my.nexj.local) |
To change any of these property values from NexJ Studio Tool Settings:
- Select Window > Preferences > NexJ Studio > Launch Settings > Tool Settings > Run Unit Tests.
- In the VM arguments field, enter:
-Dnexj.[property] = value