As you know, karma testing runner couldn't run E2E testcases for web site which isn't based on AngularJS. If your site is using AngularJS, just ignore this project and choose ng-scenario
.
Choose Mocha
as your testing framework, and then set up karma-e2e-dsl
in frameworks array as well. Remember to add karma-e2e-dsl
to package.json
file.
module.exports = function(config) {
config.set({
basePath: './',
frameworks: ['mocha', 'karma-e2e-dsl'],
// list of files / patterns to load in the browser
files: [
'./should.js',
'./testSpec.js',
],
exclude: [
],
proxies: {
'/app/': 'http://localhost:8000/'
},
/* the rest of configurations */
});
};
Go to the path which is relative to current path.
Refreshes the currently loaded page in the test frame.
Delay to execute the callback
in duration
milliseconds.
Sleep for duration
milliseconds.
Pause the execution of running testcases.
Resume the execution of running testcases.
Manually set up waiting for page load.
Returns the window.location.pathname of the currently loaded page in the test frame.
Returns the window.location.href of the currently loaded page in the test frame.
Returns the window.location.hash (without #) of the currently loaded page in the test frame.
Returns the window.location.search of the currently loaded page in the test frame.
Enters the given value
in the text field with the corresponding selector
.
Check the checkbox with the corresponding selector
.
Unheck the checkbox with the corresponding selector
.
Select the radio button with the corresponding selector
.
Click the element with the corresponding selector
.
Return true if the checkbox is checked.
Return true if the radio button is selected.
Return true if the element is selected.
Picks the option with the given value on the select with the given selector.
Return the selected value of option.
Picks the options with the given values on the multi select with the given selector.
Return the selected values of options.
Simple implementation of input
and dropdownlist
, both of two methods are element
.
Executes the function fn(selectedElements), where selectedElements are the elements that match the given jQuery selector and done is a function that is called at the end of the fn function.
Returns the result of calling method on the element matching the given jQuery selector, where method can be any of the following jQuery methods: val, text, html, height, innerHeight, outerHeight, width, innerWidth, outerWidth, position, scrollLeft, scrollTop, offset.
Executes the method passing in value on the element matching the given jQuery selector, where method can be any of the following jQuery methods: val, text, html, height, innerHeight, outerHeight, width, innerWidth, outerWidth, position, scrollLeft, scrollTop, offset.
Returns the result of calling method passing in key on the element matching the given jQuery selector, where method can be any of the following jQuery methods: attr, prop, css.
Executes the method passing in key and value on the element matching the given jQuery selector, where method can be any of the following jQuery methods: attr, prop, css.
Matchers are used in combination with the expect(...) function as described above and can be negated with not(). For instance: expect(element('h1').text()).not().toEqual('Error').
// value and Object comparison following the rules of angular.equals().
expect(value).toEqual(value)
// a simpler value comparison using ===
expect(value).toBe(value)
// checks that the value is defined by checking its type.
expect(value).toBeDefined()
// the following two matchers are using JavaScript's standard truthiness rules
expect(value).toBeTruthy()
expect(value).toBeFalsy()
// verify that the value matches the given regular expression. The regular
// expression may be passed in form of a string or a regular expression
// object.
expect(value).toMatch(expectedRegExp)
// a check for null using ===
expect(value).toBeNull()
// Array.indexOf(...) is used internally to check whether the element is
// contained within the array.
expect(value).toContain(expected)
// number comparison using < and >
expect(value).toBeLessThan(expected)
expect(value).toBeGreaterThan(expected)
Copyright (c) 2013 Wang Qiu ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.