As a newcomer to Jasmine testing, I've been facing some challenges while running my tests. Specifically, I have been struggling with my webdriver closing the browser before it can check the '.detailsColumn'
element for expected results. After much trial and error, I discovered that using browser.wait can keep the browser active long enough for the element to be properly loaded.
Below is my most recent test version. However, I encountered an invalidSelectorError
without any indication of the line causing the issue. My gut feeling is that the problem lies in how I declared or used the detailsColumn
variable.
If anyone can spot what's wrong here, I would greatly appreciate the insight!
I am conducting my tests with Protractor/Jasmine and utilizing Selenium as my web driver.
it('Should display result summary correctly when searching for multiple articles only', function () {
var TrackID= ExpectedArticle1Details.TrackingID + ', ' + ExpectedArticle2Details.TrackingID;
landingPage.get();
landingPage.setTrackID(TrackID)
landingPage.clickTrackButton();
expect(resultPage.allElementsofLandingPageAreVisible()).toEqual(true);
expect(resultPage.allHeadersofResultsPageAreVisible()).toEqual(true);
browser.wait(function () {
var detailsColumn = protractor.By.css('.detailsColumn.status:eq(0)');
return browser.isElementPresent(detailsColumn).then(function (result) {
expect(result).toBe(true);
return result;
console.log(result);
});
}, 10000);