Skip to content

Instantly share code, notes, and snippets.

@Hypnopompia
Last active March 20, 2017 22:40
Show Gist options
  • Save Hypnopompia/83e2b0f6ae7752cf28b96cf663fc129a to your computer and use it in GitHub Desktop.
Save Hypnopompia/83e2b0f6ae7752cf28b96cf663fc129a to your computer and use it in GitHub Desktop.
Larval dusk on circle-ci
machine:
php:
version: 7.0.4
environment:
APP_ENV: testing
APP_KEY: base64:wXCJsauDQDVKKfjZrpWAEV2aM9gPVPNi97Lni+4oQ8c=
DB_DATABASE: circle_test
DB_USERNAME: ubuntu
IS_CIRCLE: yes
APP_DEBUG: true
APP_URL: http://127.0.0.1:8000
general:
artifacts:
- "tests/Browser/screenshots"
dependencies:
cache_directories:
- ~/.composer/cache
pre:
# Update Google Chrome.
- google-chrome --version
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main" >> /etc/apt/sources.list.d/google.list'
- sudo apt-get update
- sudo apt-get --only-upgrade install google-chrome-stable
- google-chrome --version
# Install chrome driver
- curl http://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip | gzip -dc > chromedriver
- chmod +x chromedriver
- './chromedriver':
background: true
- sleep 2
post:
- composer global require "laravel/envoy=~1.0"
test:
override:
- 'php ./artisan serve':
background: true
- mkdir -p $CIRCLE_TEST_REPORTS/phpunit
- phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml
deployment:
production: # just a label; label names are completely up to you
branch: master
commands:
- envoy run deploy
<?php
namespace Tests;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Laravel\Dusk\TestCase as BaseTestCase;
abstract class DuskTestCase extends BaseTestCase {
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare() {
if (env('IS_CIRCLE') == "yes") {
// If we're in circleci, the circle.yml file will start the chromedriver for us, so do nothing
return;
}
static::startChromeDriver();
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver() {
return RemoteWebDriver::create(
'http://localhost:9515', DesiredCapabilities::chrome()
);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Browser Tests">
<directory suffix="Test.php">./tests/Browser</directory>
</testsuite>
<testsuite name="Feature Tests">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Unit Tests">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment