eslint-plugin-protractor icon indicating copy to clipboard operation
eslint-plugin-protractor copied to clipboard

Rule Proposal: warn if control flow functions are executed outside of jasmine

Open alecxe opened this issue 8 years ago • 0 comments

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.

alecxe avatar Dec 16 '16 15:12 alecxe