angular-docs-cn/integration/bazel/test/e2e/on-prepare.ts

13 lines
522 B
TypeScript
Raw Normal View History

import { browser } from 'protractor';
import {OnPrepareConfig, runServer} from '@angular/bazel/protractor-utils';
export = function(config: OnPrepareConfig) {
const portFlag = /prodserver(\.exe)?$/.test(config.server) ? '-p' : '-port';
return runServer(config.workspace, config.server, portFlag, [])
.then(serverSpec => {
const serverUrl = `http://localhost:${serverSpec.port}`;
console.log(`Server has been started, starting tests against ${serverUrl}`);
browser.baseUrl = serverUrl;
});
}