2016-06-23 12:47:54 -04: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
|
|
|
|
*/
|
|
|
|
|
2020-04-13 19:40:21 -04:00
|
|
|
import {$, browser, by, element, ExpectedConditions} from 'protractor';
|
2015-12-05 05:21:38 -05:00
|
|
|
|
2020-04-24 13:26:36 -04:00
|
|
|
import {verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
2019-02-01 08:46:38 -05:00
|
|
|
|
2016-10-23 10:21:18 -04:00
|
|
|
function waitForElement(selector: string) {
|
2015-12-05 05:21:38 -05:00
|
|
|
// Waits for the element with id 'abc' to be present on the dom.
|
2016-11-10 21:13:11 -05:00
|
|
|
browser.wait(ExpectedConditions.presenceOf($(selector)), 20000);
|
2015-12-05 05:21:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
describe('relative assets relative-app', () => {
|
|
|
|
afterEach(verifyNoBrowserErrors);
|
|
|
|
|
2019-02-01 08:46:38 -05:00
|
|
|
const URL = '/';
|
2015-12-05 05:21:38 -05: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 10:21:18 -04: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 05:21:38 -05:00
|
|
|
|
|
|
|
expect(width).toBe(432);
|
|
|
|
});
|
|
|
|
});
|