ics-e2e
v1.12.8
Published
e2e test library based on selenium-webdriver
Downloads
4
Readme
E2E Runner
Installation
npm install -g ics-e2e
Configuration file config.yml
url: http://someurl.com # URL to tested application
path: some/root # Path to e2e home directory (<HOME>); current directory is used if omitted
extender: mdt.js # extender module for application (optional)
browser: # browser settings
name: chrome # chrome / edge / firefox / ie
device: # mobile emulation
name: iPhone 6 # mobile device name
window:
width: 1200
height: 900
screenshot:
enabled: true # save screenshots
percentage: 0 # allowed mismatch between reference and current screenshot (test will be failed if number is higher)
wait: MS # wait before saving screenshot (milliseconds)
ref: true # create reference screenshots mode
reportServer:
port: # port, used by report server (default 8013)
Operation
Configuration file config.yml
must exists in directory where app is executed
- all tests from
<HOME>/tests
are executed
e2e
- only specified script is executed (relative path to
<HOME>/tests
)
e2e <filename.yaml>
- interactive mode, user can execute commands using console
e2e -i
- execute script and watch for changes in it
e2e -w <filename.yml>
e2e -v
- execute script and generage result report
Test creation
- create file
testname.yml
ortestname.yaml
in test directory (<HOME>/tests
) - file structure
<settings>
<commands>
Settings
config: # (optional)
path: pos/brand # relative URL path to the path in config.yaml
readonly: true # mock.restore will be executed after test suite execution; false is default
xxx: yyy
... # all params except path and readonly will be passed in query string
Commands
Parameters with space(s) must be enclosed in quotes.
- click selector
- dblclick selector
- input selector sequence
sequence can contain special keys in curly braces, e.g.:
"{control}a{delete}".
SHIFT, CONTROL, ALT have state and are in pushed state:
- key is encountered again in sequence
- {null} encountered
- end of sequence
- type sequence
- swipe x,y speed
- sleep time
- clear selector
- exists? selector
- value? selector value
- with selector
- reload reload
- pause
- screenshot name
- mock action param1 param2 ...
Special selectors
@Name
- is an alias for[code=Name]
Examples:
- click "div.actions @clear-filters" # the same as "div.actions [code=clear-filters]"
- click "a@form-opener" # the same as "a[code=form-opener]"
Special keys
- {help}
- {back_space}
- {tab}
- {enter}
- {shift}
- {control}
- {alt}
- {escape}
- {space}
- {page_up}
- {page_down}
- {end}
- {home}
- {arrow_left}, {left}
- {arrow_right}, {right}
- {arrow_down}, {down}
- {arrow_up}, {up}
- {insert}
- {delete}
- {numpadX}, X is 0 to 9
- {fX}, X is 1 to 12
- {add}
- {multiply}
- {subtract}
- {divide}
Include
Tests can be included in another test using command #include "path/to.yaml"
. It can be done in any line of a test.
Example:
File controls_test.yaml
contains
- click @Open
#include "controls/input.yaml"
#include "controls/datepicker.yaml"
#include "controls/textarea.yaml"
#include "controls/checkbox.yaml"
- click @Close
All included tests will be executed in order of appearance
Examples
config:
path: pos/brand
login: system
skip intro: // step name, screenshot is saved after each step
- click a.btn-skip // click element a.btn-skip
cart:
- input input.login [email protected] // type text in input field
- input input.password 222
- click a.sign-in
- input input[name='House'] "777{enter}" // type '777' and press ENTER
- clear input.login // clear input field
- dblClick @Row // double click on element [code='Row']
- type "some string" // type text in current field
intro:
- swipe .intro -200,0 500 // swipe left 200 pixels with speed 500 px/sec
- sleep 500 // sleep for 500 ms
- click a.btn-skip
- exists? a.btn-skip // check that element exists
- pause // pause execution, user can execute any command from console
// type "resume" to continue
- value? input.login user2mail.ru // check that value of the field is user2mail.ru
#include "path/to.yaml" // include path/to.yaml
order:
- mock login system // exec mock.login('system') (mock must be defined in tested app)
- with .very-long-selector // parent selector is set and is valid to the end of current step
- click .btn1 // ".very-long-selector .btn1"
- click .btn2 // ".very-long-selector .btn2"
- reload // reload page