'Error: No update-config.json found' with Docker, Protractor, and SauceLabs
'Error: No update-config.json found' with Docker, Protractor, and SauceLabs
我正在尝试在 Docker 容器中使用 Protractor+SauceLabs 进行自动端到端测试,但收到“错误消息:未找到更新-config.json。 运行 'webdriver-manager update' 下载二进制文件。'我现在 运行ning 'webdriver-manager update --standalone false' 在 运行ning 端到端测试之前,(独立因为我不需要也需要 java 的独立版本)。有趣的是,(可以在下面的命令行输出中看到)该命令有效,我实际上可以找到 update-config.json 文件,但是我仍然遇到相同的错误。这可能只是量角器的一个错误,但我想先检查 Stack Overflow。任何帮助将不胜感激,谢谢!
哦,当然,即使我删除了 nodemodules、运行 npm install 和 npm 运行 e2e sauce,测试也在本地工作,或者清除它们,执行 npm install,npm 运行 webdriver-update 和 npm 运行 e2e-sauce.
相关依赖
"@angular/cli": "1.6.6",
"node": "8.10.0",
"npm": "5.6.0",
"protractor": "5.1.2",
"ts-node": "4.1.0",
package.json 命令:
"e2e-sauce": "ng e2e --port 8100 --env test --sauce",
"webdriver-update": "webdriver-manager update --standalone false --gecko false",
bash脚本我是运行ning:
# for testing purposes, normally environment variable
GIT_COMMIT=aTestCommit;
if [[ -z $GIT_COMMIT ]]; then
echo "$GIT_COMMIT environment variable is required!";
exit 1;
fi
function cleanup {
docker rm -f $GIT_COMMIT
}
trap cleanup EXIT INT TERM
COMMAND=""
COMMAND+="npm run webdriver-update"
COMMAND+=" && ls ./node_modules/protractor/node_modules/webdriver-manager/selenium"
COMMAND+=" && ng e2e --port 8100 --env test --sauce"
set -ex
docker-compose create --build builder
docker-compose run --name $GIT_COMMIT builder bash -c "$COMMAND"
Docker文件:
FROM node:8
# Install Chrome
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
# Set the working directory to /app
WORKDIR /app
# Give the node user access to /usr/local
RUN chown -R node:node /usr/local
# Give the node user access to /usr/local
RUN chown -R node:node /app
# Change to the node user
USER node
# Install the Angular CLI globally
RUN npm install -g @angular/cli@1.6.6
# Add the package.json and the package-lock.json to the container at /app
COPY package.json package-lock.json ./
# Install dependencies called out in the package.json
RUN npm install
# Add angular-cli karma and typescript configs to the container at /app
COPY .angular-cli.json karma.conf.js tsconfig.json tslint.json protractor.conf.js ./
# Add the app src to the container at /app/src
COPY src ./src
# Add the e2e tests to the container at /app/e2e
COPY e2e ./e2e
运行宁我的 bash 脚本的命令行输出:
> webdriver-manager update --standalone false
[18:04:49] I/file_manager - creating folder /app/node_modules/protractor/node_modules/webdriver-manager/selenium
[18:04:56] I/update - chromedriver: unzipping chromedriver_2.37.zip
[18:04:56] I/update - chromedriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37
[18:05:01] I/update - geckodriver: unzipping geckodriver-v0.20.1.tar.gz
[18:05:01] I/update - geckodriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.1
chrome-response.xml gecko-response.json update-config.json
chromedriver_2.37 geckodriver-v0.20.1
chromedriver_2.37.zip geckodriver-v0.20.1.tar.gz
The option '--sauce' is not registered with the e2e command. Run `ng e2e --help` for a list of supported options.
** NG Live Development Server is listening on localhost:8100, open your browser on https://localhost:8100/ **
10% building modules 3/3 modules 0 activeGenerating SSL Certificate s
Date: 2018-04-12T18:05:18.269Z i Hash: b57e600f446f16a8f14c
Time: 13770ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 130 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 323 kB [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 17.6 kB [initial] [rendered]
chunk {transactions.module} transactions.module.chunk.js, transactions.module.chunk.js.map () 1.17 MB [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.11 MB [initial] [rendered]
(node:31) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
webpack: Compiled successfully.
[18:05:18] I/update - chromedriver: file exists /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37.zip
[18:05:18] I/update - chromedriver: unzipping chromedriver_2.37.zip
[18:05:18] I/update - chromedriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37
[18:05:18] I/update - chromedriver: chromedriver_2.37 up to date
[18:05:18] I/launcher - Running 1 instances of WebDriver
[18:05:18] E/local - Error code: 135
[18:05:18] E/local - Error message: No update-config.json found. Run 'webdriver-manager update' to download binaries.
[18:05:18] E/local - Error: No update-config.json found. Run 'webdriver-manager update' to download binaries.
根本原因是 angular cli ng e2e
将默认执行 webdriver-manager update
。
并且你使用的是global angular cli而不是项目本地的,所以它会尝试使用global webdriver-manager
来执行更新,但是你没有安装global webdriver-manager
,所以ng e2e
报告 Error: No update-config.json found
.
解决问题的两个选项:
选项 1: 通过添加 --wu false
禁用 ng e2e
的 webdriver-manager update
COMMAND+=" && ng e2e --port 8100 --env test --sauce --wu false"
但是您需要自己更新 webdriver,就像您之前所做的那样。
选项 2:安装 angular cli 作为项目本地包,而不是全局包,通过删除 -g
选项
# Install the Angular CLI globally
RUN npm install @angular/cli@1.6.6
发现这是因为我没有使用独立版本的 selenium(我不应该使用“--standalone false”)。删除该行并在我的 Dockerfile 中安装 java 后,它像梦一样工作。
我正在尝试在 Docker 容器中使用 Protractor+SauceLabs 进行自动端到端测试,但收到“错误消息:未找到更新-config.json。 运行 'webdriver-manager update' 下载二进制文件。'我现在 运行ning 'webdriver-manager update --standalone false' 在 运行ning 端到端测试之前,(独立因为我不需要也需要 java 的独立版本)。有趣的是,(可以在下面的命令行输出中看到)该命令有效,我实际上可以找到 update-config.json 文件,但是我仍然遇到相同的错误。这可能只是量角器的一个错误,但我想先检查 Stack Overflow。任何帮助将不胜感激,谢谢!
哦,当然,即使我删除了 nodemodules、运行 npm install 和 npm 运行 e2e sauce,测试也在本地工作,或者清除它们,执行 npm install,npm 运行 webdriver-update 和 npm 运行 e2e-sauce.
相关依赖 "@angular/cli": "1.6.6", "node": "8.10.0", "npm": "5.6.0", "protractor": "5.1.2", "ts-node": "4.1.0",
package.json 命令:
"e2e-sauce": "ng e2e --port 8100 --env test --sauce",
"webdriver-update": "webdriver-manager update --standalone false --gecko false",
bash脚本我是运行ning:
# for testing purposes, normally environment variable
GIT_COMMIT=aTestCommit;
if [[ -z $GIT_COMMIT ]]; then
echo "$GIT_COMMIT environment variable is required!";
exit 1;
fi
function cleanup {
docker rm -f $GIT_COMMIT
}
trap cleanup EXIT INT TERM
COMMAND=""
COMMAND+="npm run webdriver-update"
COMMAND+=" && ls ./node_modules/protractor/node_modules/webdriver-manager/selenium"
COMMAND+=" && ng e2e --port 8100 --env test --sauce"
set -ex
docker-compose create --build builder
docker-compose run --name $GIT_COMMIT builder bash -c "$COMMAND"
Docker文件:
FROM node:8
# Install Chrome
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
# Set the working directory to /app
WORKDIR /app
# Give the node user access to /usr/local
RUN chown -R node:node /usr/local
# Give the node user access to /usr/local
RUN chown -R node:node /app
# Change to the node user
USER node
# Install the Angular CLI globally
RUN npm install -g @angular/cli@1.6.6
# Add the package.json and the package-lock.json to the container at /app
COPY package.json package-lock.json ./
# Install dependencies called out in the package.json
RUN npm install
# Add angular-cli karma and typescript configs to the container at /app
COPY .angular-cli.json karma.conf.js tsconfig.json tslint.json protractor.conf.js ./
# Add the app src to the container at /app/src
COPY src ./src
# Add the e2e tests to the container at /app/e2e
COPY e2e ./e2e
运行宁我的 bash 脚本的命令行输出:
> webdriver-manager update --standalone false
[18:04:49] I/file_manager - creating folder /app/node_modules/protractor/node_modules/webdriver-manager/selenium
[18:04:56] I/update - chromedriver: unzipping chromedriver_2.37.zip
[18:04:56] I/update - chromedriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37
[18:05:01] I/update - geckodriver: unzipping geckodriver-v0.20.1.tar.gz
[18:05:01] I/update - geckodriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.1
chrome-response.xml gecko-response.json update-config.json
chromedriver_2.37 geckodriver-v0.20.1
chromedriver_2.37.zip geckodriver-v0.20.1.tar.gz
The option '--sauce' is not registered with the e2e command. Run `ng e2e --help` for a list of supported options.
** NG Live Development Server is listening on localhost:8100, open your browser on https://localhost:8100/ **
10% building modules 3/3 modules 0 activeGenerating SSL Certificate s
Date: 2018-04-12T18:05:18.269Z i Hash: b57e600f446f16a8f14c
Time: 13770ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 130 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 323 kB [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 17.6 kB [initial] [rendered]
chunk {transactions.module} transactions.module.chunk.js, transactions.module.chunk.js.map () 1.17 MB [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.11 MB [initial] [rendered]
(node:31) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
webpack: Compiled successfully.
[18:05:18] I/update - chromedriver: file exists /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37.zip
[18:05:18] I/update - chromedriver: unzipping chromedriver_2.37.zip
[18:05:18] I/update - chromedriver: setting permissions to 0755 for /app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.37
[18:05:18] I/update - chromedriver: chromedriver_2.37 up to date
[18:05:18] I/launcher - Running 1 instances of WebDriver
[18:05:18] E/local - Error code: 135
[18:05:18] E/local - Error message: No update-config.json found. Run 'webdriver-manager update' to download binaries.
[18:05:18] E/local - Error: No update-config.json found. Run 'webdriver-manager update' to download binaries.
根本原因是 angular cli ng e2e
将默认执行 webdriver-manager update
。
并且你使用的是global angular cli而不是项目本地的,所以它会尝试使用global webdriver-manager
来执行更新,但是你没有安装global webdriver-manager
,所以ng e2e
报告 Error: No update-config.json found
.
解决问题的两个选项:
选项 1: 通过添加 --wu false
ng e2e
的 webdriver-manager update
COMMAND+=" && ng e2e --port 8100 --env test --sauce --wu false"
但是您需要自己更新 webdriver,就像您之前所做的那样。
选项 2:安装 angular cli 作为项目本地包,而不是全局包,通过删除 -g
选项
# Install the Angular CLI globally
RUN npm install @angular/cli@1.6.6
发现这是因为我没有使用独立版本的 selenium(我不应该使用“--standalone false”)。删除该行并在我的 Dockerfile 中安装 java 后,它像梦一样工作。