I've found the solution if anyone else is looking for it. Adding to @rjferguson21 's answer, the expect line should look like this:
expect(el.evaluate("someBinding")).toBe("Hello World");
I think that was an update in Protractor.
Question
If I have html like this:
<body>
<div id="menu">
<div id="button"> {{ someBinding }} </div>
</div>
</body>
and I have a statement in protractor like this:
ptor.findElement(By.xpath("/body/div[@id='menu']/div[@id='button']"));
What would I use to get the value of {{someBinding}}? It seems that protractor tries to compare the value with the binding name. So if I expect {{someBinding}} to say "Hello World" it throws an error saying that
Expected: {{someBinding}} to equal 'Hello World'
Solution 2
I've found the solution if anyone else is looking for it. Adding to @rjferguson21 's answer, the expect line should look like this:
expect(el.evaluate("someBinding")).toBe("Hello World");
I think that was an update in Protractor.
OTHER TIPS
I think you need to call .getText() on the element.
el = ptor.findElement(By.xpath("/body/div[@id='menu']/div[@id='button']"))
so your entire statement would be:
expect(el.getText()).toBe('Hello World');
I would also consider using a different locator, such as the CSS locator if you are using ids, or have a look at the binding locator.
https://github.com/angular/protractor/blob/master/docs/api.md#webdriverwebelementprototypegettext https://github.com/angular/protractor/blob/master/docs/api.md#protractorbyprototypebinding
Note that you don't have to use xpath selection for this. Try binding locator:
var el = element(By.binding('someBinding'));
expect(el.getText()).toBe('Hello World');