How to use @bazel/protractor - 7 common examples

To help you get started, we’ve selected a few @bazel/protractor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bazelbuild / rules_nodejs / examples / protocol_buffers / protractor.on-prepare.js View on Github external
module.exports = function(config) {
  // In this example, `@bazel/protractor/protractor-utils` is used to run
  // the server. protractorUtils.runServer() runs the server on a randomly
  // selected port (given a port flag to pass to the server as an argument).
  // The port used is returned in serverSpec and the protractor serverUrl
  // is the configured.
  const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver';
  return protractorUtils
      .runServer(config.workspace, config.server, isProdserver ? '-p' : '-port', [])
      .then(serverSpec => {
        protractor.browser.baseUrl = `http://localhost:${serverSpec.port}`;
      });
};
github angular / angular-bazel-example / e2e / protractor.on-prepare.js View on Github external
module.exports = function(config) {
  // In this example, `@bazel/protractor/protractor-utils` is used to run
  // the server. protractorUtils.runServer() runs the server on a randomly
  // selected port (given a port flag to pass to the server as an argument).
  // The port used is returned in serverSpec and the protractor serverUrl
  // is the configured.
  const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver';
  return protractorUtils
      .runServer(config.workspace, config.server, isProdserver ? '-p' : '-port', [])
      .then(serverSpec => {
        // Example app is hosted under `/example` in the prodserver and under `/` in devserver
        const serverUrl = `http://localhost:${serverSpec.port}` + (isProdserver ? '/example' : '');
        protractor.browser.baseUrl = serverUrl;
      });
};
github angular / angular / modules / benchmarks / src / tree / render3 / protractor.on_prepare.js View on Github external
module.exports = async function(config) {
  const serverSpec = await protractorUtils.runServer(config.workspace, config.server, '-port', []);

  const serverUrl = `http://localhost:${serverSpec.port}`;
  // Since the browser restarts in this benchmark we need to set both the browser.baseUrl
  // for the first test and the protractor config.baseUrl for the subsequent tests
  protractor.browser.baseUrl = serverUrl;

  const processedConfig = await protractor.browser.getProcessedConfig();
  return processedConfig.baseUrl = serverUrl;
};
github angular / components / src / e2e-app / start-devserver.js View on Github external
async function runBazelServer(workspace, serverPath, timeout) {
  const serverBinary = require.resolve(`${workspace}/${serverPath}`);
  const port = await utils.findFreeTcpPort();

  // Start the Bazel server binary with a random free TCP port.
  const serverProcess = spawn(serverBinary, ['-port', port], {stdio: 'inherit'});

  // In case the process exited with an error, we want to propagate the error.
  serverProcess.on('exit', exitCode => {
    if (exitCode !== 0) {
      throw new Error(`Server exited with error code: ${exitCode}`);
    }
  });

  // Wait for the server to be bound to the given port.
  await utils.waitForServer(port, timeout);

  return port;
}
github angular / components / src / e2e-app / start-devserver.js View on Github external
async function runBazelServer(workspace, serverPath, timeout) {
  const serverBinary = require.resolve(`${workspace}/${serverPath}`);
  const port = await utils.findFreeTcpPort();

  // Start the Bazel server binary with a random free TCP port.
  const serverProcess = spawn(serverBinary, ['-port', port], {stdio: 'inherit'});

  // In case the process exited with an error, we want to propagate the error.
  serverProcess.on('exit', exitCode => {
    if (exitCode !== 0) {
      throw new Error(`Server exited with error code: ${exitCode}`);
    }
  });

  // Wait for the server to be bound to the given port.
  await utils.waitForServer(port, timeout);

  return port;
}
github angular / angular / modules / benchmarks / start-server.js View on Github external
module.exports = async function(config) {
  const {port} = await protractorUtils.runServer(config.workspace, config.server, '-port', []);
  const processedConfig = await protractor.browser.getProcessedConfig();
  const serverUrl = `http://localhost:${port}`;

  return processedConfig.baseUrl = protractor.browser.baseUrl = serverUrl;
};
github angular / angular / packages / examples / service-worker / registration-options / start-server.js View on Github external
module.exports = async function(config) {
  const {port} = await protractorUtils.runServer(config.workspace, config.server, '-port', []);
  const serverUrl = `http://localhost:${port}`;

  protractor.browser.baseUrl = serverUrl;
};

@bazel/protractor

Run Protractor tests under Bazel

Apache-2.0
Latest version published 1 year ago

Package Health Score

76 / 100
Full package analysis