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

14 lines
596 B
TypeScript
Raw Normal View History

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