I would like to load a pageUrl only one time per group.
If I run the full group (not only a single test) I want to load the pageUrl only once (not for each test inside the group).
And if I run a single test, then the pageUrl should be loaded too.
Is that possible?
If not, how can I tell the tests to run one-after-another?
project.plan
project.plan({
group: 'Classes',
preload: [],
pageUrl: '../index.html',
items: [{
group : 'Actions',
items : ['Action.t.js']
}, {
group : 'LocaleProvider',
items : ['LocaleProvider.t.js']
}, {
group : 'Config',
items : ['Config.t.js']
}]
});
This is not possible. All tests are isolated from each other and should not re-use resources, the order of tests execution is not defined. This is to allow the parallel tests running, where tests that are later in the list can actually already be running in the other worker (thread).
You can achieve what you want with code re-use. Split your scenario into parts, every part can be presented with a test function. Create a library of such "sub-scenarios". Then in the actual test import the required "sub-scenarios" and execute them in the required order.
For example:
Lets say before every test you want to login into the system. You can create a function:
export const login = async (t) => { await t.click('login'); ... }`
and place it in some file `helpers.js`
Then, in the test file my_test.t.js
:
import { login } from 'helpers.js'
t.it('Testing something', async t => {
await login(t);
... do something else
})
You can also extend a test class and add helpers as class methods. Then you can do:
t.it('Testing something', async t => {
await t.login();
... do something else
})
See https://www.bryntum.com/docs/siesta/#!/guide/extending_test_class
Read the API documentation
Yes, if tests requires focus (pretty much all tests with type
) they need to be run sequentially, because focus can be only in one place.
Read the API documentation