| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 18:13:11 -08:00
										 |  |  | import {$, ExpectedConditions, browser, by, element} from 'protractor'; | 
					
						
							| 
									
										
										
										
											2015-12-05 02:21:38 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-01 14:46:38 +01:00
										 |  |  | import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-23 16:21:18 +02:00
										 |  |  | function waitForElement(selector: string) { | 
					
						
							| 
									
										
										
										
											2015-12-05 02:21:38 -08:00
										 |  |  |   // Waits for the element with id 'abc' to be present on the dom.
 | 
					
						
							| 
									
										
										
										
											2016-11-10 18:13:11 -08:00
										 |  |  |   browser.wait(ExpectedConditions.presenceOf($(selector)), 20000); | 
					
						
							| 
									
										
										
										
											2015-12-05 02:21:38 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('relative assets relative-app', () => { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   afterEach(verifyNoBrowserErrors); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-01 14:46:38 +01:00
										 |  |  |   const URL = '/'; | 
					
						
							| 
									
										
										
										
											2015-12-05 02:21:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it('should load in the templateUrl relative to the my-cmp component', () => { | 
					
						
							|  |  |  |     browser.get(URL); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     waitForElement('my-cmp .inner-container'); | 
					
						
							|  |  |  |     expect(element.all(by.css('my-cmp .inner-container')).count()).toEqual(1); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should load in the styleUrls relative to the my-cmp component', () => { | 
					
						
							|  |  |  |     browser.get(URL); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     waitForElement('my-cmp .inner-container'); | 
					
						
							| 
									
										
										
										
											2016-10-23 16:21:18 +02:00
										 |  |  |     const elem = element(by.css('my-cmp .inner-container')); | 
					
						
							|  |  |  |     const width = browser.executeScript( | 
					
						
							|  |  |  |         (e: Element) => parseInt(window.getComputedStyle(e).width), elem.getWebElement()); | 
					
						
							| 
									
										
										
										
											2015-12-05 02:21:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     expect(width).toBe(432); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |