Check you webpages through webbrowser. It's something similar to Selenium or CodeException.
You can implement this simple and lightweight jquery plugin into your pages and run automatic tests of UI.
Tests results could be shown either in browser's console or in HTML DOM's layer.
timeout
float default =0
number of milliseconds (!) for timeout between tests / stepsoutput
string ['console', 'window'] default =console
where to output results of the testschild
boolean default =false
if page, where the script is involved, is supposed to be tested,child
option should be set totrue
to avoid initialization of the script, when page is loaded normally in browser.break_on_error
boolean default =false
whether pause testing after any test was failed
- Main page
var uatObj;
$(document).ready(function(){
uatObj = $(document).uat({
output: 'window'
});
});
- Children pages
$(document).ready(function(){
$(document).uat({
child: true
});
});
.contains (string: selector, boolean expected)
whether document contains element selected byselector
or not.sourceContains (string selector, string content, boolean expected)
whether element selected byselector
containscontent
or not.sourceEqualsTo (string selector, string content, boolean expected)
whether element selected byselector
has exactly the same HTML content ascontent
or not.hasCookie (string: cookieName, boolean: expected)
whether document has cookie withcookieName
or not.cookieValue (string cookieName, string cookieValue, boolean expected)
whether cookie withcookieName
exists and its value equals tocookieValue
or not.isObjVisible (string: selector, boolean: expected)
whether object selected byselector
is visible on the current window area or not.hasJsVariable (string variableName, boolean expected)
whether document has JS variable withvariableName
or not.valueEqualsTo (string: selector, string: value)
whether value of object selected byselector
equaled tovalue
.hasAttribute (string: selector, string: name)
whether object selected byselector
has attribute with specifiedname
.checkExpectedUrl ()
whether current location is equaled to previsouly setup with.waitForUrl()
method
These tests can be applied to any field (select
, input
, button
, textarea
).
In case of multiple select or checkbox / radio input, test will check every selected / checked object.
.findObj (string: selector)
moves current caret to the object by selector id
NOTE: when you run any test after.findObj
, caret will be returned to the root object (with which plugin was initialized) after test is done.resetObj ()
resets the object, previously found in.findObj
method.setCookie (string: cookieName, mixed: cookieValue)
sets new cookie (or updates existing) with the passedcookieValue
.
IfcookieValue
is an object, then you can specify optional parameterscookieValue.value
string|number - actual value of the cookiecookieValue.expires
number - in how many seconds cookie will expirecookieValue.domain
string - specific domain with leadingdot
symbolcookieValue.path
string - specific path option
.removeCookie (string: cookieName)
removes cookie by its name.scrollToObj (string: selector, number: extra)
scrolls the page to the position equaled to the.offset().top
coordinate of the object, found by selector.
NOTE: You can add some pixels by passingextra
argument, which is integer by default..appendTo (string selector, string|object content)
appends any html or jquery object to the parent, found byselector
.fillIn (string: selector, mixed: value)
Fills any object by selector with specified value.clickBy (string: selector)
clicks by any object (calls trigger).wait (number: ms)
waits for passed milliseconds before the next test / step. It could be helpful, if you called.clickBy
method, which uses some animation, and then you would like to check for instance,.isObjVisible
.redirectTo (string: url)
redirects current page to another URL in order to proceed with tests
NOTE: each page should include .js file of plugin in order to be initialized after DOM is loaded.formSubmit (string selector)
submits the form by given selector.setAttribute (string selector, string name, string value)
sets specifiedvalue
to attribute withname
for object found byselector
.waitForUrl (string url)
set specifiedurl
as expected url for further test.checkExpectedUrl()
You can combine tests, save them to testSet
and run repeatably with variable parameters.
.beginTestSet (string testName)
will start new testSet with specifiedtestName
recording
NOTE: if testSet with specified name is already exist, then method will do nothing. Does not matter, was specified testSet commited or not..commitTestSet
will commit (finish) testSet with specifiedtestName
, if it exists (started and not commited yet).involveTestSet (string testName, object overwrittenParams)
will repeat commited testSet with opportunity to overwrite some parameters for some tests.
See example below.
- Simple testSet
uatObj
.removeCookie('my_cookie') // remove cookie just to test to be passed
.beginTestSet('usual') // start record new testSet
.contains('.my-class')
.hasCookie('my_cookie', false)
.commitTestSet() // save testSet
.redirectTo('http://my.anotherdomain.com/anypage.html') // goto another page
.involveTestSet('usual') // this will run 2 tests actually (contains and hasCookie)
.finish();
- TestSet with overwritten parameters
uatObj
.beginTestSet('usual')
.contains('.my-class')
.hasCookie('my_cookie', false, 'check_my_cookie') // label check_my_cookie was added for this test
.commitTestSet()
.redirectTo('http://my.anotherdomain.com/anypage.html')
.setCookie('my_cookie', 'anyvalueforcookie')
.involveTestSet('usual', {
'check_my_cookie': ['my_cookie', true] // since we set cookie after redirection, it will be existed (expected param should be true, otherwise test will fail)
})
.cookieValue('my_cookie', 'anyvalueforcookie') // just to check, that cookie has proper value
.finish();
CTRL + ALT + U
toggle (show / hide) output layer in the browser's windowCTRL + ALT + R
reset UAT window position / dimensions to defaultCTRL + ALT + S
stop tests, which are already runCTRL + ALT + G
run tests from the start (goto
)CTRL + ALT + P
pause / resume testsCTRL + ALT + C
clean console
- Implementing
.waitFor
method for waiting for appearing of some objects - Restoring tests' configurations with JSON format
- Adding initialization options, like
step_by_step
,break_on_error
- Manage inline options on-the-fly inside UAT window
- 1st simple demo with
.contains
and.notContains
methods, output to window - 2nd simple demo with
.contains
and.notContains
methods, output to console - 3rd complex demo with different methods and redirections
- 2.1.0
Unreleased yet - 2.0.0
Release date: 3th August, 2018 - 1.0.1
Release date: 3th July, 2018 - 1.0
Release date: 30th June, 2018 - RC1.0
Release date: 25th June, 2018