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

13 lines
517 B
TypeScript

import { browser } from 'protractor';
import {OnPrepareConfig, runServer} from '@angular/bazel/protractor-utils';
export = function(config: OnPrepareConfig) {
const portFlag = config.server.endsWith('prodserver') ? '-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;
});
}