If inside a spec file, protractor specific code, which needs to be executed inside a control flow, is not put under beforeEach(), afterEach(), beforeAll(), afterAll() or it(), the rule should produce an error.'
Example of a violation:
describe('clicking loging out button', function () {
browser.sleep(2000);
element(by.css('[href="/account/signout"]')).click();
it('should redirect to account page', function () {
expect(browser.getCurrentUrl()).toEqual('https://localhost:44311/account');
});
it('should display a signed out message', function () {
expect(element(by.css('text-success')).getText()).toEqual('You have successfully signed out');
});
});
See how browser.sleep(2000); and element(by.css('[href="/account/signout"]')).click(); are right under the describe.