【问题标题】:How to pass Jenkins parameters to Protractor scripts如何将 Jenkins 参数传递给量角器脚本
【发布时间】:2019-08-29 01:42:46
【问题描述】:

我想将 Jenkins 的以下内容(使用下拉菜单)传递给我的量角器脚本:

浏览器:Firefox/Chrome/Edge

网址:www.stackoverflow.com 或 www.duck.com

我怎样才能做到这一点?

我能否构造参数中的值并将它们发送到命令行?

编辑 1 - 添加更多信息。

我有一套 E2E 量角器脚本。

这是配置文件。

config.ts

capabilities: {
        browserName: (process.env.TEST_BROWSER_NAME || 'chrome'),
        version: (process.env.TEST_BROWSER_VERSION || 'ANY'),
        shardTestFiles: true,
        unexpectedAlertBehaviour: 'accept',
        loggingPrefs: {
            performance: 'ALL',
        },

我在配置文件中有 process.env.TEST_BROWSER_NAME。在 Jenkins 中有 Chrome 和 Firefox 的选项。我在 Jenkins 中设置的内容应该被配置文件拾取并用于执行。这就是我想要达到的目标。

【问题讨论】:

  • 它是一个管道还是只是一个使用 shell 脚本运行命令的作业?
  • 只是一个运行 npm 命令的作业。

标签: typescript jenkins protractor


【解决方案1】:

你的命令会是这样的

#!/bin/bash -xe

protractor protractor.conf.js --baseUrl="${SERVER_URL}" --browser=${TEST_BROWSER_NAME} || error=true

# Fail the build if there was an error
if [ $error ]
then
    exit 1
fi

如果您需要进一步的帮助,请告诉我

【讨论】:

  • 我需要将参数从量角器传递给Jenkins。
  • 给我一个你在做什么的用例@williamtell
  • 我已经更新了这个问题。您将在 Edit 1 下找到信息 :) 谢谢。
  • 那么我的回答仍然有效。您将参数从 Jenkins 传递给 Protractor,而不是相反。它不适合你吗?
猜你喜欢
  • 1970-01-01
  • 2020-02-20
  • 2021-01-11
  • 2019-08-22
  • 1970-01-01
  • 1970-01-01
  • 2020-07-18
  • 2011-08-01
相关资源
最近更新 更多