browserstack-selenium-behat

所属分类:前端开发
开发工具:PHP
文件大小:105KB
下载次数:0
上传日期:2018-09-01 05:57:52
上 传 者sh-1993
说明:  浏览器堆栈硒行为,,
(browserstack-selenium-behat,,)

文件列表:
.travis.yml (204, 2018-09-01)
Dockerfile (88, 2018-09-01)
LICENSE.md (1071, 2018-09-01)
app (0, 2018-09-01)
app\client (0, 2018-09-01)
app\client\package.json (766, 2018-09-01)
app\client\public (0, 2018-09-01)
app\client\public\favicon.ico (3870, 2018-09-01)
app\client\public\index.html (1590, 2018-09-01)
app\client\public\manifest.json (317, 2018-09-01)
app\client\public\results.log (2239, 2018-09-01)
app\client\src (0, 2018-09-01)
app\client\src\App.css (187, 2018-09-01)
app\client\src\App.js (455, 2018-09-01)
app\client\src\App.test.js (248, 2018-09-01)
app\client\src\components (0, 2018-09-01)
app\client\src\components\Header (0, 2018-09-01)
app\client\src\components\Header\Header.js (232, 2018-09-01)
app\client\src\components\Layout (0, 2018-09-01)
app\client\src\components\Layout\Layout.js (371, 2018-09-01)
app\client\src\components\ListItem (0, 2018-09-01)
app\client\src\components\ListItem\ListItem.js (376, 2018-09-01)
app\client\src\components\ListView (0, 2018-09-01)
app\client\src\components\ListView\ListView.js (3389, 2018-09-01)
app\client\src\index.css (66, 2018-09-01)
app\client\src\index.js (580, 2018-09-01)
app\client\src\logo.svg (2671, 2018-09-01)
app\client\src\registerServiceWorker.js (4384, 2018-09-01)
app\client\yarn.lock (268090, 2018-09-01)
app\lib (0, 2018-09-01)
app\lib\BrowserStackContext.php (6147, 2018-09-01)
app\lib\BrowserStackMethods.php (3032, 2018-09-01)
app\lib\parallel.php (755, 2018-09-01)
capabilities.txt (234711, 2018-09-01)
composer.json (1127, 2018-09-01)
... ...

# About this Library This library is to assist Selenium and Browserstack Continious Integration with for BeHat testing in native PHP. There are three ways to setup and run the tests: * **Running Selenium tests locally** * **Running Selenium tests in Docker (with bitbucket Pipelines)** * **Running the Browserstack** The library can be installed into your PHP project using the below composer command which will install the library from Packagist. ``` require jeromeerasmus/selenium-automate:dev-master ``` # Running Selenium tests locally ### Requirements Requires Firefox v39.0 with Selenium v1.4.0 You can download the correct version of Firefox here: https://ftp.mozilla.org/pub/firefox/releases/39.0/ Remember to turn automatic updates off Firefox as soon as it is installed. ### Setup First grab the latest JRE and install it on your machine as Selenium runs on the JRE. You first need to install selenium on your machine in order to run the Selenium tests. On OSX this should be as easy as: ``` brew install selenium-server-standalone ``` Next configure your composer.json file with the below commands to be able to run the Selenium tests locally. ``` "scripts": { "start-selenium": "vendor/bin/manager start", "run-selenium": "vendor/bin/behat --config=conf.selenium.yml -f pretty -o std -f junit -o results" } ``` Next, copy dist.conf.selenium.yml and dist.conf.browserstack.yml to conf.selenium.yml and conf.browserstack.yml and then edit them to match your project specifications. You will only need to edit the **base_url** field for this config. ### Executing the tests Then perform the below: First start Selenium in a new terminal window. Leave it running. ``` composer start-selenium ``` Then open up a new terminal window and run the sample tests with: ``` composer run-selenium ``` # Running Selenium tests in Docker (with bitbucket Pipelines) This configuration allows you to run your tests with Docker. ### Requirements Docker and Docker Compose installed on your machine. (of course) ### Setup In the root folder perform the below steps: 1. Create a Dockerfile with the below contents: ``` FROM mycrm/base COPY . /var/specs WORKDIR /var/specs # Config ENTRYPOINT ["vendor/bin/behat"] ``` 2. Create a docker-compose file with the below contents: ``` version: '2' services: specs: build: . volumes: - .:/var/specs container_name: mycrm-specs links: - firefox-server environment: BEHAT_PARAMS: '{"extensions" : {"Behat\\MinkExtension" : {"base_url" : "https://it.wikipedia.org/"}}}' firefox-server: container_name: mycrm-specs-server #image: selenium/standalone-firefox-debug:2.53.0 image: selenium/standalone-firefox:2.53.0 ports: - "4444:4444" - "5900:5900" ``` Now you can execute the below command which will build the Docker images and run the tests. ``` docker-compose -f docker-compose.yml run --rm specs --config=conf.selenium-docker.yml ``` ### Setup Bitbucket Pipelines script You can run the tests on Bitbucket Pipelines by creating the below bitbucket-pipelines.yml file in your root folder. You can use the below script for the contents. ``` pipelines: default: - step: image: jeromeerasmus/docker-alpine-php-composer:7.0 services: - docker script: - composer install - docker-compose -f docker-compose.yml run --rm specs --config=conf.selenium-docker.yml ``` # Selenium Automate (with Browserstack) [Behat](https://github.com/Behat/Behat) Integration with BrowserStack. ## Setup * Clone the repo into your project root * Cd into the repo folder on your local machine * Install dependencies `composer install` * First copy dist.conf.selenium.yml and dist.conf.browserstack.yml to conf.selenium.yml and conf.browserstack.yml and then edit them to match your project specifications. * Then copy the dist.env file to .env and update with your browserstack keys ### Creating the capabilities config You define a capabilities configuration file to explicity set which browsers / devices / operating systems you will test on. To get the full updated list of capabilities from browserstack run the following command: ``` composer capabilities ``` This will bring down an exhaustive list of ALL capabilities. Look through the list and pick out the capabilities you want to run your tests on. You can use these capabilities to update your .yml files Once the above is done correctly you will be able to run your tests. ``` ## Running the Selenium tests First grab the latest JRE and install it on your machine as Selenium runs on the JRE. You first need to install selenium on your machine in order to run the Selenium tests. On OSX this should be as easy as: ``` brew install selenium-server-standalone ``` Then perform the below: First start Selenium ``` composer start-selenium ``` Then run the test ``` composer run-selenium ``` ## Running the Browserstack tests To run a test in browserstack execute ``` composer run-bs ``` ### Manufaturing tests by the dozen The below is some basic workflow tips to save you some time. The below is not essential to running your tests. Scaffold a BeHat project structure and key files ``` ./bin/behat --init ``` After writing your .feature file run the below to create the code snippet and auotmoatically place it into the Feature context file ``` ./bin/behat --append-snippets ``` ## Notes * You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate) * To test on a different set of browsers, check out [platform configurator](https://www.browserstack.com/automate/php#setting-os-and-browser)

近期下载者

相关文件


收藏者