From 3e3406544450ee4791253e6f0e5ad4acebb4961c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20L=C3=B8vgaard?= Date: Mon, 11 Mar 2024 10:05:22 +0100 Subject: [PATCH] Removing behat --- .travis.yml | 119 ------------------ behat.yml.dist | 52 -------- composer.json | 2 - etc/build/.gitignore | 0 etc/build/.gitkeep | 0 features/add_brand.feature | 17 --- features/editing_brand.feature | 17 --- tests/Application/config/bundles.php | 2 - tests/Application/config/services_test.yaml | 3 - tests/Behat/Context/Setup/BrandContext.php | 43 ------- .../Behat/Context/Transform/BrandContext.php | 32 ----- .../Ui/Admin/ManagingBrandsContext.php | 98 --------------- .../Page/Admin/Brand/CreateBrandPage.php | 28 ----- .../Behat/Page/Admin/Brand/IndexBrandPage.php | 11 -- .../Page/Admin/Brand/UpdateBrandPage.php | 33 ----- tests/Behat/Resources/services.xml | 34 ----- tests/Behat/Resources/suites.yml | 13 -- 17 files changed, 504 deletions(-) delete mode 100644 .travis.yml delete mode 100644 behat.yml.dist delete mode 100755 etc/build/.gitignore delete mode 100755 etc/build/.gitkeep delete mode 100644 features/add_brand.feature delete mode 100644 features/editing_brand.feature delete mode 100644 tests/Application/config/services_test.yaml delete mode 100644 tests/Behat/Context/Setup/BrandContext.php delete mode 100644 tests/Behat/Context/Transform/BrandContext.php delete mode 100644 tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php delete mode 100644 tests/Behat/Page/Admin/Brand/CreateBrandPage.php delete mode 100644 tests/Behat/Page/Admin/Brand/IndexBrandPage.php delete mode 100644 tests/Behat/Page/Admin/Brand/UpdateBrandPage.php delete mode 100644 tests/Behat/Resources/services.xml delete mode 100644 tests/Behat/Resources/suites.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2823fb00..00000000 --- a/.travis.yml +++ /dev/null @@ -1,119 +0,0 @@ -language: php - -dist: trusty - -sudo: false - -cache: - yarn: true - directories: - - ~/.composer/cache/files - - $SYLIUS_CACHE_DIR - -env: - global: - - APP_ENV=test - - SYLIUS_CACHE_DIR=$HOME/.sylius-cache - - SYLIUS_BUILD_DIR=etc/build - -matrix: - include: - # PHP 7.2 & Sylius 1.4 - - - php: 7.2 - env: - - SYLIUS_VERSION="1.4" - - SYMFONY_VERSION="4.2" - - - php: 7.2 - env: - - SYLIUS_VERSION="1.4" - - SYMFONY_VERSION="4.3" - - # PHP 7.3 & Sylius 1.4 - - - php: 7.3 - env: - - SYLIUS_VERSION="1.4" - - SYMFONY_VERSION="4.2" - - - php: 7.3 - env: - - SYLIUS_VERSION="1.4" - - SYMFONY_VERSION="4.3" - - # PHP 7.3 & Sylius 1.5 - - - php: 7.3 - env: - - SYLIUS_VERSION="1.5" - - SYMFONY_VERSION="4.2" - - - php: 7.3 - env: - - SYLIUS_VERSION="1.5" - - SYMFONY_VERSION="4.3" - - # Sylius/Symfony Latest - - php: 7.2 - - php: 7.3 - -before_install: - - phpenv config-rm xdebug.ini - - echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - mkdir -p "${SYLIUS_CACHE_DIR}" - -install: - - if [ ! -z "${SYMFONY_VERSION}" ]; then wget -q --no-clobber --waitretry=3 --tries=5 "https://raw.githubusercontent.com/Sylius/Sylius/${SYLIUS_VERSION}/bin/require-symfony-version" -O bin/require-symfony-version && chmod +x bin/require-symfony-version && bin/require-symfony-version composer.json "${SYMFONY_VERSION}.*" && cat composer.json; fi - - if [ ! -z "${SYLIUS_VERSION}" ]; then composer require "sylius/sylius:${SYLIUS_VERSION}.*" --no-interaction --no-update; fi - - composer install --no-interaction --prefer-dist - - (cd tests/Application && yarn install) - -before_script: - - (cd tests/Application && bin/console doctrine:database:create -vvv) - - (cd tests/Application && bin/console doctrine:schema:create -vvv) - - (cd tests/Application && bin/console assets:install public -vvv) - - (cd tests/Application && bin/console cache:warmup -vvv) - - (cd tests/Application && yarn build) - - # Configure display - - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16 - - export DISPLAY=:99 - - # Download and configure ChromeDriver - - | - if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then - curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip - unzip chromedriver.zip - chmod +x chromedriver - mv chromedriver $SYLIUS_CACHE_DIR - fi - - # Run ChromeDriver - - $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 & - - # Download and configure Selenium - - | - if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then - curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar - mv selenium.jar $SYLIUS_CACHE_DIR - fi - - # Run Selenium - - java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 & - - # Run webserver - - (cd tests/Application && bin/console server:run 127.0.0.1:8080 --quiet > /dev/null 2>&1 &) - -script: - - composer validate --strict - - composer normalize --dry-run - - composer check-style - - composer analyse - - - composer phpspec - - composer phpunit - - vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun - -after_failure: - - vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log" diff --git a/behat.yml.dist b/behat.yml.dist deleted file mode 100644 index 8acfee01..00000000 --- a/behat.yml.dist +++ /dev/null @@ -1,52 +0,0 @@ -imports: - - vendor/sylius/sylius/src/Sylius/Behat/Resources/config/suites.yml - - tests/Behat/Resources/suites.yml - -default: - extensions: - Lakion\Behat\MinkDebugExtension: - directory: etc/build - clean_start: false - screenshot: true - - Behat\MinkExtension: - files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" - base_url: "http://localhost:8080/" - default_session: symfony - javascript_session: chrome - sessions: - symfony: - symfony: ~ - chrome: - selenium2: - browser: chrome - capabilities: - browserName: chrome - browser: chrome - version: "" - marionette: null # https://github.com/Behat/MinkExtension/pull/311 - chrome: - switches: - - "start-fullscreen" - - "start-maximized" - - "no-sandbox" - firefox: - selenium2: - browser: firefox - show_auto: false - - FriendsOfBehat\SymfonyExtension: - bootstrap: tests/Application/config/bootstrap.php - kernel: - class: Tests\Loevgaard\SyliusBrandPlugin\Application\Kernel - - FriendsOfBehat\VariadicExtension: ~ - - FriendsOfBehat\SuiteSettingsExtension: - paths: - - "features" - contexts: - - "sylius.behat.context.setup.admin_security" - - "loevgaard_sylius_brand.behat.context.setup.brand" - - "loevgaard_sylius_brand.behat.context.transform.brand" - - "loevgaard_sylius_brand.behat.context.ui.admin.managing_brands" diff --git a/composer.json b/composer.json index fe8faf3b..1818778c 100644 --- a/composer.json +++ b/composer.json @@ -26,11 +26,9 @@ }, "require-dev": { "setono/code-quality-pack": "^2.7", - "setono/sylius-behat-pack": "^0.2.2", "sylius/sylius": "~1.11.15", "psalm/plugin-phpunit": "^0.18.4" }, - "minimum-stability": "dev", "prefer-stable": true, "autoload": { "psr-4": { diff --git a/etc/build/.gitignore b/etc/build/.gitignore deleted file mode 100755 index e69de29b..00000000 diff --git a/etc/build/.gitkeep b/etc/build/.gitkeep deleted file mode 100755 index e69de29b..00000000 diff --git a/features/add_brand.feature b/features/add_brand.feature deleted file mode 100644 index 34ee98ad..00000000 --- a/features/add_brand.feature +++ /dev/null @@ -1,17 +0,0 @@ -@managing_brands -Feature: Adding a new brand - In order to be able to associate products with brands - As an Administrator - I want to add a new brand to the shop - - Background: - Given I am logged in as an administrator - - @ui - Scenario: Adding a new brand - Given I want to create a new brand - When I name it "Diesel" - And I set its code to "diesel" - And I add it - Then I should be notified that it has been successfully created - And the brand "Diesel" should appear in the store diff --git a/features/editing_brand.feature b/features/editing_brand.feature deleted file mode 100644 index 76710a29..00000000 --- a/features/editing_brand.feature +++ /dev/null @@ -1,17 +0,0 @@ -@managing_brands -Feature: Editing a brand - In order to change brand details - As an Administrator - I want to be able to edit a brand - - Background: - Given the store has a brand "Levis" - And I am logged in as an administrator - - @ui - Scenario: Renaming a brand - Given I want to modify the "Levis" brand - When I rename it to "G-Star" - And I save my changes - Then I should be notified that it has been successfully edited - And this brand name should be "G-Star" diff --git a/tests/Application/config/bundles.php b/tests/Application/config/bundles.php index 7ead14f6..3ee04826 100644 --- a/tests/Application/config/bundles.php +++ b/tests/Application/config/bundles.php @@ -9,7 +9,6 @@ Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true], Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true], Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle::class => ['all' => true], @@ -60,7 +59,6 @@ Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true], - FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['test' => true, 'test_cached' => true], Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['test' => true, 'test_cached' => true], ]; diff --git a/tests/Application/config/services_test.yaml b/tests/Application/config/services_test.yaml deleted file mode 100644 index d9b02e3d..00000000 --- a/tests/Application/config/services_test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -imports: - - { resource: "../../Behat/Resources/services.xml" } - - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" } diff --git a/tests/Behat/Context/Setup/BrandContext.php b/tests/Behat/Context/Setup/BrandContext.php deleted file mode 100644 index c220b9df..00000000 --- a/tests/Behat/Context/Setup/BrandContext.php +++ /dev/null @@ -1,43 +0,0 @@ -createBrand($brandName); - - $this->saveBrand($brand); - } - - private function createBrand(string $name): BrandInterface - { - /** @var BrandInterface $brand */ - $brand = $this->brandFactory->createNew(); - - $brand->setName($name); - $brand->setCode(strtolower($name)); - - return $brand; - } - - private function saveBrand(BrandInterface $brand): void - { - $this->brandRepository->add($brand); - } -} diff --git a/tests/Behat/Context/Transform/BrandContext.php b/tests/Behat/Context/Transform/BrandContext.php deleted file mode 100644 index 003b8c35..00000000 --- a/tests/Behat/Context/Transform/BrandContext.php +++ /dev/null @@ -1,32 +0,0 @@ -brandRepository->findByName($brandName); - - Assert::eq( - count($brands), - 1, - sprintf('%d brands has been found with name "%s".', count($brands), $brandName), - ); - - return $brands[0]; - } -} diff --git a/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php b/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php deleted file mode 100644 index 669f6cb9..00000000 --- a/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php +++ /dev/null @@ -1,98 +0,0 @@ -createBrandPage->open(); - } - - /** - * @When I name it :name - */ - public function iNameIt($name): void - { - $this->createBrandPage->nameIt($name); - } - - /** - * @When I set its code to :code - */ - public function iSetItsCodeTo($code): void - { - $this->createBrandPage->specifyCode($code); - } - - /** - * @When I add it - */ - public function iAddIt(): void - { - $this->createBrandPage->create(); - } - - /** - * @Then the brand :brand should appear in the store - */ - public function theBrandShouldAppearInTheStore($brand): void - { - $this->indexBrandPage->open(); - - Assert::true( - $this->indexBrandPage->isSingleResourceOnPage(['name' => $brand]), - sprintf('Brand %s should exist but it does not', $brand), - ); - } - - /** - * @Given I want to modify the :brand brand - */ - public function iWantToModifyTheBrand(BrandInterface $brand): void - { - $this->updateBrandPage->open([ - 'id' => $brand->getId(), - ]); - } - - /** - * @When I rename it to :name - */ - public function iRenameItTo($name): void - { - $this->updateBrandPage->nameIt($name); - } - - /** - * @When I save my changes - */ - public function iSaveMyChanges(): void - { - $this->updateBrandPage->saveChanges(); - } - - /** - * @Then this brand name should be :name - */ - public function thisBrandNameShouldBe($name): void - { - Assert::eq($name, $this->updateBrandPage->getName()); - } -} diff --git a/tests/Behat/Page/Admin/Brand/CreateBrandPage.php b/tests/Behat/Page/Admin/Brand/CreateBrandPage.php deleted file mode 100644 index 38650d5f..00000000 --- a/tests/Behat/Page/Admin/Brand/CreateBrandPage.php +++ /dev/null @@ -1,28 +0,0 @@ -getElement('name')->setValue($name); - } - - public function specifyCode($code): void - { - $this->getElement('code')->setValue($code); - } - - protected function getDefinedElements(): array - { - return array_merge(parent::getDefinedElements(), [ - 'name' => '#loevgaard_sylius_brand_brand_name', - 'code' => '#loevgaard_sylius_brand_brand_code', - ]); - } -} diff --git a/tests/Behat/Page/Admin/Brand/IndexBrandPage.php b/tests/Behat/Page/Admin/Brand/IndexBrandPage.php deleted file mode 100644 index e9e041cc..00000000 --- a/tests/Behat/Page/Admin/Brand/IndexBrandPage.php +++ /dev/null @@ -1,11 +0,0 @@ -getElement('name')->setValue($name); - } - - public function specifyCode($code): void - { - $this->getElement('code')->setValue($code); - } - - public function getName(): string - { - return $this->getElement('name')->getValue(); - } - - protected function getDefinedElements(): array - { - return array_merge(parent::getDefinedElements(), [ - 'name' => '#loevgaard_sylius_brand_brand_name', - 'code' => '#loevgaard_sylius_brand_brand_code', - ]); - } -} diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml deleted file mode 100644 index 60c4eb52..00000000 --- a/tests/Behat/Resources/services.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - loevgaard_sylius_brand_admin_brand_index - - - - loevgaard_sylius_brand_admin_brand_create - - - - loevgaard_sylius_brand_admin_brand_update - - - diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml deleted file mode 100644 index f77fd652..00000000 --- a/tests/Behat/Resources/suites.yml +++ /dev/null @@ -1,13 +0,0 @@ -default: - suites: - managing_brands: - contexts: - - sylius.behat.context.hook.doctrine_orm - - sylius.behat.context.setup.admin_security - - sylius.behat.context.ui.admin.notification - - - loevgaard_sylius_brand.behat.context.transform.brand - - loevgaard_sylius_brand.behat.context.setup.brand - - loevgaard_sylius_brand.behat.context.ui.admin.managing_brands - filters: - tags: "@managing_brands && @ui"