diff --git a/.github/workflows/playwright_tests.yml b/.github/workflows/playwright_tests.yml new file mode 100644 index 00000000000..19a200eb993 --- /dev/null +++ b/.github/workflows/playwright_tests.yml @@ -0,0 +1,93 @@ +name: Playwright Tests + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + playwright_test: + runs-on: ${{ matrix.operating-systems }} + + strategy: + matrix: + operating-systems: [ubuntu-latest] + php-versions: ['8.2', '8.3'] + + name: PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-systems }} + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: bagisto + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt-get install -y mysql-client netcat-openbsd net-tools + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: curl, fileinfo, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip + ini-values: error_reporting=E_ALL + tools: composer:v2 + + - name: Set Up Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install Node.js Dependencies + run: npm install + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Setting Environment + run: | + cp .env.example .env + sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env + sed -i "s|^\(DB_PORT=\s*\).*$|\1${{ job.services.mysql.ports['3306'] }}|" .env + sed -i "s|^\(DB_DATABASE=\s*\).*$|\1bagisto|" .env + sed -i "s|^\(DB_USERNAME=\s*\).*$|\1root|" .env + sed -i "s|^\(DB_PASSWORD=\s*\).*$|\1root|" .env + sed -i "s|^\(APP_DEBUG=\s*\).*$|\1false|" .env + sed -i "s|^\(APP_URL=\s*\).*$|\1http://127.0.0.1:8000/|" .env + cat .env + + - name: Install Composer Dependencies + run: composer install + + - name: Running Bagisto Installer + run: php artisan bagisto:install --skip-env-check --skip-admin-creation + + - name: Seed Product Table + run: php artisan db:seed --class="Webkul\\Installer\\Database\\Seeders\\ProductTableSeeder" + + - name: Start Laravel server + run: nohup php artisan serve --host=0.0.0.0 --port=8000 > /dev/null 2>&1 & + + - name: Run All Playwright Tests + env: + BASE_URL: 'http://127.0.0.1:8000' + run: | + npx playwright test tests --workers=1 --project=chromium --retries=0 || echo "Continue" + + - name: Upload Playwright Report for All Tests + uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report-All-Tests + path: playwright-report/ + retention-days: 30 diff --git a/packages/Webkul/Admin/tests/Feature/Sales/Orders/OrdersTest.php b/packages/Webkul/Admin/tests/Feature/Sales/Orders/OrdersTest.php index 35d325a9160..124b1c5e953 100644 --- a/packages/Webkul/Admin/tests/Feature/Sales/Orders/OrdersTest.php +++ b/packages/Webkul/Admin/tests/Feature/Sales/Orders/OrdersTest.php @@ -639,22 +639,22 @@ 'shipping_method' => 'free_free', ]) ->assertOk() - ->assertJsonPath('payment_methods.0.method', 'paypal_smart_button') - ->assertJsonPath('payment_methods.0.method_title', 'PayPal Smart Button') - ->assertJsonPath('payment_methods.0.description', 'PayPal') - ->assertJsonPath('payment_methods.0.sort', 0) - ->assertJsonPath('payment_methods.1.method', 'cashondelivery') - ->assertJsonPath('payment_methods.1.method_title', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.description', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.sort', 1) - ->assertJsonPath('payment_methods.2.method', 'moneytransfer') - ->assertJsonPath('payment_methods.2.method_title', 'Money Transfer') - ->assertJsonPath('payment_methods.2.description', 'Money Transfer') - ->assertJsonPath('payment_methods.2.sort', 2) - ->assertJsonPath('payment_methods.3.method', 'paypal_standard') - ->assertJsonPath('payment_methods.3.method_title', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.description', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.sort', 3); + ->assertJsonPath('payment_methods.0.method', 'cashondelivery') + ->assertJsonPath('payment_methods.0.method_title', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.description', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.sort', 1) + ->assertJsonPath('payment_methods.1.method', 'moneytransfer') + ->assertJsonPath('payment_methods.1.method_title', 'Money Transfer') + ->assertJsonPath('payment_methods.1.description', 'Money Transfer') + ->assertJsonPath('payment_methods.1.sort', 2) + ->assertJsonPath('payment_methods.2.method', 'paypal_standard') + ->assertJsonPath('payment_methods.2.method_title', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.description', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.sort', 3) + ->assertJsonPath('payment_methods.3.method', 'paypal_smart_button') + ->assertJsonPath('payment_methods.3.method_title', 'PayPal Smart Button') + ->assertJsonPath('payment_methods.3.description', 'PayPal') + ->assertJsonPath('payment_methods.3.sort', 4); }); it('should store the payment method after storing the shipping method', function () { diff --git a/packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php b/packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php index 6073aa705d1..719e6cb5f43 100644 --- a/packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php +++ b/packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php @@ -456,18 +456,18 @@ ], ]) ->assertOk() - ->assertJsonPath('data.payment_methods.1.method', 'moneytransfer') - ->assertJsonPath('data.payment_methods.1.method_title', 'Money Transfer') - ->assertJsonPath('data.payment_methods.1.description', 'Money Transfer') - ->assertJsonPath('data.payment_methods.1.sort', 2) - ->assertJsonPath('data.payment_methods.2.method', 'paypal_standard') - ->assertJsonPath('data.payment_methods.2.method_title', 'PayPal Standard') - ->assertJsonPath('data.payment_methods.2.description', 'PayPal Standard') - ->assertJsonPath('data.payment_methods.2.sort', 3) - ->assertJsonPath('data.payment_methods.0.method', 'paypal_smart_button') - ->assertJsonPath('data.payment_methods.0.method_title', 'PayPal Smart Button') - ->assertJsonPath('data.payment_methods.0.description', 'PayPal') - ->assertJsonPath('data.payment_methods.0.sort', 4) + ->assertJsonPath('data.payment_methods.0.method', 'moneytransfer') + ->assertJsonPath('data.payment_methods.0.method_title', 'Money Transfer') + ->assertJsonPath('data.payment_methods.0.description', 'Money Transfer') + ->assertJsonPath('data.payment_methods.0.sort', 2) + ->assertJsonPath('data.payment_methods.1.method', 'paypal_standard') + ->assertJsonPath('data.payment_methods.1.method_title', 'PayPal Standard') + ->assertJsonPath('data.payment_methods.1.description', 'PayPal Standard') + ->assertJsonPath('data.payment_methods.1.sort', 3) + ->assertJsonPath('data.payment_methods.2.method', 'paypal_smart_button') + ->assertJsonPath('data.payment_methods.2.method_title', 'PayPal Smart Button') + ->assertJsonPath('data.payment_methods.2.description', 'PayPal') + ->assertJsonPath('data.payment_methods.2.sort', 4) ->assertJsonPath('redirect', false); $this->assertModelWise([ @@ -1170,22 +1170,22 @@ 'shipping_method' => 'free_free', ]) ->assertOk() - ->assertJsonPath('payment_methods.1.method', 'cashondelivery') - ->assertJsonPath('payment_methods.1.method_title', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.description', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.sort', 1) - ->assertJsonPath('payment_methods.2.method', 'moneytransfer') - ->assertJsonPath('payment_methods.2.method_title', 'Money Transfer') - ->assertJsonPath('payment_methods.2.description', 'Money Transfer') - ->assertJsonPath('payment_methods.2.sort', 2) - ->assertJsonPath('payment_methods.3.method', 'paypal_standard') - ->assertJsonPath('payment_methods.3.method_title', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.description', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.sort', 3) - ->assertJsonPath('payment_methods.0.method', 'paypal_smart_button') - ->assertJsonPath('payment_methods.0.method_title', 'PayPal Smart Button') - ->assertJsonPath('payment_methods.0.description', 'PayPal') - ->assertJsonPath('payment_methods.0.sort', 4); + ->assertJsonPath('payment_methods.0.method', 'cashondelivery') + ->assertJsonPath('payment_methods.0.method_title', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.description', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.sort', 1) + ->assertJsonPath('payment_methods.1.method', 'moneytransfer') + ->assertJsonPath('payment_methods.1.method_title', 'Money Transfer') + ->assertJsonPath('payment_methods.1.description', 'Money Transfer') + ->assertJsonPath('payment_methods.1.sort', 2) + ->assertJsonPath('payment_methods.2.method', 'paypal_standard') + ->assertJsonPath('payment_methods.2.method_title', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.description', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.sort', 3) + ->assertJsonPath('payment_methods.3.method', 'paypal_smart_button') + ->assertJsonPath('payment_methods.3.method_title', 'PayPal Smart Button') + ->assertJsonPath('payment_methods.3.description', 'PayPal') + ->assertJsonPath('payment_methods.3.sort', 4); }); it('should store the shipping method for customer', function () { @@ -1260,22 +1260,22 @@ 'shipping_method' => 'free_free', ]) ->assertOk() - ->assertJsonPath('payment_methods.1.method', 'cashondelivery') - ->assertJsonPath('payment_methods.1.method_title', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.description', 'Cash On Delivery') - ->assertJsonPath('payment_methods.1.sort', 1) - ->assertJsonPath('payment_methods.2.method', 'moneytransfer') - ->assertJsonPath('payment_methods.2.method_title', 'Money Transfer') - ->assertJsonPath('payment_methods.2.description', 'Money Transfer') - ->assertJsonPath('payment_methods.2.sort', 2) - ->assertJsonPath('payment_methods.3.method', 'paypal_standard') - ->assertJsonPath('payment_methods.3.method_title', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.description', 'PayPal Standard') - ->assertJsonPath('payment_methods.3.sort', 3) - ->assertJsonPath('payment_methods.0.method', 'paypal_smart_button') - ->assertJsonPath('payment_methods.0.method_title', 'PayPal Smart Button') - ->assertJsonPath('payment_methods.0.description', 'PayPal') - ->assertJsonPath('payment_methods.0.sort', 4); + ->assertJsonPath('payment_methods.0.method', 'cashondelivery') + ->assertJsonPath('payment_methods.0.method_title', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.description', 'Cash On Delivery') + ->assertJsonPath('payment_methods.0.sort', 1) + ->assertJsonPath('payment_methods.1.method', 'moneytransfer') + ->assertJsonPath('payment_methods.1.method_title', 'Money Transfer') + ->assertJsonPath('payment_methods.1.description', 'Money Transfer') + ->assertJsonPath('payment_methods.1.sort', 2) + ->assertJsonPath('payment_methods.2.method', 'paypal_standard') + ->assertJsonPath('payment_methods.2.method_title', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.description', 'PayPal Standard') + ->assertJsonPath('payment_methods.2.sort', 3) + ->assertJsonPath('payment_methods.3.method', 'paypal_smart_button') + ->assertJsonPath('payment_methods.3.method_title', 'PayPal Smart Button') + ->assertJsonPath('payment_methods.3.description', 'PayPal') + ->assertJsonPath('payment_methods.3.sort', 4); }); it('should fails the validation error when store the payment method for guest user', function () {