diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab108d5..9991221 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,11 +23,28 @@ name: build jobs: codeception: - uses: php-forge/actions/.github/workflows/codeception.yml@main - secrets: - AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }} - with: - os: >- - ['ubuntu-latest'] - php: >- - ['8.1', '8.2', '8.3'] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: composer install + + - name: Download and configure Selenium and Chrome + run: | + wget -c -nc --retry-connrefused --tries=0 https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.14.0/selenium-server-4.14.1.jar -O selenium-server-standalone.jar + java -jar selenium-server-standalone.jar standalone --port 9515 > /dev/null 2>&1& + sleep 1 + wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.88/linux64/chromedriver-linux64.zip + sudo apt-get install unzip + unzip -o -q chromedriver-linux64.zip + cd chromedriver-linux64 + chromedriver --port=9515 --url-base=wd/hub/ > /dev/null 2>&1& + cd .. + google-chrome --product-version + + - name: Run Codeception + run: | + php -S 127.0.0.1:8080 -t public > /dev/null 2>&1& + vendor/bin/codecept run diff --git a/composer.json b/composer.json index ca56a17..643bb7f 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "codeception/lib-innerbrowser": "^4.0", "codeception/module-asserts": "^3.0", "codeception/module-filesystem": "^3.0", + "codeception/module-webdriver": "^4.0", "codeception/module-yii2": "^1.1", "codeception/verify": "^3.0", "maglnet/composer-require-checker": "^4.6", @@ -70,7 +71,6 @@ "codeception/c3": true, "yiisoft/yii2-composer": true, "composer/installers": true, - "hiqdev/composer-config-plugin": true, "oomphinc/composer-installers-extender": true, "yiisoft/config": true } diff --git a/composer.lock b/composer.lock index 0597ba2..3b30141 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "3b59bd62c5a08b27ca48c205b3fca3be", + "content-hash": "857a1ac1f96f0dd54ae26a4ce2347ea0", "packages": [ { "name": "bower-asset/bootstrap", @@ -23,16 +23,16 @@ }, { "name": "bower-asset/inputmask", - "version": "3.3.11", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/RobinHerbots/Inputmask.git", - "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" + "reference": "e0f39e0c93569c6b494c3a57edef2c59313a6b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", - "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" + "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/e0f39e0c93569c6b494c3a57edef2c59313a6b64", + "reference": "e0f39e0c93569c6b494c3a57edef2c59313a6b64" }, "require": { "bower-asset/jquery": ">=1.7" @@ -62,16 +62,16 @@ }, { "name": "bower-asset/punycode", - "version": "v1.3.2", + "version": "v2.2.3", "source": { "type": "git", "url": "https://github.com/mathiasbynens/punycode.js.git", - "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + "reference": "46d412120e2feb868876769a9847790ba278c882" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mathiasbynens/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", - "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + "url": "https://api.github.com/repos/mathiasbynens/punycode.js/zipball/46d412120e2feb868876769a9847790ba278c882", + "reference": "46d412120e2feb868876769a9847790ba278c882" }, "type": "bower-asset" }, @@ -579,56 +579,6 @@ }, "time": "2021-12-15T12:32:42+00:00" }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, { "name": "psr/container", "version": "2.0.2", @@ -1908,25 +1858,24 @@ "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-framework.git", - "reference": "ab8a9feda3b3fdf5c28c3b5f53bcc7bd85a8af2c" + "reference": "9a4561aceb7710beb0bb817a862624a385d3d276" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/ab8a9feda3b3fdf5c28c3b5f53bcc7bd85a8af2c", - "reference": "ab8a9feda3b3fdf5c28c3b5f53bcc7bd85a8af2c", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/9a4561aceb7710beb0bb817a862624a385d3d276", + "reference": "9a4561aceb7710beb0bb817a862624a385d3d276", "shasum": "" }, "require": { - "bower-asset/inputmask": "~3.2.2 | ~3.3.5", + "bower-asset/inputmask": "^5.0.8 ", "bower-asset/jquery": "3.7.*@stable | 3.6.*@stable | 3.5.*@stable | 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", - "bower-asset/punycode": "1.3.*", + "bower-asset/punycode": "^2.2", "bower-asset/yii2-pjax": "~2.0.1", "cebe/markdown": "~1.0.0 | ~1.1.0 | ~1.2.0", "ext-ctype": "*", "ext-mbstring": "*", "ezyang/htmlpurifier": "^4.6", "lib-pcre": "*", - "paragonie/random_compat": ">=1", "php": ">=8.1", "yiisoft/yii2-composer": "~2.0.4" }, @@ -2022,7 +1971,7 @@ "type": "tidelift" } ], - "time": "2023-09-30T11:52:51+00:00" + "time": "2023-10-19T17:21:07+00:00" }, { "name": "yiisoft/yii2-bootstrap5", @@ -2773,6 +2722,67 @@ }, "time": "2022-03-14T18:48:55+00:00" }, + { + "name": "codeception/module-webdriver", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/Codeception/module-webdriver.git", + "reference": "c092fa4f686381d0621407c0136d608c2b419b85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/module-webdriver/zipball/c092fa4f686381d0621407c0136d608c2b419b85", + "reference": "c092fa4f686381d0621407c0136d608c2b419b85", + "shasum": "" + }, + "require": { + "codeception/codeception": "^5.0.8", + "codeception/lib-web": "^1.0.1", + "codeception/stub": "^4.0", + "ext-json": "*", + "ext-mbstring": "*", + "php": "^8.1", + "php-webdriver/webdriver": "^1.8.0", + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "codeception/phpbuiltinserver": "Start and stop PHP built-in web server for your tests" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk" + }, + { + "name": "Gintautas Miselis" + }, + { + "name": "Zaahid Bateson" + } + ], + "description": "WebDriver module for Codeception", + "homepage": "https://codeception.com/", + "keywords": [ + "acceptance-testing", + "browser-testing", + "codeception" + ], + "support": { + "issues": "https://github.com/Codeception/module-webdriver/issues", + "source": "https://github.com/Codeception/module-webdriver/tree/4.0.0" + }, + "time": "2023-02-03T21:52:27+00:00" + }, { "name": "codeception/module-yii2", "version": "1.1.9", @@ -3412,6 +3422,72 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "php-webdriver/webdriver", + "version": "1.15.0", + "source": { + "type": "git", + "url": "https://github.com/php-webdriver/php-webdriver.git", + "reference": "a1578689290055586f1ee51eaf0ec9d52895bb6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/a1578689290055586f1ee51eaf0ec9d52895bb6d", + "reference": "a1578689290055586f1ee51eaf0ec9d52895bb6d", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-zip": "*", + "php": "^7.3 || ^8.0", + "symfony/polyfill-mbstring": "^1.12", + "symfony/process": "^5.0 || ^6.0" + }, + "replace": { + "facebook/webdriver": "*" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.20.0", + "ondram/ci-detector": "^4.0", + "php-coveralls/php-coveralls": "^2.4", + "php-mock/php-mock-phpunit": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.5", + "symfony/var-dumper": "^5.0 || ^6.0" + }, + "suggest": { + "ext-SimpleXML": "For Firefox profile creation" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Exception/TimeoutException.php" + ], + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "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" + ], + "support": { + "issues": "https://github.com/php-webdriver/php-webdriver/issues", + "source": "https://github.com/php-webdriver/php-webdriver/tree/1.15.0" + }, + "time": "2023-08-29T13:52:26+00:00" + }, { "name": "phpspec/php-diff", "version": "v1.1.3", @@ -3455,16 +3531,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.39", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d9dedb0413f678b4d03cbc2279a48f91592c97c4", + "reference": "d9dedb0413f678b4d03cbc2279a48f91592c97c4", "shasum": "" }, "require": { @@ -3513,7 +3589,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-10-17T15:46:26+00:00" }, { "name": "phpunit/php-code-coverage", @@ -6251,5 +6327,5 @@ "php": ">=8.1" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/public/index.php b/public/index.php index a623165..9556eea 100644 --- a/public/index.php +++ b/public/index.php @@ -12,7 +12,7 @@ if (getenv('YII_ENV')) { defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV')); } else { - defined('YII_ENV') or define('YII_ENV', 'dev'); + defined('YII_ENV') or define('YII_ENV', 'prod'); } if (getenv('YII_C3')) { diff --git a/tests/Acceptance.suite.yml b/tests/Acceptance.suite.yml index 5b697a3..5d55eea 100644 --- a/tests/Acceptance.suite.yml +++ b/tests/Acceptance.suite.yml @@ -3,16 +3,14 @@ # Suite for acceptance tests. # Perform tests in browser using the WebDriver or PhpBrowser. # If you need both WebDriver and PHPBrowser tests - create a separate suite. - actor: AcceptanceTester -extensions: - enabled: - - Codeception\Extension\RunProcess: - 0: ./yii serve - sleep: 1 modules: - enabled: - - Filesystem - - Yii2 - - Asserts + enabled: + - WebDriver + config: + WebDriver: + url: 'http://127.0.0.1:8080/' + port: 9515 + browser: chrome # 'chrome' or 'firefox' + window_size: maximize step_decorators: ~ diff --git a/tests/Functional.suite.yml b/tests/Functional.suite.yml index 3e33c70..7d5ef82 100644 --- a/tests/Functional.suite.yml +++ b/tests/Functional.suite.yml @@ -6,8 +6,8 @@ # Remove this suite if you don't use frameworks actor: FunctionalTester modules: - enabled: - - Filesystem - - Yii2 - - Asserts + enabled: + - Filesystem + - Yii2 + - Asserts step_decorators: ~ diff --git a/tests/Unit.suite.yml b/tests/Unit.suite.yml index b1b434e..b72723a 100644 --- a/tests/Unit.suite.yml +++ b/tests/Unit.suite.yml @@ -3,8 +3,8 @@ # Suite for unit or integration tests. actor: UnitTester modules: - enabled: - - Asserts - - Yii2: - part: [orm, email, fixtures] + enabled: + - Asserts + - Yii2: + part: [orm, email, fixtures] step_decorators: ~