I've encountered a problem in my JavaScript file where some of the test cases fail intermittently, and I want to rerun only those that have failed. Is there any feature or solution available that can help with this issue? It's quite frustrating and time-consuming to run everything again. Below is an example of how my spec looks like.
describe('Test -> Users table with admin privileges', function () {
var EC = protractor.ExpectedConditions;
var welcomePage = new WelcomePage();
var usersPage = new UsersPage();
beforeEach(function () {
LogIn.asAdmin1();
clickWithWait(welcomePage.usersButton);
browser.wait(hasNonZeroCount(usersPage.allRows), WAIT_TIMEOUT, 'users list did not appear');
});
afterEach(function () {
welcomePage.logout();
});
it('verifies counter on active tab', function () {
browser.wait(EC.elementToBeClickable(usersPage.allRows.first()), WAIT_TIMEOUT, 'firstRow was not visible ');
usersPage.allRows.count().then(function (count) {
expect(usersPage.activeTab.getText()).toContain('Active' + ' (' + count + ')');
});
});
it('verifies counter on archived tab', function () {
browser.wait(EC.elementToBeClickable(usersPage.allRows.first()), WAIT_TIMEOUT, 'firstRow was not visible ');
// Initial condition for case of none archived user have to be added here (it will remove if statement).
clickWithWait(usersPage.archivedTab);
usersPage.allRows.count().then(function (count) {
if (count > 0) {
expect(usersPage.archivedTab.getText()).toContain('Archived' + ' (' + count + ')');
} else {
console.log("Test Ignored due to none records")
}
});
});