I am new for testing Angular js app with Protractor. I have a submit button on click of it, Toaster Message gets pop up on window.
Button to submit is below.
<button title="Add the Expense Claim" ng-show="addExpDetailsShow" class="btn btn-primary btn-sm" ng-click="addExpenseDetails()">Add</button>
Toaster div is as below
<div class="toast-top-right" id="toast-container"><div style="" class="toast toast-error"><button class="toast-close-button">×</button><div class="toast-message">Select Expense Type.<br>Amount should be between 0.10 to 100000000.</div></div></div>
Now i need to validate whether the toaster is displayed or not and need to validate toaster message. I am using jasmine to write my test case. By googling i wrote below code .
it('adding expense', function(){
element(by.xpath(".//*[@id='navbar-collapse']/ul[1]/li[2]/a")).click();
element(by.xpath(".//*[@id='main-container']/div[1]/div/div/div[3]/div/button[1]")).click();
element(by.css('[ng-click="addExpenseDetails()"]')).click();
toast = $$('.toast toast-error');
browser.manage().timeouts().implicitlyWait(1000);
expect(toast.getAttribute('value')).toEqual('some value');
expect(toast.isDisplayed()).toBe(true);
});