I am encountering an issue within the beforeEach function of my test class. Sometimes, clicking on the usersTab works fine, but other times it results in a StaleElementReferenceException. I have experimented with using protractor.ExpectedConditions such as presenceOf, visibilityOf, and elementToBeClickable, but none of them have provided a 100% solution. It seems that the problem may be related to asynchronous behavior where the browser attempts to click before waiting. Is this a possibility? Can anyone suggest how to handle this situation?
var OnePage = require('../pages/one_page.js');
var SecondPage = require('../pages/second_page.js');
describe('Test', function () {
var onePage;
var secondPage;
var EC = protractor.ExpectedConditions;
beforeEach(function () {
browser.ignoreSynchronization = true;
onePage = new OnePage();
browser.wait(EC.presenceOf(onaPage.userLogin), 5000);
onePage.setUser('login@login');
onePage.setPassword('password');
onePage.login();
secondPage = new SecondPage();
browser.wait(EC.visibilityOf(secondPage.usersTab), 10000);
usersPage.usersTab.click();
});
I am utilizing jasmine:2 and protractor:2.2.0.