After writing a protractor test for an Angular application with a non-angular login page, I decided to include the login process in a separate file using
browser.waitForAngularEnabled(false);
.
I then created a describe block with a series of it blocks to test different aspects of the application. However, I encountered a problem where the first it block always failed. Even after deleting the body and running it again, I still received a misleading error message:
- NoSuchElementError: No element found using locator: By(css selector, *[id="Username"])
.
Interestingly, this error actually related to the login feature, which had passed successfully at that point. I was left wondering what could be causing this issue.
Here is the structure of my code:
describe("Test Cases in first feature ", () => {
//login via non angular application
login.SignIn(settings.usercredentials.LocalUser.userName, settings.usercredentials.LocalUser.password);
it("dummy tc", () => {
});
it("New Mission Creation", () => {
main_dashboard_page.newItem("mission");
});