配置这个Protractor环境真是折磨死人了,webdriver-manage update怎么都不成功,即使自己下载好chromederiver放到相应文件夹下,也不能使用。费时三四天终于按照https://github.com/angular/protractor-cookbook/tree/master/protractor-docker这里的方法弄好了

首先你得确保安装了docker

  1. docker -v

如果已经成功安装了会显示如下

  1. Docker version 17.12.-ce, build c97c6d6

Step 0 - Download the docker images for Selenium Hub and Selenium Node

  1. docker pull selenium/hub:latest
  2. docker pull selenium/node-chrome:latest

如果你想要使用firefox-node,可以pull 'node-firefox'。想要了解不同镜像的更多信息,可以查看Docker Selenium Images List

Step1 - Starting the Selenium Grid

  1. docker run -d -p : --name selenium-hub selenium/hub:latest

One can change the tag from 'latest' to '2.53.0' or any other version as they see fit.

Step2 - Starting the Selenium Nodes

  1. docker run -d --link selenium-hub:hub selenium/node-chrome:latest

The above would create a chrome node and link it to the Selenium hub/grid created earlier.

Step3 - Running the tests

更新配置文件中的SeleniumAddress如下:

  1. seleniumAddress: 'http://localhost:4444/wd/hub'

运行测试文件

  1. ./node_modules/.bin/protractor protractor-conf.js

有时候会不支持es6的语法结构,可以先使用babel进行转码, 需要安装babel,babel-cli,babel-core,babel-preset-latest,babel-preset-stage-2等依赖,配置.babelrc文件。

  1. babel-node ./node_modules/.bin/protractor protractor-conf.js

我的项目中package.json

.babelrc文件

Running Protractor Tests on Docker的更多相关文章

  1. SWTError: No more handles [gtk_init_check() failed] running platform tests (on Linux)

    http://www.lemmster.de/2013-12-19-swterror-no-more-handles-gtk_init_check-failed-running-platform-te ...

  2. Configuring and Running Django + Celery in Docker Containers

    Configuring and Running Django + Celery in Docker Containers  Justyna Ilczuk  Oct 25, 2016  0 Commen ...

  3. Running Web API using Docker and Kubernetes

    Context As companies are continuously seeking ways to become more Agile and embracing DevOps culture ...

  4. VMWare File Format Learning && Use VHD File To Boot VMWare && CoreOS Docker Configuration And Running

    目录 . Virtual Machine Introduce . Vmware Image File Format . VHD File Format . Convert VHD File Into ...

  5. 转:VS2010调试NUnit测试项目 (Running or debugging NUnit tests from Visual Studio without any extensions)

    If you write unit tests and use NUnit test framework this may be helpful. I decided to write this si ...

  6. [Git] Automatically running tests before commits with ghooks

    Wouldn't it be nice if everyone ran the tests before committing code? With ghooks, you can automatic ...

  7. Running tests on PyCharm using Robot Framework

    问题: I started using PyCharm with the robot framework, but i'm facing an issue. how can i run my test ...

  8. Scala + Play + Sbt + Protractor

    Scala + Play + Sbt + Protractor = One Build 欢迎关注我的新博客地址:http://cuipengfei.me/ 我所在的项目的技术栈选用的是Play fra ...

  9. docker之常用命令、自定制镜像、公(私)仓库的上传和下载

    一.docker命令 1.参数和命令汇总 1. 参数 Options: --config=~/.docker Location of client config files #客户端配置文件的位置 - ...

随机推荐

  1. 八个常用的js正则表达式

    开篇:开发中如果有input输入框,难免就要写正则表达式,因此在这里总结了一些常见常用的正则表达式的书写方法,希望会大家有所帮助: 附图: 一.手机号码 $(document).ready(funct ...

  2. 基于angular2+ 的 http服务封装

    1.定义http-interceptor.service.ts服务,统一处理http请求 /** * name:http服务 * describe:对http请求做统一处理 * author:Angu ...

  3. iOS开源项目周报0209

    由OpenDigg 出品的iOS开源项目周报第七期来啦.我们的iOS开源周报集合了OpenDigg一周来新收录的优质的iOS开源项目,方便iOS开发人员便捷的找到自己需要的项目工具等.Hedwig 向 ...

  4. 解决eclipse为什么不能查看源码

    Java eclipse中查看源代码ctrl+左键单击 一.你是第一次使用该功能,没有导入项目源码,故无法查看源码 解决方法: ​1.点 “window“-> “Preferences”-> ...

  5. RabbitMQ---6、客户端 API 的简介

    1.主要的命名空间,接口和类 定义核心的API的接口和类被定义在RabbitMQ.Client这个命名空间下面: 所以要想使用RabbitMQ的功能,需要以下代码     using RabbitMQ ...

  6. Oracle数据库基本操作 (六) —— 数据的导出与导入

    一.cmd 下登录oracle数据库下的指定用户 方式一:命令行明文连接登录 打开cmd,输入:sqlplus/nolog 输入:conn username/passworld@数据库实例名 方式二: ...

  7. html和css入门 (二)

    CSS基础 什么是CSS 简单来说,层叠样式表(Cascading Style Sheet)是一种专门用来控制界面外观风格的文档. CSS发展历史 1996年 CSS 1.0 规范面世,其中加入了字体 ...

  8. BZOJ1014: [JSOI2008]火星人prefix(splay 二分 hash)

    题意 题目链接 Sol 一眼splay + 二分hash,不过区间splay怎么写来着呀 试着写了两个小时发现死活不对 看了一下yyb的代码发现自己根本就不会splay.... // luogu-ju ...

  9. 理解webpack4.splitChunks之cacheGroups

    cacheGroups其实是splitChunks里面最核心的配置,一开始我还认为cacheGroups是可有可无的,这是完全错误的,splitChunks就是根据cacheGroups去拆分模块的, ...

  10. UTF-8和GBK编码转换iconv

    iconv("GBK", "UTF-8", $str);//将GBK编码转换成UTF8编码