trueautomation
v0.3.10
Published
TrueAutomation.IO Client
Downloads
2
Readme
TrueAutomation.IO Client
The purpose of this application is wrap Chrome Driver and proxy all JSONWire protocol requests. Application intercepts /element and /elements requests and use advanced location algorithm if specified.
How it works
Object is found by initial locator during the first run. We use advanced html tree and attributes analyzing algorithm which can find the object even if locator has been changed (id/classes are regenerated or HTML slightly changed).
ChromeDriver Wrapper
The node application that runs ChromeDriver and wraps it to intercept required requests.
Prerequisites
The basic requirement is node 9+ with npm installed. The best way to get proper environment is install node via nvm.
To install nvm for your platform please follow instructions here.
When you have nvm installed run nvm install stable
to install the latest version of node.
TrueAutomation.IO Clent installation
- Checkout project from git
- From the source folder run
npm install
to download and install dependecies. ChromeDriver will be installed automatically
Run ChromeDriver wrapper
Just run from the source folder node index.js
.
Webdriver.IO Tests
Example tests based on webdriver.io. Located in examples/webdriverio
Getting ready
cd examples/webdriverio
npm install
Running tests
npm run test
Adding new test
We are using mocha framework to create tests. All specs are located at specs
directory. You can use exampleTest.js
as the reference for your tests.
Using smart locators
In order to use TrueAutomation Smart Locators replace your locator with the following object: { locator: 'initialLocator', name: 'true:automation:name' }
We suggest you to use namespaced names for your object. Like projectName:pageName:moduleName:objectName
Initial locator is used to locate object for the first time. If you change initial locator value object will be rewritten.
Example
Original: The following code would be broken if id of the element is changed.
browser.setValue(
'mauticform_input_trialformemailonly_email',
'[email protected]'
);
TrueAutomation version: The following code would be fine even if id is eliminated or changed after the first run.
browser.setValue({
locator: "mauticform_input_trialformemailonly_email",
name: 'educatorio:trial:email'
}, '[email protected]');
Capybara Tests
Example tests based on capybara. Located in examples/capybara
Getting ready
Capybara requires ruby 2.3+. You can use rvm to install required ruby version.
cd examples/capybara
bundle install
Running tests
bundle exec rake
Adding new test
We are using rspec framework to create tests. All specs are located at specs
. You can use example_spec.rb
as the reference for your tests. All test files should match *_spec.rb
pattern.
Using smart locators
There is a special helper ta(name, locator)
defined in spec/support/true_automation_helpers.rb
.
In order to use TrueAutomation Smart Locators copy this helper into your project and use ta(ta_name, locator)
instead of your locators. Example find(:xpath, ta('true:automation:name', '//initialLocator'))
.
We suggest you to use namespaced names for your object. Like projectName:pageName:moduleName:objectName
Initial locator is used to locate object for the first time. If you change initial locator value object will be rewritten.
Example
Original: The following code would be broken if id of the element is changed.
find('#mauticform_input_trialformemailonly_email').set('[email protected]')
TrueAutomation version: The following code would be fine even if id is eliminated or changed after the first run.
find(ta('educatorio:trial:email', '#mauticform_input_trialformemailonly_email')).set('[email protected]')