diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d400a8d..2ec0c89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,11 +108,11 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 8.0, 8.1, 8.2, 8.3] - symfony: [^5.4, ^6.4] - sylius: [~1.10.0, ~1.11.0, ~1.12.0] - node: [18.x] - mysql: [5.7] + php: ["7.4", "8.0", "8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.4"] + sylius: ["~1.10.0", "~1.11.0", "~1.12.0", "~1.13.0"] + node: ["20.x"] + mysql: ["8.0"] exclude: - @@ -153,7 +153,7 @@ jobs: - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" @@ -180,29 +180,20 @@ jobs: name: Run webserver run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) - - - name: Run Chrome Headless - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-features=Translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 https://127.0.0.1 > /dev/null 2>&1 & - - name: Get Composer cache directory - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Configure global composer - if: matrix.symfony != '' - run: composer global config --no-plugins allow-plugins.symfony/flex true - - name: Restrict Sylius version if: matrix.sylius != '' @@ -229,6 +220,10 @@ jobs: env: SYMFONY_REQUIRE: ${{ matrix.symfony }} + - + name: Install Behat driver + run: vendor/bin/bdi browser:google-chrome drivers + - name: Get Yarn cache directory id: yarn-cache @@ -236,7 +231,7 @@ jobs: - name: Cache Yarn - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} @@ -257,7 +252,8 @@ jobs: name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) - (cd tests/Application && yarn build) + (cd tests/Application && yarn build:prod) + - name: Prepare test application cache run: (cd tests/Application && bin/console cache:warmup -vvv) @@ -265,6 +261,17 @@ jobs: - name: Load fixtures in test application run: (cd tests/Application && bin/console sylius:fixtures:load -n) + - + name: Validate composer.json + run: composer validate --ansi --strict + + - + name: Validate database schema + run: (cd tests/Application && bin/console doctrine:schema:validate) + + - + name: Run security check + run: symfony security:check - name: Run PHPUnit @@ -276,7 +283,7 @@ jobs: - name: Upload Behat logs - uses: codecov/codecov-action@v3 + uses: actions/upload-artifact@v3 if: failure() with: name: Behat logs diff --git a/.gitignore b/.gitignore index 5a5f971..edd50c5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /etc/build/* !/etc/build/.gitignore +drivers /tests/Application/yarn.lock diff --git a/behat.yml.dist b/behat.yml.dist index b1571d9..c07a0d1 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -3,8 +3,15 @@ imports: - tests/Behat/Resources/suites.yaml default: + formatters: + pretty: + verbose: true + paths: false + snippets: false + extensions: DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ + Robertfausk\Behat\PantherExtension: ~ FriendsOfBehat\MinkDebugExtension: directory: etc/build @@ -15,14 +22,32 @@ default: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome_headless + javascript_session: panther sessions: symfony: symfony: ~ - chrome_headless: + chromedriver: + chrome: + api_url: http://127.0.0.1:9222 + validate_certificate: false + chrome_headless_second_session: chrome: api_url: http://127.0.0.1:9222 validate_certificate: false + panther: + panther: + options: + webServerDir: "%paths.base%/tests/Application/public" + manager_options: + connection_timeout_in_ms: 5000 + request_timeout_in_ms: 120000 + chromedriver_arguments: + - --log-path=etc/build/chromedriver.log + - --verbose + capabilities: + acceptSslCerts: true + acceptInsecureCerts: true + unexpectedAlertBehaviour: accept show_auto: false FriendsOfBehat\SymfonyExtension: @@ -31,3 +56,9 @@ default: class: Tests\FluxSE\SyliusPayumStripePlugin\Application\Kernel FriendsOfBehat\VariadicExtension: ~ + + FriendsOfBehat\SuiteSettingsExtension: + paths: + - "features" + + SyliusLabs\SuiteTagsExtension: ~ diff --git a/composer.json b/composer.json index a39ca74..be2c03e 100644 --- a/composer.json +++ b/composer.json @@ -17,31 +17,34 @@ "require-dev": { "ext-json": "*", "behat/behat": "^3.7", - "behat/mink": "^1.9", + "dbrekelmans/bdi": "^1.3", "dmore/behat-chrome-extension": "^1.4", "dmore/chrome-mink-driver": "^2.8", "friends-of-behat/mink": "^1.9", "friends-of-behat/mink-browserkit-driver": "^1.4", "friends-of-behat/mink-debug-extension": "^2.0", - "friends-of-behat/mink-extension": "^2.4", + "friends-of-behat/mink-extension": "^2.5", "friends-of-behat/page-object-extension": "^0.3", + "friends-of-behat/suite-settings-extension": "^1.1", "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", - "phpspec/phpspec": "^7.0", + "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan-doctrine": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "sylius-labs/coding-standard": "^4.0", - "symfony/browser-kit": "^5.4|^6.0", - "symfony/debug-bundle": "^5.4|^6.0", - "symfony/dotenv": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", - "symfony/runtime": "^5.4|^6.0", - "symfony/web-profiler-bundle": "^5.4|^6.0", + "robertfausk/behat-panther-extension": "^1.1", + "sylius-labs/coding-standard": "^4.2", + "sylius-labs/suite-tags-extension": "^0.2.0", + "symfony/browser-kit": "^5.4|^6.4", + "symfony/debug-bundle": "^5.4|^6.4", + "symfony/dotenv": "^5.4|^6.4", + "symfony/http-client": "^5.4|^6.4", + "symfony/intl": "^5.4|^6.4", + "symfony/runtime": "^5.4|^6.4", + "symfony/web-profiler-bundle": "^5.4|^6.4", "symfony/webpack-encore-bundle": "^1|^2" }, "autoload": { @@ -66,8 +69,9 @@ }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": false, + "phpstan/extension-installer": false, + "symfony/flex": false, "symfony/thanks": true, "symfony/runtime": true }