I am at the moment attempting to get WebDriverIO working with Appium and Mocha (BDD) in the direction of an Android gadget. Beforehand once I’ve labored with Mocha the conduct has been that testcases are remoted from eachother and must be constructed to be impartial from eachother. When doing this in WDIO nonetheless I can’t appear to determine how you can reset state between particular person assessments.
See following instance:
// Capabilities can have began app at this level and this isn't actual code
describe('Auth', async () => {
it('Login', async () => {
const username = await $('#username');
const password = await $('#password');
const loginButton = await $('#loginButton');
await username.addValue('consumer');
await password.addValue('move');
await loginButton.click on();
});
// I would like the app to reset right here.
// In any other case I should create this take a look at
// based mostly on the results of the earlier take a look at
// which can cascade throughout each single take a look at
// on this describe-block and provide no flexibility in
// including extra assessments right here.
it('Logout', async () => {
// Studying the code inside right here supplies no readability in
// the way it works because the majority of this take a look at is completed
// within the login take a look at because it does not reset
const logoutButton = await $('#logoutButton');
await logoutButton.click on();
});
// I would like the app to reset right here once more
// In any other case this take a look at NEEDS to be beneath
// the logout take a look at or above the login take a look at
// OR I can create this take a look at to logout from
// the state the place earlier take a look at left app
// however it is going to be actually laborious to grasp
// what this code does with out following each
// single take a look at earlier than it.
it('Forgotten Password', async () => {
// Doing issues
});
});
What’s inflicting my challenge right here? Am I basically misunderstanding how you can construction these assessments and make it work correctly in follow? Do I’ve to construction the person assessments in a describe-block in such a means that they "observe the circulation"? I’ve a number of issues I might need to do on this describe block which are associated to auth however observe a distinct method, and creating them right here would simply be taking a extremely bizarre path across the app to press issues.
Please let me know if you’d like me to make clear my ideas!