Hi,
for every test I am doing a login in setup and a logout in teardown.
It seems like the next test is started, while doing the logout for the test before. So the next setup is failing for the next test. The next whole test is also failing.
Do you know how to avoid this behavior?
Thank you and best regards,
Support Forum
Hi,
Sorry for delay, can you post some code? You probably call the callback from the "tearDown" method too early.
Sorry for delay, can you post some code? You probably call the callback from the "tearDown" method too early.
Read the API documentation
Hi,
no problem. I just moved my logout method to the end of the testfiles as long as I can't resolve it.
This is the code:
In the logoutUser() method I only click the logout button.
no problem. I just moved my logout method to the end of the testfiles as long as I can't resolve it.
This is the code:
tearDown: function(callback, errback) {
this.describe('Teardown', function(t) {
t.it('Logout user', function(t) {
t.logoutUser();
t.waitForLoginWindow();
});
});
callback();
}
Right, you call the `callback` in the "tearDown" immediately. Instead, the "callback" should be called after the "logoutUser" method (which is also asynchronous I suppose). Assuming your "waitForLoginWindow" method also accept the callback, code may look like:
tearDown: function(callback, errback) {
this.describe('Teardown', function(t) {
t.it('Logout user', function(t) {
t.logoutUser();
t.waitForLoginWindow(function () {
callback();
});
});
});
}
Read the API documentation
Thank you. But now I do not know how to call the callback correctly in the waitForLoginWindow method.
Code looks like this:
Code looks like this:
waitForLoginWindow: function() {
this.it('Wait for login window', function(t) {
t.chain(
{
waitForComponentVisible: loginWindow,
desc: 'Wait for login window is visble'
},
// some other waitFor actions
);
});
}
Call it as the last action in the chain (not right after the chain):
Wrong:
Right:
Wrong:
waitForLoginWindow: function(callback) {
this.it('Wait for login window', function(t) {
t.chain(
{
waitForComponentVisible: loginWindow,
desc: 'Wait for login window is visble'
},
// some other waitFor actions
);
callback() // called immediately, before the 1st action in the chain starts
});
}
waitForLoginWindow: function(callback) {
this.it('Wait for login window', function(t) {
t.chain(
{
waitForComponentVisible: loginWindow,
desc: 'Wait for login window is visble'
},
callback
);
});
}
Read the API documentation
If you can provide a reproducible test case, we'll investigate, hard to say anything otherwise.
Read the API documentation