2016-05-30 14:05:09 -04:00
|
|
|
/// <reference path="../_protractor/e2e.d.ts" />
|
2016-03-26 12:18:13 -04:00
|
|
|
describe('Dependency Injection Cookbook', function () {
|
|
|
|
|
|
|
|
beforeAll(function () {
|
|
|
|
browser.get('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render Logged in User example', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let loggedInUser = element.all(by.xpath('//h3[text()="Logged in user"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(loggedInUser).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('"Bombasto" should be the logged in user', function () {
|
|
|
|
let loggedInUser = element.all(by.xpath('//div[text()="Name: Bombasto"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(loggedInUser).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('should render sorted heroes', function () {
|
|
|
|
let sortedHeroes = element.all(by.xpath('//h3[text()="Sorted Heroes" and position()=1]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(sortedHeroes).toBeDefined();
|
2016-05-30 14:05:09 -04:00
|
|
|
});
|
|
|
|
|
2016-03-26 12:18:13 -04:00
|
|
|
it('Mr. Nice should be in sorted heroes', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let sortedHero = element.all(by.xpath('//sorted-heroes/[text()="Mr. Nice" and position()=2]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(sortedHero).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('RubberMan should be in sorted heroes', function () {
|
|
|
|
let sortedHero = element.all(by.xpath('//sorted-heroes/[text()="RubberMan" and position()=3]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(sortedHero).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
2016-03-26 12:18:13 -04:00
|
|
|
it('Magma should be in sorted heroes', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let sortedHero = element.all(by.xpath('//sorted-heroes/[text()="Magma"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(sortedHero).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
2016-06-03 12:00:53 -04:00
|
|
|
it('should render Hero of the Month', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let heroOfTheMonth = element.all(by.xpath('//h3[text()="Hero of the month"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(heroOfTheMonth).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('should render Hero Bios', function () {
|
|
|
|
let heroBios = element.all(by.xpath('//h3[text()="Hero Bios"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(heroBios).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('should render Magma\'s description in Hero Bios', function () {
|
|
|
|
let magmaText = element.all(by.xpath('//textarea[text()="Hero of all trades"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(magmaText).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('should render Magma\'s phone in Hero Bios and Contacts', function () {
|
|
|
|
let magmaPhone = element.all(by.xpath('//div[text()="Phone #: 555-555-5555"]')).get(0);
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(magmaPhone).toBeDefined();
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
2016-06-03 12:00:53 -04:00
|
|
|
it('should render Hero-of-the-Month runner-ups', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let runnersUp = element(by.id('rups1')).getText();
|
2016-05-16 21:56:13 -04:00
|
|
|
expect(runnersUp).toContain('RubberMan, Mr. Nice');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('should render DateLogger log entry in Hero-of-the-Month', function () {
|
|
|
|
let logs = element.all(by.id('logs')).get(0).getText();
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(logs).toContain('INFO: starting up at');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
2016-03-26 12:18:13 -04:00
|
|
|
it('should highlight Hero Bios and Contacts container when mouseover', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let target = element(by.css('div[myHighlight="yellow"]'))
|
|
|
|
let yellow = 'rgba(255, 255, 0, 1)';
|
|
|
|
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(target.getCssValue('background-color')).not.toEqual(yellow);
|
2016-05-30 14:05:09 -04:00
|
|
|
browser.actions().mouseMove(target as any as webdriver.WebElement).perform();
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(target.getCssValue('background-color')).toEqual(yellow);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('in Parent Finder', function () {
|
2016-05-30 14:05:09 -04:00
|
|
|
let cathy1 = element(by.css('alex cathy'));
|
|
|
|
let craig1 = element(by.css('alex craig'));
|
|
|
|
let carol1 = element(by.css('alex carol p'));
|
|
|
|
let carol2 = element(by.css('barry carol p'));
|
|
|
|
|
|
|
|
it('"Cathy" should find "Alex" via the component class', function () {
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(cathy1.getText()).toContain('Found Alex via the component');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('"Craig" should not find "Alex" via the base class', function () {
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(craig1.getText()).toContain('Did not find Alex via the base');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('"Carol" within "Alex" should have "Alex" parent', function () {
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(carol1.getText()).toContain('Alex');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
|
|
|
|
it('"Carol" within "Barry" should have "Barry" parent', function () {
|
2016-03-26 12:18:13 -04:00
|
|
|
expect(carol2.getText()).toContain('Barry');
|
|
|
|
});
|
2016-05-30 14:05:09 -04:00
|
|
|
});
|
2016-03-26 12:18:13 -04:00
|
|
|
});
|