-
Notifications
You must be signed in to change notification settings - Fork 0
08 Assertions
Biswajit Sundara edited this page Feb 23, 2021
·
2 revisions
Protractor tests use Jasmine framework for testscript management and assertions.
const { element } = require("protractor");
describe('Protractor Practice Project', function () {
it('Jasmine Assertion Demo', function () {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
element(by.model('first')).sendKeys('5');
element(by.model('second')).sendKeys('3');
element(by.id('gobutton')).click();
//Jasmine takes care of the promise, so we can directly perform assertion
expect(element(by.css("h2[class='ng-binding'")).getText()).toBe("8")
//If we want to assert the value and do something more with it
element(by.css("h2[class='ng-binding'")).getText().then((result) => {
expect(result).toEqual("8");
console.log(result);
})
});
});