|
| 1 | +'use strict'; // necessary for es6 output in node |
| 2 | + |
| 3 | +import { browser, element, by } from 'protractor'; |
| 4 | + |
| 5 | +// gulp run-e2e-tests --filter=cb-inheritance |
| 6 | +describe('Inheritance Cookbook', () => { |
| 7 | + |
| 8 | + beforeAll(() => { |
| 9 | + browser.get(''); |
| 10 | + }); |
| 11 | + |
| 12 | + describe('Basic Example', () => { |
| 13 | + |
| 14 | + it('shows movie list with removal buttons', () => { |
| 15 | + const movies = element(by.tagName('my-movie-list')); |
| 16 | + const avengers = movies.element(by.cssContainingText('li', 'Avengers')); |
| 17 | + |
| 18 | + expect(avengers.isPresent()).toBe(true); |
| 19 | + avengers.element(by.buttonText('X')).click(); |
| 20 | + expect(avengers.isPresent()).toBe(false); |
| 21 | + }); |
| 22 | + |
| 23 | + it('shows album list with genre and removal buttons', () => { |
| 24 | + const albums = element(by.tagName('my-album-list')); |
| 25 | + const title = albums.element(by.tagName('h2')); |
| 26 | + const abbeyRoad = albums.element(by.cssContainingText('li', 'The Beatles: Abbey Road')); |
| 27 | + |
| 28 | + expect(title.getText()).toEqual('Classic Rock Albums'); |
| 29 | + expect(abbeyRoad.isPresent()).toBe(true); |
| 30 | + abbeyRoad.element(by.buttonText('X')).click(); |
| 31 | + expect(abbeyRoad.isPresent()).toBe(false); |
| 32 | + }); |
| 33 | + |
| 34 | + }); |
| 35 | + |
| 36 | + describe('Class Metadata Example', () => { |
| 37 | + |
| 38 | + it('shows a list of numbers and a list of superpower titles', () => { |
| 39 | + const base = element(by.tagName('my-class-metadata-example')); |
| 40 | + const superList = base.element(by.tagName('my-list')); |
| 41 | + const subList = base.element(by.tagName('my-superpower-list')); |
| 42 | + |
| 43 | + ['1', '2', '3'].forEach(itm => { |
| 44 | + expect(superList.element(by.cssContainingText('li', itm)).isPresent()).toBe(true); |
| 45 | + }); |
| 46 | + ['Flight', 'Shield'].forEach(itm => { |
| 47 | + expect(subList.element(by.cssContainingText('li', itm)).isPresent()).toBe(true); |
| 48 | + }); |
| 49 | + }); |
| 50 | + |
| 51 | + }); |
| 52 | + |
| 53 | + describe('Property, Method, and Constructor Example', () => { |
| 54 | + |
| 55 | + it('has a canvas with an initial size that reacts to window resize', () => { |
| 56 | + const base = element(by.tagName('my-property-metadata-example')); |
| 57 | + const canvas = base.element(by.tagName('canvas')); |
| 58 | + |
| 59 | + expect(canvas.getAttribute('width')).toBe('300'); |
| 60 | + expect(canvas.getAttribute('height')).toBe('200'); |
| 61 | + browser.manage().window().setSize(500, 400); |
| 62 | + expect(canvas.getAttribute('width')).not.toBe('300'); |
| 63 | + expect(canvas.getAttribute('height')).not.toBe('200'); |
| 64 | + }); |
| 65 | + |
| 66 | + }); |
| 67 | + |
| 68 | +}); |
0 commit comments