Verified Commit 70bb2dd5 authored by Korko's avatar Korko
Browse files

Add Dusk tests (via Browserstack)

parent 4dc7bd4a
Pipeline #366661 failed with stages
in 2 minutes and 53 seconds
......@@ -60,4 +60,7 @@ PUSHER_APP_SECRET=
PUSHER_APP_HOST=secretsanta.fr
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_PUSHER_APP_HOST="${PUSHER_APP_HOST}"
\ No newline at end of file
MIX_PUSHER_APP_HOST="${PUSHER_APP_HOST}"
BROWSERSTACK_USERNAME=
BROWSERSTACK_ACCESS_KEY=
......@@ -49,6 +49,29 @@ phpunit:
- php artisan key:generate
- phpunit --coverage-text --colors=never
dusk-main:
stage: tests
script:
- cp .env.example .env
- php artisan key:generate
- BROWSERSTACK_BROWSER=WINDOWS_10_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_10_FIREFOX php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_7_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_7_FIREFOX php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_FIREFOX php artisan dusk
dusk:
stage: tests
script:
- cp .env.example .env
- php artisan key:generate
- BROWSERSTACK_BROWSER=WINDOWS_10_EDGE php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_10_IE php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_SAFARI php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_EDGE php artisan dusk
allow_failure: true
php-metrics:
stage: metrics
script:
......
......@@ -10,9 +10,4 @@ use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function noop()
{
}
}
......@@ -29,11 +29,11 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
//\App\Http\Middleware\EncryptCookies::class,
//\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
//\Illuminate\Session\Middleware\StartSession::class,
//\Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
......@@ -59,11 +59,11 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\Illuminate\Session\Middleware\StartSession::class,
//\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\EncryptCookies::class,
//\App\Http\Middleware\EncryptCookies::class,
\App\Http\Middleware\HandleEncryptionKey::class,
\App\Http\Middleware\VerifyCsrfToken::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
];
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d47b49302a68a527d779817286b90c46",
"content-hash": "c910e71948f1d188011c06d842dd092e",
"packages": [
{
"name": "anhskohbo/no-captcha",
......@@ -5325,6 +5325,126 @@
],
"time": "2020-09-07T19:32:39+00:00"
},
{
"name": "browserstack/browserstack-local",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/browserstack/browserstack-local-php.git",
"reference": "491c6e31960ce8111d2cb70cb84d03e73f270dbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/browserstack/browserstack-local-php/zipball/491c6e31960ce8111d2cb70cb84d03e73f270dbb",
"reference": "491c6e31960ce8111d2cb70cb84d03e73f270dbb",
"shasum": ""
},
"require": {
"php": ">=5.3.19"
},
"require-dev": {
"phpunit/phpunit": "4.6.*"
},
"suggest": {
"phpdocumentor/phpdocumentor": "2.*"
},
"type": "library",
"autoload": {
"psr-4": {
"BrowserStack\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP bindings for BrowserStack Local",
"homepage": "https://github.com/browserstack/browserstack-local-php",
"keywords": [
"BrowserStack",
"browserstacklocal",
"local",
"php",
"selenium"
],
"time": "2016-09-19T13:39:06+00:00"
},
{
"name": "chinleung/laravel-browserstack",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Korko/laravel-browserstack.git",
"reference": "0e24ffeb94c96c44b7fc67f126d7e18b2a64c5d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Korko/laravel-browserstack/zipball/0e24ffeb94c96c44b7fc67f126d7e18b2a64c5d6",
"reference": "0e24ffeb94c96c44b7fc67f126d7e18b2a64c5d6",
"shasum": ""
},
"require": {
"browserstack/browserstack-local": "^1.1",
"guzzlehttp/guzzle": "^6.5|^7.0.1",
"illuminate/support": "~5.8.0|^6.0|^7.0",
"laravel/dusk": "^6.0",
"php": "^7.2"
},
"require-dev": {
"orchestra/testbench": "3.8.*",
"phpunit/phpunit": "^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"ChinLeung\\BrowserStack\\BrowserStackServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"ChinLeung\\BrowserStack\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"ChinLeung\\BrowserStack\\Tests\\": "tests"
}
},
"scripts": {
"test": [
"vendor/bin/phpunit"
],
"test-coverage": [
"vendor/bin/phpunit --coverage-html coverage"
]
},
"license": [
"MIT"
],
"authors": [
{
"name": "Chin Leung",
"email": "hello@chinleung.com",
"role": "Developer"
}
],
"description": "Run Laravel Dusk tests on BrowserStack.",
"homepage": "https://github.com/chinleung/laravel-browserstack",
"keywords": [
"automate",
"browserstack",
"chinleung",
"laravel-browserstack",
"laravel-dusk",
"testing"
],
"support": {
"source": "https://github.com/Korko/laravel-browserstack/tree/master"
},
"time": "2020-11-25T17:32:15+00:00"
},
{
"name": "composer/semver",
"version": "3.2.4",
......@@ -6032,6 +6152,74 @@
],
"time": "2020-07-09T08:09:16+00:00"
},
{
"name": "laravel/dusk",
"version": "v6.9.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/dusk.git",
"reference": "13b22f13f4f18f9524e523ec5f06bbb3b2b3fdd9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/dusk/zipball/13b22f13f4f18f9524e523ec5f06bbb3b2b3fdd9",
"reference": "13b22f13f4f18f9524e523ec5f06bbb3b2b3fdd9",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-zip": "*",
"illuminate/console": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"nesbot/carbon": "^2.0",
"php": "^7.2|^8.0",
"php-webdriver/webdriver": "^1.9.0",
"symfony/console": "^4.3|^5.0",
"symfony/finder": "^4.3|^5.0",
"symfony/process": "^4.3|^5.0",
"vlucas/phpdotenv": "^3.0|^4.0|^5.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.5.15|^8.4|^9.0"
},
"suggest": {
"ext-pcntl": "Used to gracefully terminate Dusk when tests are running."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Dusk\\DuskServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Dusk\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Dusk provides simple end-to-end testing and browser automation.",
"keywords": [
"laravel",
"testing",
"webdriver"
],
"time": "2020-11-24T16:48:27+00:00"
},
{
"name": "martinlindhe/laravel-vue-i18n-generator",
"version": "0.1.46",
......@@ -6571,6 +6759,73 @@
],
"time": "2020-10-14T08:39:05+00:00"
},
{
"name": "php-webdriver/webdriver",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/php-webdriver/php-webdriver.git",
"reference": "e3633154554605274cc9d59837f55a7427d72003"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/e3633154554605274cc9d59837f55a7427d72003",
"reference": "e3633154554605274cc9d59837f55a7427d72003",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-zip": "*",
"php": "^5.6 || ~7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.12",
"symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0"
},
"replace": {
"facebook/webdriver": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.0",
"ondram/ci-detector": "^2.1 || ^3.5",
"php-coveralls/php-coveralls": "^2.4",
"php-mock/php-mock-phpunit": "^1.1 || ^2.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^3.3 || ^4.0 || ^5.0"
},
"suggest": {
"ext-SimpleXML": "For Firefox profile creation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.8.x-dev"
}
},
"autoload": {
"psr-4": {
"Facebook\\WebDriver\\": "lib/"
},
"files": [
"lib/Exception/TimeoutException.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.",
"homepage": "https://github.com/php-webdriver/php-webdriver",
"keywords": [
"Chromedriver",
"geckodriver",
"php",
"selenium",
"webdriver"
],
"time": "2020-11-19T15:21:05+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
......@@ -8491,6 +8746,7 @@
"minimum-stability": "dev",
"stability-flags": {
"korko/validator": 20,
"chinleung/laravel-browserstack": 20,
"matt-allan/laravel-code-style": 20
},
"prefer-stable": true,
......
<?php
return [
/*
|--------------------------------------------------------------------------
| Credentials
|--------------------------------------------------------------------------
|
| Your username and access key for BrowserStack.
| https://www.browserstack.com/accounts/settings
|
*/
'username' => env('BROWSERSTACK_USERNAME'),
'key' => env('BROWSERSTACK_ACCESS_KEY'),
/*
|--------------------------------------------------------------------------
| Browser
|--------------------------------------------------------------------------
|
| The browser slug to run on BrowserStack.
|
*/
'browser' => env('BROWSERSTACK_BROWSER', 'WINDOWS_10_CHROME'),
/*
|--------------------------------------------------------------------------
| Session
|--------------------------------------------------------------------------
|
| Configuration to make BrowserStack run each tests in a different
| session.
|
*/
'separate_sessions' => env('BROWSERSTACK_SEPARATE_SESSIONS', true),
/*
|--------------------------------------------------------------------------
| Capabilities
|--------------------------------------------------------------------------
|
| The configuration for capabilities of the browser.
| https://www.browserstack.com/automate/capabilities
|
*/
'capabilities' => [
'acceptSslCerts' => env('BROWSERSTACK_ACCEPT_SSL', true),
'browserstack' => [
'console' => env('BROWSERSTACK_CONSOLE', 'verbose'),
'local' => env('BROWSERSTACK_LOCAL_TUNNEL', true),
'timezone' => env('BROWSERSTACK_TIMEZONE', config('app.timezone')),
],
'resolution' => env('BROWSERSTACK_RESOLUTION', '1920x1080'),
],
/*
|--------------------------------------------------------------------------
| Command Arguments
|--------------------------------------------------------------------------
|
| The arguments and flags to use for the BrowserStack local connection.
|
*/
'arguments' => [
'binaryPath' => env('BROWSERSTACK_CLI_BINARY_PATH'),
'logFile' => env('BROWSERSTACK_CLI_LOG_FILE'),
'v' => env('BROWSERSTACK_CLI_VERBOSE'),
'force' => env('BROWSERSTACK_CLI_FORCE'),
'only' => env('BROWSERSTACK_CLI_ONLY'),
'onlyAutomate' => env('BROWSERSTACK_CLI_ONLY_AUTOMATE'),
'forcelocal' => env(
'BROWSERSTACK_CLI_FORCE_LOCAL',
env('BROWSERSTACK_LOCAL_TUNNEL', true)
),
'localIdentifier' => env('BROWSERSTACK_CLI_LOCAL_IDENTIFIER'),
'proxyHost' => env('BROWSERSTACK_CLI_PROXY_HOST'),
'proxyPort' => env('BROWSERSTACK_CLI_PROXY_PORT'),
'proxyUser' => env('BROWSERSTACK_CLI_PROXY_USER'),
'proxyPass' => env('BROWSERSTACK_CLI_PROXY_PASSWORD'),
'forceproxy' => env('BROWSERSTACK_CLI_FORCE_PROXY'),
'hosts' => env('BROWSERSTACK_CLI_HOSTS'),
'f' => env('BROWSERSTACK_CLI_F'),
],
];
......@@ -19686,11 +19686,6 @@ if (key) {
axios__WEBPACK_IMPORTED_MODULE_7___default.a.defaults.headers.common['X-HASH-KEY'] = key;
}
 
setInterval(function () {
// Nothing to do, this call will update the cookie if needed
axios__WEBPACK_IMPORTED_MODULE_7___default.a.get('/xsrf');
}, 5 * 60 * 1000); // Call every 5min
 
axios__WEBPACK_IMPORTED_MODULE_7___default.a.interceptors.response.use(function (response) {
var _response$data;
......@@ -19700,7 +19695,7 @@ axios__WEBPACK_IMPORTED_MODULE_7___default.a.interceptors.response.use(function
}, function (error) {
var _error$response, _error$response$data;
 
if ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) _partials_alertify_js__WEBPACK_IMPORTED_MODULE_8__["default"].errorAlert(error.response.data.message);
if ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.error) _partials_alertify_js__WEBPACK_IMPORTED_MODULE_8__["default"].errorAlert(error.response.data.error);
return error;
});
['get', 'delete', 'head', 'options'].forEach(function (method) {
......
......@@ -22206,11 +22206,6 @@ if (key) {
axios__WEBPACK_IMPORTED_MODULE_7___default.a.defaults.headers.common['X-HASH-KEY'] = key;
}
 
setInterval(function () {
// Nothing to do, this call will update the cookie if needed
axios__WEBPACK_IMPORTED_MODULE_7___default.a.get('/xsrf');
}, 5 * 60 * 1000); // Call every 5min
 
axios__WEBPACK_IMPORTED_MODULE_7___default.a.interceptors.response.use(function (response) {
var _response$data;
......@@ -22220,7 +22215,7 @@ axios__WEBPACK_IMPORTED_MODULE_7___default.a.interceptors.response.use(function
}, function (error) {
var _error$response, _error$response$data;
 
if ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) _partials_alertify_js__WEBPACK_IMPORTED_MODULE_8__["default"].errorAlert(error.response.data.message);
if ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.error) _partials_alertify_js__WEBPACK_IMPORTED_MODULE_8__["default"].errorAlert(error.response.data.error);
return error;
});
['get', 'delete', 'head', 'options'].forEach(function (method) {
......
......@@ -9842,241 +9842,253 @@ var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("tr", { staticClass: "participant" }, [
_c("td", { staticClass: "align-middle" }, [
_c("div", { staticClass: "input-group" }, [
_c("span", { staticClass: "input-group-prepend counter" }, [
_c(
"span",
{ staticClass: "input-group-text" },
[
_vm._v(_vm._s(_vm.idx + 1)),
_vm.idx === 0
? [_vm._v(" - " + _vm._s(_vm.$t("form.participant.organizer")))]
: _vm._e()
],
2
)
]),
_vm._v(" "),
_c("input", {
staticClass: "form-control participant-name",
class: {
"is-invalid":
_vm.$v.name.$error ||
_vm.fieldError("participants." + _vm.idx + ".name")
},
attrs: {
type: "text",
name: "participants[" + _vm.idx + "][name]",
placeholder: _vm.$t("form.participant.name.placeholder"),
"aria-invalid":
_vm.$v.name.$error ||
_vm.fieldError("participants." + _vm.idx + ".name")
},
domProps: { value: _vm.name },
on: {
input: function($event) {
return _vm.changeName($event.target.value)
return _c(
"tr",
{ staticClass: "participant", attrs: { dusk: "participant" + _vm.idx } },
[
_c("td", { staticClass: "align-middle" }, [
_c("div", { staticClass: "input-group" }, [
_c("span", { staticClass: "input-group-prepend counter" }, [
_c(
"span",
{ staticClass: "input-group-text" },
[
_vm._v(_vm._s(_vm.idx + 1)),
_vm.idx === 0
? [
_vm._v(
" - " + _vm._s(_vm.$t("form.participant.organizer"))
)
]
: _vm._e()
],
2
)
]),
_vm._v(" "),
_c("input", {
staticClass: "form-control participant-name",
class: {
"is-invalid":
_vm.$v.name.$error ||
_vm.fieldError("participants." + _vm.idx + ".name")
},
attrs: {
type: "text",
name: "participants[" + _vm.idx + "][name]",
placeholder: _vm.$t("form.participant.name.placeholder"),
"aria-invalid":
_vm.$v.name.$error ||
_vm.fieldError("participants." + _vm.idx + ".name")
},
blur: function($event) {
return _vm.$v.name.$touch()
domProps: { value: _vm.name },
on: {
input: function($event) {
return _vm.changeName($event.target.value)
},
blur: function($event) {
return _vm.$v.name.$touch()
}