Skip to content

Commit

Permalink
Merge branch '2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-webkul committed Feb 3, 2025
2 parents abec433 + 132d28c commit 94cb42f
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 60 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/playwright_tests.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 16 additions & 16 deletions packages/Webkul/Admin/tests/Feature/Sales/Orders/OrdersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
88 changes: 44 additions & 44 deletions packages/Webkul/Shop/tests/Feature/Checkout/CheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 94cb42f

Please sign in to comment.