diff --git a/.ci/runtests.sh b/.ci/runtests.sh
new file mode 100755
index 000000000..0873d89ff
--- /dev/null
+++ b/.ci/runtests.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
+
+if [ -z "${DISPLAY:-}" ]; then
+ echo Start Xvfb;
+ export DISPLAY=:99.0;
+ /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x24;
+fi
+
+if ! $(nc -z localhost 4444); then
+ $SELF_PATH/../vendor/bin/selenium-server-standalone -role hub -log $SELF_PATH/../selenium-server.log -enablePassThrough false &
+ until $(nc -z localhost 4444); do
+ echo Waiting for selenium hub to start...;
+ sleep 1;
+ done
+fi
+
+export PATH="$SELF_PATH/../vendor/bin:$PATH"
+if ! $(nc -z localhost 8910); then
+ java -Dwebdriver.chrome.driver="$SELF_PATH/../vendor/bin/chromedriver" -jar $SELF_PATH/../vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -role node -port 8910 -log $SELF_PATH/..selenium-node.log &
+ until $(nc -z localhost 8910); do
+ echo Waiting for selenium node to start...;
+ sleep 1;
+ done
+fi
+
+if ! $(nc -z localhost 8000); then
+ pushd $SELF_PATH/..
+ php laravel serve &
+ popd
+ until $(nc -z localhost 8000); do
+ echo Waiting for laravel serve to start...;
+ sleep 1;
+ done
+fi
+
+$SELF_PATH/../vendor/bin/steward run laravel chrome -vvv
diff --git a/.ci/server-cc.php b/.ci/server-cc.php
new file mode 100644
index 000000000..1ab9a48b2
--- /dev/null
+++ b/.ci/server-cc.php
@@ -0,0 +1,33 @@
+/dev/null
+}
+
+function deleteimg() {
+ hash=$1
+ curl -H "Authorization: Client-ID $IMGUR_CLIENTID" \
+ -X "DELETE" \
+ https://api.imgur.com/3/image/$hash 2>/dev/null
+}
+
+if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
+
+ comments=$(api /issues/$TRAVIS_PULL_REQUEST/comments)
+
+ for ((i=1;i<=4294967295;i++)); do
+ comment=$(echo $comments | jq -r ".[$i]")
+ if [ "$comment" = "null" ]; then
+ break;
+ fi
+
+ body=$(echo $comment | jq -r ".body")
+ if $(echo $body | grep -q "^\[test\]"); then
+ id=$(echo $comment | jq -r ".id")
+ hash=$(echo "$body" | grep "\[id:" | sed -s 's/.*\[id\:\(.*\)\]/\1/g' 2>/dev/null)
+
+ echo Delete previous screenshot $id with $hash
+ if [ -n "${hash:-}" ]; then
+ echo Delete img
+ status=$(deleteimg $hash)
+ fi
+ api /issues/comments/$id DELETE
+ fi
+
+ done
+
+ for file in $(ls logs/*.png); do
+ echo Upload img and comment for $file
+ img=$(uploadimg $file)
+ success=$(echo $img | jq -r ".success")
+ if [ "$success" = "true" ]; then
+ url=$(echo $img | jq -r ".data.link")
+ echo $url
+ deletehash=$(echo $img | jq -r ".data.deletehash")
+ result=$(api /issues/$TRAVIS_PULL_REQUEST/comments POST "{ \"body\": \"[test]\n\n$file\n[id:$deletehash]\"}")
+ fi
+ done
+
+fi
diff --git a/.env.travis b/.env.travis
index 4fe186d88..f9db091e7 100644
--- a/.env.travis
+++ b/.env.travis
@@ -1,5 +1,6 @@
APP_ENV=testing
APP_KEY=base64:NTrXToqFZJlv48dgPc+kNpc3SBt333TfDnF1mDShsBg=
+APP_URL=http://localhost:8000
DB_CONNECTION=testing
DB_TEST_HOST=127.0.0.1
@@ -8,7 +9,7 @@ DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
-SESSION_DRIVER=array
+SESSION_DRIVER=file
QUEUE_DRIVER=sync
2FA_ENABLED=false
diff --git a/.travis.yml b/.travis.yml
index 3948e35fa..de1405be0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,47 +10,54 @@ services:
jdk:
- oraclejdk8
+git:
+ depth: false
+
addons:
chrome: stable
+# sauce_connect:
+# username: "asbiin"
+# jwt:
+# secure: "niuYhwCsFVUHS6DU3j0xi24habQOSqKpzo7qUlGmlx1x31wZNDrl+wfifeTVv6nnjoShyr4s6svn3ULl1K8tQMdyHJlO247WKMg/PSnaSUyll5+luuP5SLpV+USP8g9a7HAjU+jQO5uE/GXKDDQcD+o5dV6gv9stmc9u/np45kwgVx55bj013ll0M5qlyflJZFgp3b/M+bvqkvIFDPN2U7iFs0dkhqxBI+6qbTAN4aTtxPSPrsYdt9W8Re1suzy2/CJEEQ2xKE4zm7WQ2dg6BrpbaU2bdG6wWZUw2toA8iCyxFgbJUlXmAjPEQ5Wr+gWEQ9bLcwCIoHxUMIRbqY/SNzve7KnGXOUEF0yttyAv3aq9STA58Mr+H15zXdA5ZAwpE/tNojfaacEya/bg9fwUWOCqrPXIhwFirhf8oD2y8n+SWD27rP0qD9um9HGqGkh6bqFefIZi2xVzLya1r/2kxqFskrj+0xPjjKYwMwJIM5s7HyrtIxR7QTpFEbgHpZjCmT31I65ds56ec34wbZ0W61bm4aQAxz7UIedCYsTrqtTzTYxUJEht3/1D5FH0PSBWQACJmdjSHvh0pP7zzG2cqzq2IhHCSZjnhh6LGUPQtgZh3kq1fSP0Zw74iSVrxQETsGoPwYA6R38e+V39vV8yUHjMUXNPIhgcQQZHiZcEWI="
+
+env:
+ global:
+# - SAUCELABS=1
before_script:
- cp .env.travis .env
+ - mkdir -p $TRAVIS_BUILD_DIR/results/coverage
- mysql -e 'create database monica;'
- composer self-update
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
-
- # Start Xvfb
- - "export DISPLAY=:99.0"
- - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x24"
-
- # Start selenium server
- - vendor/bin/selenium-server-standalone -role hub -log selenium-server.log -enablePassThrough false &
- - until $(echo | nc localhost 4444); do sleep 1; echo Waiting for selenium hub to start...; done;
-
- # Start selenium node for headless Chrome
- - export PATH="$(pwd)/vendor/bin:$PATH"
- - vendor/bin/selenium-server-standalone -role node -port 8910 -log selenium-node.log -enablePassThrough false &
- - until $(echo | nc localhost 8910); do sleep 1; echo Waiting for selenium node to start...; done;
+ - if [ ! "$SAUCELABS" = "1" ]; then .ci/start-selenium.sh; fi
script:
- php artisan migrate --env=testing --no-interaction -vvv
- php artisan db:seed --env=testing --no-interaction -vvv
+
+ # Run unit tests
- vendor/bin/phpunit
# Start http server
- - php artisan serve &
- - until $(echo | nc localhost 8000); do sleep 1; echo Waiting for laravel server to start...; done;
- - vendor/bin/steward run laravel chrome
+ - php -S 127.0.0.1:8000 -t $TRAVIS_BUILD_DIR/public $TRAVIS_BUILD_DIR/.ci/server-cc.php &
+ - until $(nc -z localhost 8000); do sleep 1; echo Waiting for laravel server to start...; done;
+
+ # Run browser tests
+ - if [ "$SAUCELABS" = "1" ]; then vendor/bin/steward run travis chrome -vvv --server-url=http://$SAUCE_USERNAME:$SAUCE_ACCESS_KEY@localhost:4445 --capability="tunnel-identifier:'${TRAVIS_JOB_NUMBER}'"; fi
+ - if [ ! "$SAUCELABS" = "1" ]; then vendor/bin/steward run travis chrome -vvv; fi
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
after_script:
- vendor/bin/steward results -vvv
+ - .ci/travis-report.sh 2>/dev/null
- cat selenium-server.log
- cat selenium-node.log
+ - vendor/bin/phpcov merge --clover=$TRAVIS_BUILD_DIR/results/coverage2.xml $TRAVIS_BUILD_DIR/results/coverage/
- ./travis-sonar.sh
-after_success:
- - bash <(curl -s https://codecov.io/bash) -f results/clover.xml
-
cache:
directories:
- $HOME/.sonar/cache
diff --git a/.travis.yml.sig b/.travis.yml.sig
index d071043b9..930bbc3ad 100644
Binary files a/.travis.yml.sig and b/.travis.yml.sig differ
diff --git a/composer.json b/composer.json
index 8a390a160..650e4feac 100644
--- a/composer.json
+++ b/composer.json
@@ -44,7 +44,9 @@
"enm1989/chromedriver": "^2.35",
"filp/whoops": "~2.0",
"lmc/steward": "dev-update-dependencies",
+ "matthiasnoback/live-code-coverage": "^0.1.0",
"mockery/mockery": "0.9.*",
+ "phpunit/phpcov": "^4.0",
"phpunit/phpunit": "~6.0",
"se/selenium-server-standalone": "^3.8",
"symfony/css-selector": "2.8.*|3.0.*",
diff --git a/composer.lock b/composer.lock
index 77692a2b0..4edff7f3a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "7c9cfda37b6baf88fdb6c61214df9d54",
+ "content-hash": "bb59cf258b0e181fe56399176e1cd1ef",
"packages": [
{
"name": "aws/aws-sdk-php",
- "version": "3.50.0",
+ "version": "3.51.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
- "reference": "ed3308588d5d8d8f7a96dc93ff297988cefa7b4a"
+ "reference": "a932a76e110dc2c65c216de21a1aa65e151d21ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ed3308588d5d8d8f7a96dc93ff297988cefa7b4a",
- "reference": "ed3308588d5d8d8f7a96dc93ff297988cefa7b4a",
+ "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a932a76e110dc2c65c216de21a1aa65e151d21ef",
+ "reference": "a932a76e110dc2c65c216de21a1aa65e151d21ef",
"shasum": ""
},
"require": {
@@ -84,7 +84,7 @@
"s3",
"sdk"
],
- "time": "2018-01-18T01:08:26+00:00"
+ "time": "2018-01-19T20:32:42+00:00"
},
{
"name": "bacon/bacon-qr-code",
@@ -3165,16 +3165,16 @@
},
{
"name": "ramsey/uuid",
- "version": "3.7.2",
+ "version": "3.7.3",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
- "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d"
+ "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/bba83ad77bb9deb6d3c352a7361b818e415b221d",
- "reference": "bba83ad77bb9deb6d3c352a7361b818e415b221d",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76",
+ "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76",
"shasum": ""
},
"require": {
@@ -3185,17 +3185,15 @@
"rhumsaa/uuid": "self.version"
},
"require-dev": {
- "apigen/apigen": "^4.1",
"codeception/aspect-mock": "^1.0 | ~2.0.0",
"doctrine/annotations": "~1.2.0",
"goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1",
"ircmaxell/random-lib": "^1.1",
"jakub-onderka/php-parallel-lint": "^0.9.0",
- "mockery/mockery": "^0.9.4",
+ "mockery/mockery": "^0.9.9",
"moontoast/math": "^1.1",
"php-mock/php-mock-phpunit": "^0.3|^1.1",
"phpunit/phpunit": "^4.7|^5.0",
- "satooshi/php-coveralls": "^0.6.1",
"squizlabs/php_codesniffer": "^2.3"
},
"suggest": {
@@ -3243,7 +3241,7 @@
"identifier",
"uuid"
],
- "time": "2018-01-13T22:22:03+00:00"
+ "time": "2018-01-20T00:28:24+00:00"
},
{
"name": "roave/security-advisories",
@@ -5556,12 +5554,12 @@
"source": {
"type": "git",
"url": "https://github.com/asbiin/steward.git",
- "reference": "ed94e0c16935f3966235bf22a15d0d370451977f"
+ "reference": "6aa4baf0d5fd072560c8129ac0418a73873e4a3f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/asbiin/steward/zipball/ed94e0c16935f3966235bf22a15d0d370451977f",
- "reference": "ed94e0c16935f3966235bf22a15d0d370451977f",
+ "url": "https://api.github.com/repos/asbiin/steward/zipball/6aa4baf0d5fd072560c8129ac0418a73873e4a3f",
+ "reference": "6aa4baf0d5fd072560c8129ac0418a73873e4a3f",
"shasum": ""
},
"require": {
@@ -5576,9 +5574,9 @@
"nette/reflection": "^2.4.2",
"ondram/ci-detector": "^2.1",
"php": "^5.6 || ~7.0",
- "phpunit/phpunit": "~6.0",
+ "phpunit/phpunit": "^5.7.26 || ^6.5.5",
"symfony/console": "^3.3.0",
- "symfony/event-dispatcher": "~4.0",
+ "symfony/event-dispatcher": "~3.0 || ~4.0",
"symfony/filesystem": "~3.0",
"symfony/finder": "~3.0",
"symfony/options-resolver": "^3.2",
@@ -5589,7 +5587,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"php-coveralls/php-coveralls": "^1.0.2",
- "php-mock/php-mock-phpunit": "~1.0",
+ "php-mock/php-mock-phpunit": "~2.0.0",
"squizlabs/php_codesniffer": "^2.4.1",
"symfony/var-dumper": "^3.2"
},
@@ -5646,7 +5644,41 @@
"support": {
"source": "https://github.com/asbiin/steward/tree/update-dependencies"
},
- "time": "2018-01-08T22:00:01+00:00"
+ "time": "2018-01-18T22:23:53+00:00"
+ },
+ {
+ "name": "matthiasnoback/live-code-coverage",
+ "version": "v0.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/matthiasnoback/live-code-coverage.git",
+ "reference": "8bca6731e8ac022910c480f45c2200c60ad0bd11"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/matthiasnoback/live-code-coverage/zipball/8bca6731e8ac022910c480f45c2200c60ad0bd11",
+ "reference": "8bca6731e8ac022910c480f45c2200c60ad0bd11",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0",
+ "phpunit/php-code-coverage": "^4.0 || ^5.2",
+ "phpunit/phpunit": "^5.7 || ^6.0",
+ "webmozart/assert": "^1.2"
+ },
+ "require-dev": {
+ "symfony/filesystem": "^3.3",
+ "symfony/finder": "^3.3",
+ "symfony/process": "^3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "time": "2017-10-28T08:02:01+00:00"
},
{
"name": "mockery/mockery",
@@ -6645,6 +6677,58 @@
],
"time": "2017-11-27T05:48:46+00:00"
},
+ {
+ "name": "phpunit/phpcov",
+ "version": "4.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpcov.git",
+ "reference": "1fc7ed3179a3ed27a386cd2336e91d8e747a3d71"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpcov/zipball/1fc7ed3179a3ed27a386cd2336e91d8e747a3d71",
+ "reference": "1fc7ed3179a3ed27a386cd2336e91d8e747a3d71",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0",
+ "phpunit/php-code-coverage": "^5.2.1",
+ "phpunit/phpunit": "^6.0",
+ "sebastian/diff": "^1.1 || ^2.0",
+ "sebastian/finder-facade": "^1.1",
+ "sebastian/version": "^2.0",
+ "symfony/console": "^3.0 || ^4.0"
+ },
+ "bin": [
+ "phpcov"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "CLI frontend for php-code-coverage",
+ "homepage": "https://github.com/sebastianbergmann/phpcov",
+ "time": "2018-01-17T16:55:55+00:00"
+ },
{
"name": "phpunit/phpunit",
"version": "6.5.5",
@@ -7109,6 +7193,45 @@
],
"time": "2017-04-03T13:19:02+00:00"
},
+ {
+ "name": "sebastian/finder-facade",
+ "version": "1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/finder-facade.git",
+ "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f",
+ "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f",
+ "shasum": ""
+ },
+ "require": {
+ "symfony/finder": "~2.3|~3.0|~4.0",
+ "theseer/fdomdocument": "~1.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.",
+ "homepage": "https://github.com/sebastianbergmann/finder-facade",
+ "time": "2017-11-18T17:31:49+00:00"
+ },
{
"name": "sebastian/global-state",
"version": "2.0.0",
@@ -7656,6 +7779,46 @@
"homepage": "https://symfony.com",
"time": "2018-01-03T07:37:34+00:00"
},
+ {
+ "name": "theseer/fdomdocument",
+ "version": "1.6.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/theseer/fDOMDocument.git",
+ "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/6e8203e40a32a9c770bcb62fe37e68b948da6dca",
+ "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "lib-libxml": "*",
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.",
+ "homepage": "https://github.com/theseer/fDOMDocument",
+ "time": "2017-06-30T11:53:12+00:00"
+ },
{
"name": "theseer/tokenizer",
"version": "1.1.0",
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index 46d061526..715eaec57 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -20,6 +20,7 @@ class DatabaseSeeder extends Seeder
if (env('APP_ENV') == 'testing') {
$this->call(ActivityTypesTableSeeder::class);
$this->call(CountriesSeederTable::class);
+ $this->call(FakeUserTableSeeder::class);
}
if (env('APP_ENV') == 'production') {
diff --git a/phpunit.xml b/phpunit.xml
index 4ff2bfd88..5bce945a4 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/tests/BrowserSelenium/BaseTestCase.php b/tests/BrowserSelenium/BaseTestCase.php
index c69333364..e61d539cd 100644
--- a/tests/BrowserSelenium/BaseTestCase.php
+++ b/tests/BrowserSelenium/BaseTestCase.php
@@ -4,6 +4,7 @@ namespace Tests\BrowserSelenium;
use Lmc\Steward\ConfigProvider;
use Lmc\Steward\Test\AbstractTestCase;
+use Facebook\WebDriver\WebDriverExpectedCondition;
/**
* Abstract class for custom tests, could eg. define some properties or instantiate some common components in setUp().
@@ -24,7 +25,10 @@ abstract class BaseTestCase extends AbstractTestCase
// Set base url according to environment
switch (ConfigProvider::getInstance()->env) {
case 'dev':
- self::$baseUrl = env('APP_URL');
+ self::$baseUrl = 'http://monica.test/'; // env('APP_URL');
+ break;
+ case 'travis':
+ self::$baseUrl = 'http://localhost:8000/';
break;
case 'laravel':
self::$baseUrl = 'http://127.0.0.1:8000/';
@@ -42,4 +46,42 @@ abstract class BaseTestCase extends AbstractTestCase
$this->warn('The tests are run against production, so be careful!');
}
}
+
+ /**
+ * Init the WebDriver.
+ * (init should be run with "before" phpunit annotation, but it doesn't work !).
+ */
+ public function init()
+ {
+ $this->wd->get(self::$baseUrl);
+ }
+
+ /**
+ * Init WebDriver and pass the login form.
+ */
+ public function initAndLogin()
+ {
+ $this->init();
+
+ if ($this->getCurrentPath() == '/') {
+ //$url = $this->wd->getCurrentURL();
+ $this->findById('email')->sendKeys('admin@admin.com');
+ $this->findById('password')->sendKeys('admin');
+ $this->findByTag('button')->submit();
+
+ $this->wd->wait()->until(
+ WebDriverExpectedCondition::urlContains('/dashboard')
+ );
+ }
+ }
+
+ /**
+ * Get the current url path.
+ */
+ public function getCurrentPath()
+ {
+ return urldecode(
+ parse_url($this->wd->getCurrentURL(), PHP_URL_PATH)
+ );
+ }
}
diff --git a/tests/BrowserSelenium/SimpleTest.php b/tests/BrowserSelenium/SimpleTest.php
index ad542fde4..c7a6fb28f 100644
--- a/tests/BrowserSelenium/SimpleTest.php
+++ b/tests/BrowserSelenium/SimpleTest.php
@@ -4,20 +4,27 @@ namespace Tests\BrowserSelenium;
class SimpleTest extends BaseTestCase
{
- /**
- * init should be run with "before" phpunit annotation, but it doesn't work !
- */
- public function init()
- {
- $this->wd->get(self::$baseUrl);
- }
-
/**
* A basic browser test example.
*/
public function testBasicExample()
{
$this->init();
+
$this->assertContains('Monica', $this->wd->getTitle());
+ $this->assertEquals('/', $this->getCurrentPath());
+ }
+
+ /**
+ * Test Login page.
+ */
+ public function testLogin()
+ {
+ $this->initAndLogin();
+ $this->assertContains('Monica', $this->wd->getTitle());
+ $this->assertEquals('/dashboard', $this->getCurrentPath());
+
+ $link = $this->findByXpath("//a[@href='/logout']");
+ $this->assertNotNull($link);
}
}
diff --git a/travis-sonar.sh b/travis-sonar.sh
index 044a782f4..9afa79227 100755
--- a/travis-sonar.sh
+++ b/travis-sonar.sh
@@ -32,7 +32,7 @@ function CommonParams {
echo -Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.organization=monicahq \
-Dsonar.php.tests.reportPath=./results/junit.xml \
- -Dsonar.php.coverage.reportPaths=./results/clover.xml \
+ -Dsonar.php.coverage.reportPaths=./results/coverage.xml,./results/coverage2.xml \
-Dsonar.projectVersion=$(php artisan monica:getversion) \
$extra
}
diff --git a/travis-sonar.sh.sig b/travis-sonar.sh.sig
index 43a202a0c..aac4ba4f4 100644
Binary files a/travis-sonar.sh.sig and b/travis-sonar.sh.sig differ