siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
134 lines (114 loc) • 5.55 kB
JavaScript
var project = new Siesta.Project.Browser()
project.configure({
title : 'Siesta generic browser examples',
viewDOM : true,
// Define any global JS and CSS dependencies, these files will be injected into each test.
preload : [],
recorderConfig : {
// enable/disable certain features of the recorder, see the Siesta.Recorder.Recorder documentation
recordMouseMoveOnIdle : true,
recordPointsOfInterest : true,
recordMouseMovePath : false,
recordScroll : false,
recordInitialWindowSize : false
}
});
project.plan(
// Sample setups for most popular Web frameworks
{
group : 'Web frameworks',
items : [
{
pageUrl : '../react-google-fonts-space/build/',
url : '../react-google-fonts-space/build/TRANSPILED/src/tests/blackbox-app/compare.t.js',
title : 'React app test'
},
// This app uses Object.assign w/o polyfills and does not work in IE11
bowser.msie ? null : {
pageUrl : '../vue-vuestic-admin-dashboard/dist/',
url : '../vue-vuestic-admin-dashboard/dist/tests/blackbox-app/sanity.t.js',
title : 'Vue app test'
},
// Browsers supporting custom components only
bowser.msie ? null : {
pageUrl : '../angular-web-components/',
url : '../angular-web-components/tests/sanity.t.js',
title : 'Angular web components test'
},
// Browsers supporting Polymer only
bowser.msie || bowser.msedge ? null : {
pageUrl : '../polymer-material-playground/',
url : '../polymer-material-playground/tests/sanity.t.js',
title : 'Polymer material components test'
}
]
},
// Start here, and learn the basic unit testing functionality in Siesta
{
group : 'Unit tests',
autoCheckGlobals : true,
sandbox : false, // speeds it up, sharing the same iframe for tests in this group
expanded : false,
items : [
'1.unit-tests/basic_assertions.t.js',
'1.unit-tests/async_code.t.js',
project.supportsArrowFunctions ? '1.unit-tests/returning_promise.t.js' : null,
project.supportsArrowFunctions ? '1.unit-tests/chain_step_with_promise.t.js' : null,
// sandboxing ecma module test, because of some weird failures in Chrome
project.supportEcmaModules ? { url: '1.unit-tests/ecma-module.t.js', isEcmaModule: true, sandbox : true } : null,
'1.unit-tests/todo_tests.t.js',
project.supportsArrowFunctions ? '1.unit-tests/wait_for.t.js' : null,
project.supportsArrowFunctions ? {
// uncomment to "snooze" any failures from this test till 2050 :)
//snooze : '2050-01-01',
url : '1.unit-tests/bdd.t.js'
} : null,
project.supportsArrowFunctions ? '1.unit-tests/spies.t.js' : null,
// A test descriptor can also be an object with `url` property and its own config options
{
// change the title of the corresponding row in the test grid
title : 'global variables leakage',
autoCheckGlobals : true,
url : '1.unit-tests/global_variables.t.js',
// change the description (tooltip) of the row
desc : 'This test exercises detection of the global namespace pollution'
},
// Siesta can also run a Jasmine test suite
{
title : 'Jasmine tests',
jasmine : true,
expectedGlobals : [ 'Player', 'Song' ],
// url should point to the specs runner html page in this case
url : '1.unit-tests/jasmine_suite/SpecRunner.html',
// a link to some external resource, can be activated with CTRL+click on the title
referenceUrl : 'https://www.bryntum.com/docs/siesta/#!/api/Siesta.Project.Browser-cfg-jasmine',
desc : 'This test shows how existing Jasmine test suite can be run with Siesta'
}
]
},
!project.isStandardPackage() ? null : {
group : 'Native events',
simulation : 'native',
expanded : false,
items : [
{
pageUrl : '8.native-events/native.html',
url : '8.native-events/010-native.t.js'
}
]
},
{
group : 'Misc',
expanded : false,
items : [
'6.misc/native-dialogs.t.js',
// it seems MS Edge does agressive "background page throttling" (timers are activated more rare)
// because of which this example may fail (the popup becomes the foreground page and the main page becomes background)
bowser.msedge ? null : {
simulation : 'synthetic',
url : '6.misc/popups.t.js'
}
]
}
)
project.start()