fix(e2e): adds events to hello world static.

Extends e2e test to cover events.
This commit is contained in:
Rado Kirov
2015-01-14 16:49:19 -08:00
parent bf609f0e56
commit af02f2beb1
3 changed files with 30 additions and 7 deletions

View File

@ -9,7 +9,14 @@ describe('hello world', function () {
it('should greet', function() {
browser.get(URL);
expect(getGreetingText('hello-app')).toBe('hello world!');
expect(getComponentText('hello-app', '.greeting')).toBe('hello world!');
});
it('should change greeting', function() {
browser.get(URL);
clickComponentButton('hello-app', '.changeButton');
expect(getComponentText('hello-app', '.greeting')).toBe('howdy world!');
});
});
@ -19,12 +26,23 @@ describe('hello world', function () {
it('should greet', function() {
browser.get(URL);
expect(getGreetingText('hello-app')).toBe('hello world!');
expect(getComponentText('hello-app', '.greeting')).toBe('hello world!');
});
it('should change greeting', function() {
browser.get(URL);
clickComponentButton('hello-app', '.changeButton');
expect(getComponentText('hello-app', '.greeting')).toBe('howdy world!');
});
});
});
function getGreetingText(selector) {
return browser.executeScript('return document.querySelector("'+selector+'").shadowRoot.firstChild.textContent');
function getComponentText(selector, innerSelector) {
return browser.executeScript('return document.querySelector("'+selector+'").shadowRoot.querySelector("'+innerSelector+'").textContent');
}
function clickComponentButton(selector, innerSelector) {
return browser.executeScript('return document.querySelector("'+selector+'").shadowRoot.querySelector("'+innerSelector+'").click()');
}