Classes
Namespaces
Methods
-
<static> cancelRun()
-
Cancel current global test run execution
- See:
-
<static> context()
-
Returns the current test context, the window/iframe used to execute the tests
- See:
-
- hobs.setContext to learn how to set/change the context
Properties:
Name Type Description hobs.context()
object The context object.
Properties
Name Type Description window
window The test window object.
document
document The document object of the test window.
loadEl
DOMElement The DOM Element embedding the test window (should be an iframe).
Returns:
An object containing context properties (window, document, loadEl)
- Type
- object
-
<static> find(selector [, context])
-
Look for a DOM element in the current test window. Wraps a jQuery search
Parameters:
Name Type Argument Default Description selector
string jQuery selector of the element to look for in the DOM of the test window
context
Array | HTMLElement <optional>
hobs.context().document Array of selectors in hierarchical order determining root context where the search for the given element will take place (default hobs.context().document)
Returns:
jQuery The list of elements found
-
<static> getRegisteredTestSuites()
-
REMARK: by default, a hobs.TestSuite is automatically registered to Hobbes on instantiation
Returns:
All the registered test suites in array
- Type
- Array.<hobs.TestSuite>
-
<static> getTestSuites()
-
REMARK: by default, a hobs.TestSuite is automatically registered to Hobbes on instantiation
Returns:
All the test suites in array
- Type
- Array.<hobs.TestSuite>
-
<static> log()
-
Polyfill log function
Parameters:
Type Argument Description string <repeatable>
- See:
-
- hobs.config.debug To enable/disable debug logging
-
<static> navigate(url [, options])
-
Makes the test window/iframe navigate to the given url
Parameters:
Name Type Argument Default Description url
string target URL (absolute or relative)
options
object <optional>
false If set to true, it will only check url, otherwise it will do both, if object is an integer {hobs.NAVIGATE_CHECKONLY|hobs.NAVIGATE_SKIPCHECK} accessibility via a HTTP GET request. The test window will not navigate
Fires:
-
<static> param(name [, value])
-
Parameters:
Name Type Argument Description name
string The name of the dynamic parameter to set/get
value
* <optional>
If not null, the parameter of the given name will be set to this value. If null, The value of the given param will be returned
-
<static> registerCustomActions(ns, actions)
-
Register custom test actions under a specific namespace
Parameters:
Name Type Description ns
string Namespace name to add in chaining process of hobs.TestCase
actions
Array.<hobs.TestStep> Array of actions to add under the given namespace
-
<static> result()
-
Returns:
The result object of the last call of hobs.runTest
- Type
- object
-
<static> runTest( [testSuite] [, testCase] [, options])
-
Execute registered tests.
Parameters:
Name Type Argument Description testSuite
string <optional>
Name or UUID of the test suite to execute
testCase
string <optional>
Name or UUID of the test case to execute
options
object <optional>
Extra options passed to the execution
Examples
hobs.runTest() // or hobs.runTest(null, null)
hobs.runTest('testsuite name')
hobs.runTest('testsuite name', 'testcase name')
// Assuming you have a TestSuite that contains following TestCase: new hobs.TestCase("tc1", { metadata: { "flaky": true }}) // The metadata object can be used later to filter the tests to be run hobs.runTest(null, null, { "withMetadata": { "flaky": { "value": false, "type": "include" } } })
// Similarly to the previous example, it can be excluded using exclude type. hobs.runTest(null, null, { "withMetadata": { "flaky": { "value": true, "type": "exclude" } } })
// In some cases, resuming tests execution from a specific point can help (i.e after a browser crash etc..) // Based on the same logic as for path filter option, the resume option uses the test path. hobs.runTest(null, null, { resumePath: "/a/b/c" }) // As a result test execution will start right after the /a/b/c test.
// Assuming you have a large set of TestSuites that contains sub TestSuites which contains TestCases. // If you need to run only a specific set of TestCases that belong to different sub TestSuites, // the path filter will help. // Following is an example of 2 level TestSuites: var ts1 = new hobs.TestSuite("ts#1"); ts1.add(new hobs.TestCase("tc#1")); ts1.add(new hobs.TestCase("tc#2")); ts1.add(new hobs.TestCase("tc#3")); // inner testsuite var ts2 = new hobs.TestSuite("ts#2"); ts2.add(new hobs.TestCase("tc#4")); ts2.add(new hobs.TestCase("tc#5")); ts2.add(new hobs.TestCase("tc#6")); ts1.add(ts2); hobs.runTest(null, null, { "withPaths": [ { "path": "/ts1/tc1", "type": "include" }, { "path": "/ts1/tc3", "type": "include" }, { "path": "/ts1/ts2", "type": "include" }, { "path": "/ts1/ts2/tc5", "type": "exclude" } ] }) // As a result only TC#1, TC#3, TC#4, and TC#6 are executed.
-
<static> setContext(ctx)
-
Defines the test context, the window used to execute the tests.
Parameters:
Name Type Description ctx
window | iframe The window or iframe object where the tests will be executed
- See:
-
- hobs.context to get the current test context
Events
-
CONTEXT_NAVIGATION_LOAD
-
Navigation event.
- See:
-
CONTEXT_NAVIGATION_LOAD_ERROR
-
Navigation error event.
- See:
Properties:
Name Type Description xhr
Object XML Http Request object