Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid "jasmine.suite() required" error message in protractor?

The code which I wrote for validation of the credentials on my login page is:

describe('Login',function() {
var loginURL;
var email=element(by.id("email"));
var password=element(by.id("password"));
var LoginButton=element(by.buttonText("Sign in"));
});


it('should redirect to login page',function() {
browser.get('https://pacific-meadow-5124-dev-test.herokuapp.com');
loginURL = browser.getCurrentUrl();``
expect(browser.getCurrentUrl()).toEqual(loginURL);
});

it('should warn on wrong/missing values',function(){
email.clear();
password.clear();

password.sendkeys('test');
loginButton.click();
expect(error.getText()).toMatch('missing email');

email.sendkeys('test');
loginButton.click();
expect(error.gettext()).toMatch('invalid email');

email.sendkeys('[email protected]');
password.clear();
loginButton.click();
expect(error.getText()).toMatch('missing password');
});

it('should accept a valid email address and password', function() {
    email.clear();
    password.clear();

    email.sendKeys('[email protected]');
    password.sendKeys('goalsr123');
    loginButton.click();
    expect(browser.getCurrentUrl()).not.toEqual(loginURL);
  });

I am not able to execute above code, getting an error saying that jasmine.suite() required as shown below:

Message:
     Error: jasmine.Suite() required
   Stacktrace:
     Error: jasmine.Suite() required
    at new jasmine.Spec (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protr
actor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2326:11)
    at jasmine.Env.it (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protrac
tor\node_modules\minijasminenode\lib\jasmine-1.3.`enter code here`1.js:966:14)
    at jasmine.Env.(anonymous function) [as it] (C:\Users\GOALSR3\AppData\Roamin
g\npm\node_modules\protractor\node_modules\minijasminenode\lib\async-callback.js
:26:50)
    at global.it (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protractor\n
ode_modules\minijasminenode\lib\index.js:15:29)
    at C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protractor\node_modules
\jasminewd\index.js:119:11
    at Object.<anonymous> (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\pro
tractor\example\Log_spec.js:9:1)

Finished in 0.018 seconds
1 test, 1 assertion, 1 failure

I tried to validate login but not able to validate with using protractor.

like image 901
Vicky Singh Gill Avatar asked Nov 10 '14 09:11

Vicky Singh Gill


2 Answers

you have to use first the jasmine function describe and enclose all your test inside:

describe('my test suite', function() {
    // Here all your it tests
})
like image 103
Ben Zalez Avatar answered Oct 20 '22 02:10

Ben Zalez


Put your it-blocks inside your describe-block.

like image 41
Olov Avatar answered Oct 20 '22 00:10

Olov