2016-11-08 12:47:39 -05:00
|
|
|
import { browser, element, by } from 'protractor';
|
2016-11-08 12:31:02 -05:00
|
|
|
|
2016-10-06 18:25:52 -04:00
|
|
|
export var appLang = {
|
|
|
|
appIsTs: false,
|
|
|
|
appIsJs: false,
|
|
|
|
appIsDart: false,
|
|
|
|
appIsUnknown: false
|
|
|
|
};
|
|
|
|
|
|
|
|
export function describeIf(cond: boolean, name: string, func: () => void): void {
|
|
|
|
if (cond) {
|
|
|
|
describe(name, func);
|
|
|
|
} else {
|
|
|
|
xdescribe(name, func);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function itIf(cond: boolean, name: string, func: (done: DoneFn) => void): void {
|
|
|
|
if (cond) {
|
|
|
|
it(name, func);
|
|
|
|
} else {
|
|
|
|
xit(name, func);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function setProtractorToNg1Mode(): void {
|
2016-11-08 12:31:02 -05:00
|
|
|
browser.rootEl = 'body';
|
2016-10-06 18:25:52 -04:00
|
|
|
}
|
2016-11-08 12:47:39 -05:00
|
|
|
|
|
|
|
// Protractor doesn't support the UpgradeAdapter's asynchronous
|
|
|
|
// bootstrap with Angular 1 at the moment. Get around it by
|
|
|
|
// waiting for an element to get `ng-scope` class.
|
|
|
|
export function waitForNg1AsyncBootstrap() {
|
2016-11-09 12:21:12 -05:00
|
|
|
browser.ignoreSynchronization = true;
|
2016-11-08 12:47:39 -05:00
|
|
|
browser.driver.wait(function() {
|
|
|
|
return element(by.css('.ng-scope')).isPresent();
|
|
|
|
}, 5000);
|
2016-11-09 09:23:59 -05:00
|
|
|
// Use this instead when upgrading to protractor > 4.0.10
|
|
|
|
// browser.ng12Hybrid = true;
|
2016-11-08 12:47:39 -05:00
|
|
|
}
|