diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 00000000000..bba3042f990 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,145 @@ +name: Bagisto Playwright Tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 180 + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: webkul + MYSQL_DATABASE: bagisto-test + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h 127.0.0.1 -u root -pwebkul" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + steps: + - name: Checkout repository + 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: Wait for MySQL + run: | + echo "Waiting for MySQL..." + max_attempts=30 + attempt=0 + until mysqladmin ping -h 127.0.0.1 -uroot -pwebkul --silent; do + if [ $attempt -ge $max_attempts ]; then + echo "MySQL failed to start in time." + exit 1 + fi + echo "Waiting for MySQL... (attempt $((attempt+1))/$max_attempts)" + sleep 2 + ((attempt++)) + done + + - name: Configure MySQL user privileges + run: | + mysql -h 127.0.0.1 -uroot -pwebkul -e " + CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'webkul'; + GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; + FLUSH PRIVILEGES; + " + + - name: Set up application environment + run: | + cp .env.example .env + sed -i 's#DB_HOST=.*#DB_HOST=127.0.0.1#' .env + sed -i 's#DB_PORT=.*#DB_PORT=3306#' .env + sed -i 's#DB_DATABASE=.*#DB_DATABASE=bagisto-test#' .env + sed -i 's#DB_USERNAME=.*#DB_USERNAME=root#' .env + sed -i 's#DB_PASSWORD=.*#DB_PASSWORD=webkul#' .env + sed -i 's#APP_DEBUG=.*#APP_DEBUG=false#' .env + sed -i 's|APP_URL=.*|APP_URL=http://127.0.0.1:8000/|' .env + + - name: Install PHP and dependencies + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, intl, bcmath, gd, pdo_mysql, mysql + tools: composer + + - name: Install Composer dependencies + run: composer install + + - name: Test MySQL Connectivity + run: | + echo "Testing MySQL connection..." + php -r " + try { + \$pdo = new PDO('mysql:host=127.0.0.1;dbname=bagisto-test', 'root', 'webkul'); + echo 'Connected to MySQL successfully!'; + } catch (PDOException \$e) { + echo 'Connection failed: ' . \$e->getMessage(); + exit(1); + } + " + + - name: Install Bagisto + run: | + # Run the bagisto:create command to create a new project + composer create + + # Install Bagisto + php artisan bagisto:install --no-interaction + + - name: Run Laravel migrations + run: | + php artisan key:generate + php artisan migrate --seed + env: + DB_HOST: 127.0.0.1 + DB_PORT: 3306 + DB_DATABASE: bagisto-test + DB_USERNAME: root + DB_PASSWORD: webkul + APP_DEBUG: false + APP_URL: http://127.0.0.1:8000 + + - 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: 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: 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/.gitignore b/.gitignore index bd0e664948d..b2d67751ac5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ package-lock.json /vendor yarn.lock yarn-error.log +/test-results +/playwright-report diff --git a/config/setup.ts b/config/setup.ts new file mode 100644 index 00000000000..bc1db998823 --- /dev/null +++ b/config/setup.ts @@ -0,0 +1,11 @@ +// config.js +const config = { + // The base URL of the application under test + baseUrl: process.env.APP_URL || 'http://dev1.amit.com', + + // Admin credentials + adminEmail: process.env.ADMIN_EMAIL || 'admin@example.com', + adminPassword: process.env.ADMIN_PASSWORD || 'admin123', +}; + +export default config; diff --git a/package.json b/package.json index 5d678002fe3..60a48c32037 100755 --- a/package.json +++ b/package.json @@ -1,13 +1,28 @@ { "private": true, "type": "module", + + "name": "my-playwright-tests", + "version": "1.0.0", + "main": "index.js", + "keywords": [], + "author": "", + "license": "ISC", + "description": "", "scripts": { "dev": "vite", - "build": "vite build" + "build": "vite build", + "test": "npx playwright test" }, "devDependencies": { "axios": "^1.7.4", "laravel-vite-plugin": "^1.0", - "vite": "^5.0" + "vite": "^5.0", + "@playwright/test": "^1.48.1", + "@types/node": "^22.7.8" + }, + "dependencies": { + "playwright": "^1.48.1", + "readline-sync": "^1.4.10" } } diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 00000000000..435b4da623d --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,52 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// import dotenv from 'dotenv'; +// import path from 'path'; +// dotenv.config({ path: path.resolve(__dirname, '.env') }); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + + { + name: 'webkit', + use: { ...devices['Desktop Safari'] }, + }, + ], +}); diff --git a/tests/admin/auth.spec.ts b/tests/admin/auth.spec.ts new file mode 100644 index 00000000000..792e9426b83 --- /dev/null +++ b/tests/admin/auth.spec.ts @@ -0,0 +1,26 @@ +import { test, expect, config } from '../utils/setup'; + +test('Login', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + + await expect(page.getByPlaceholder('Mega Search').first()).toBeVisible(); +}); + +test('Logout', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('button', { name: 'E' }).click(); + await page.getByRole('link', { name: 'Logout' }).click(); + await page.waitForTimeout(5000); + + await expect(page.getByPlaceholder('Password').first()).toBeVisible(); +}); diff --git a/tests/admin/catalog/attribute-families.spec.ts b/tests/admin/catalog/attribute-families.spec.ts new file mode 100644 index 00000000000..4ef17b92cea --- /dev/null +++ b/tests/admin/catalog/attribute-families.spec.ts @@ -0,0 +1,16 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Delete Attribute Family', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Attribute Families' }).click(); + await page.locator('div').filter({ hasText: /^1defaultDefault$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Family deleted successfully.')).toBeVisible(); +}); diff --git a/tests/admin/catalog/attributes.spec.ts b/tests/admin/catalog/attributes.spec.ts new file mode 100644 index 00000000000..50d32b0b2b9 --- /dev/null +++ b/tests/admin/catalog/attributes.spec.ts @@ -0,0 +1,169 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Attribute', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Attributes' }).click(); + await page.getByRole('link', { name: 'Create Attributes' }).click(); + await page.getByPlaceholder('Admin').click(); + await page.getByPlaceholder('Admin').fill('Demo_sfdatsdf'); + await page.getByPlaceholder('Admin').press('Tab'); + await page.getByPlaceholder('Arabic').fill('Demo_ysdaguwy'); + await page.getByPlaceholder('Arabic').press('Tab'); + await page.getByPlaceholder('Bengali').fill('Demo_cgyusd'); + await page.getByPlaceholder('Bengali').press('Tab'); + await page.getByPlaceholder('Brazilian Portuguese').fill('Demo_hgscbsdy'); + await page.getByPlaceholder('Brazilian Portuguese').press('Tab'); + await page.getByPlaceholder('Chinese').fill('Demo_dsuyadtg'); + await page.getByPlaceholder('Chinese').press('Tab'); + await page.getByPlaceholder('Dutch').fill('Demo_uysdcfg'); + await page.getByPlaceholder('Dutch').press('Tab'); + await page.getByPlaceholder('English').fill('Demo_scyud'); + await page.getByPlaceholder('English').press('Tab'); + await page.getByPlaceholder('French').fill('Demo_ysdcgwsa'); + await page.getByPlaceholder('French').press('Tab'); + await page.getByPlaceholder('German').fill('Demo_iysd78'); + await page.getByPlaceholder('German').press('Tab'); + await page.getByPlaceholder('Hebrew').fill('Demo_hjsdgsyiud'); + await page.getByPlaceholder('Hebrew').press('Tab'); + await page.getByPlaceholder('Hindi').fill('Demo_hjsgdis'); + await page.getByPlaceholder('Hindi').press('Tab'); + await page.getByPlaceholder('Italian').fill('Demo_hsdgsd'); + await page.getByPlaceholder('Italian').press('Tab'); + await page.getByPlaceholder('Japanese').fill('Demo_iyusdcsd'); + await page.getByPlaceholder('Japanese').press('Tab'); + await page.getByPlaceholder('Persian').fill('Demo_ghsdgi'); + await page.getByPlaceholder('Persian').press('Tab'); + await page.getByPlaceholder('Polish').fill('Demo_bhjsdgiw'); + await page.getByPlaceholder('Polish').press('Tab'); + await page.getByPlaceholder('Russian').fill('Demo_hjsdgyiuws uhsd'); + await page.getByPlaceholder('Russian').press('Tab'); + await page.getByPlaceholder('Sinhala').fill('Demo_gc whisxg'); + await page.getByPlaceholder('Sinhala').press('Tab'); + await page.getByPlaceholder('Spanish').fill('Demo_bwisdcuyw '); + await page.getByPlaceholder('Spanish').press('Tab'); + await page.getByPlaceholder('Turkish').fill('Demo_ciwswi igwsi'); + await page.getByPlaceholder('Turkish').press('Tab'); + await page.getByPlaceholder('Ukrainian').fill('Demo_hbwieyh iuw'); + await page.getByPlaceholder('Ukrainian').press('Tab'); + await page.getByPlaceholder('Attribute Code').fill('Demo_dscbwi'); + await page.getByPlaceholder('Attribute Code').press('Tab'); + await page.locator('#type').selectOption('textarea'); + await page.locator('.relative > label').click(); + await page.locator('input[name="default_value"]').click(); + await page.locator('input[name="default_value"]').fill('Demo_wdfhwbe'); + await page.locator('#is_required').nth(1).click(); + await page.locator('#is_unique').nth(1).click(); + await page.locator('#value_per_locale').nth(1).click(); + await page.locator('#value_per_channel').nth(1).click(); + await page.getByLabel('Value Per Channel').click(); + await page.getByRole('button', { name: 'Save Attribute' }).click(); + + await expect(page.getByText('Attribute Created Successfully')).toBeVisible(); +}); + +test('Edit Attribute', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Attributes' }).click(); + await page.locator('div').filter({ hasText: /^28manage_stockManage StockbooleanFalseFalseFalseTrue2024-12-17 17:01:15$/ }).locator('span').nth(1).click(); + await page.getByPlaceholder('Admin').click(); + await page.getByPlaceholder('Admin').fill('Demo_sfdatsdf'); + await page.getByPlaceholder('Admin').press('Tab'); + await page.getByPlaceholder('Arabic').fill('Demo_ysdaguwy'); + await page.getByPlaceholder('Arabic').press('Tab'); + await page.getByPlaceholder('Bengali').fill('Demo_cgyusd'); + await page.getByPlaceholder('Bengali').press('Tab'); + await page.getByPlaceholder('Brazilian Portuguese').fill('Demo_hgscbsdy'); + await page.getByPlaceholder('Brazilian Portuguese').press('Tab'); + await page.getByPlaceholder('Chinese').fill('Demo_dsuyadtg'); + await page.getByPlaceholder('Chinese').press('Tab'); + await page.getByPlaceholder('Dutch').fill('Demo_uysdcfg'); + await page.getByPlaceholder('Dutch').press('Tab'); + await page.getByPlaceholder('English').fill('Demo_scyud'); + await page.getByPlaceholder('English').press('Tab'); + await page.getByPlaceholder('French').fill('Demo_ysdcgwsa'); + await page.getByPlaceholder('French').press('Tab'); + await page.getByPlaceholder('German').fill('Demo_iysd78'); + await page.getByPlaceholder('German').press('Tab'); + await page.getByPlaceholder('Hebrew').fill('Demo_hjsdgsyiud'); + await page.getByPlaceholder('Hebrew').press('Tab'); + await page.getByPlaceholder('Hindi').fill('Demo_hjsgdis'); + await page.getByPlaceholder('Hindi').press('Tab'); + await page.getByPlaceholder('Italian').fill('Demo_hsdgsd'); + await page.getByPlaceholder('Italian').press('Tab'); + await page.getByPlaceholder('Japanese').fill('Demo_iyusdcsd'); + await page.getByPlaceholder('Japanese').press('Tab'); + await page.getByPlaceholder('Persian').fill('Demo_ghsdgi'); + await page.getByPlaceholder('Persian').press('Tab'); + await page.getByPlaceholder('Polish').fill('Demo_bhjsdgiw'); + await page.getByPlaceholder('Polish').press('Tab'); + await page.getByPlaceholder('Russian').fill('Demo_hjsdgyiuws uhsd'); + await page.getByPlaceholder('Russian').press('Tab'); + await page.getByPlaceholder('Sinhala').fill('Demo_gc whisxg'); + await page.getByPlaceholder('Sinhala').press('Tab'); + await page.getByPlaceholder('Spanish').fill('Demo_bwisdcuyw '); + await page.getByPlaceholder('Spanish').press('Tab'); + await page.getByPlaceholder('Turkish').fill('Demo_ciwswi igwsi'); + await page.getByPlaceholder('Turkish').press('Tab'); + await page.getByPlaceholder('Ukrainian').fill('Demo_hbwieyh iuw'); + await page.getByPlaceholder('Ukrainian').press('Tab'); + await page.getByPlaceholder('Attribute Code').fill('Demo_dscbwi'); + await page.getByPlaceholder('Attribute Code').press('Tab'); + await page.locator('#type').selectOption('textarea'); + await page.locator('.relative > label').click(); + await page.locator('input[name="default_value"]').click(); + await page.locator('input[name="default_value"]').fill('Demo_wdfhwbe'); + await page.locator('#is_required').nth(1).click(); + await page.locator('#is_unique').nth(1).click(); + await page.locator('#value_per_locale').nth(1).click(); + await page.locator('#value_per_channel').nth(1).click(); + await page.getByLabel('Value Per Channel').click(); + await page.getByRole('button', { name: 'Save Attribute' }).click(); + + await expect(page.getByText('Attribute Updated Successfully')).toBeVisible(); +}); + +test('Delete Attribute', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Attributes' }).click(); + await page.locator('div').filter({ hasText: /^24sizeSizeselectFalseFalseFalseFalse2024-12-17 17:01:15$/ }).locator('span').nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Attribute Deleted Successfully')).toBeVisible(); +}); + +test('Mass Delete Attributes', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Attributes' }).click(); + await page.locator('div').filter({ hasText: /^25brandBrandselectFalseFalseFalseFalse2024-12-17 17:01:15$/ }).locator('label span').click(); + await page.locator('div').filter({ hasText: /^24sizeSizeselectFalseFalseFalseFalse2024-12-17 17:01:15$/ }).locator('label span').click(); + await page.locator('div').filter({ hasText: /^28manage_stockManage StockbooleanFalseFalseFalseFalse2024-12-17 17:01:15$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: ' Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Attribute Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/catalog/categories.spec.ts b/tests/admin/catalog/categories.spec.ts new file mode 100644 index 00000000000..29dc29616cd --- /dev/null +++ b/tests/admin/catalog/categories.spec.ts @@ -0,0 +1,132 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Categories' }).click(); + await page.getByRole('link', { name: 'Create Category' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_SADASDWE'); + await page.locator('label').filter({ hasText: 'Root' }).locator('span').click(); + await page.locator('label').filter({ hasText: /^Men$/ }).locator('span').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByRole('paragraph').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_ASDAWSD'); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').press('CapsLock'); + await page.getByPlaceholder('Meta Title').click(); + await page.getByPlaceholder('Meta Title').fill('Demo_sdwewew'); + await page.getByPlaceholder('Slug').click(); + await page.getByPlaceholder('Slug').fill('Demo_sadasdwewewe'); + await page.getByPlaceholder('Meta Keywords').click(); + await page.getByPlaceholder('Meta Keywords').fill('Demo_qrqwe'); + await page.getByPlaceholder('Meta Description').click(); + await page.getByPlaceholder('Meta Description').fill('Demo_wer343'); + await page.locator('#Price').nth(1).click(); + await page.locator('#Color').nth(1).click(); + await page.locator('#Size').nth(1).click(); + await page.locator('.relative > label').click(); + await page.locator('#display_mode').selectOption('products_only'); + await page.locator('#display_mode').selectOption('products_and_description'); + await page.getByPlaceholder('Enter Position').click(); + await page.getByPlaceholder('Enter Position').fill('34'); + await page.getByRole('button', { name: 'Save Category' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Categories' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_SADASDWE'); + await page.locator('label').filter({ hasText: 'Root' }).locator('span').click(); + await page.locator('label').filter({ hasText: /^Men$/ }).locator('span').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByRole('paragraph').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_ASDAWSD'); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').press('CapsLock'); + await page.getByPlaceholder('Meta Title').click(); + await page.getByPlaceholder('Meta Title').fill('Demo_sdwewew'); + await page.getByPlaceholder('Slug').click(); + await page.getByPlaceholder('Slug').fill('Demo_sadasdwewewe'); + await page.getByPlaceholder('Meta Keywords').click(); + await page.getByPlaceholder('Meta Keywords').fill('Demo_qrqwe'); + await page.getByPlaceholder('Meta Description').click(); + await page.getByPlaceholder('Meta Description').fill('Demo_wer343'); + await page.locator('#Price').nth(1).click(); + await page.locator('#Color').nth(1).click(); + await page.locator('#Size').nth(1).click(); + await page.locator('.relative > label').click(); + await page.locator('#display_mode').selectOption('products_only'); + await page.locator('#display_mode').selectOption('products_and_description'); + await page.getByPlaceholder('Enter Position').click(); + await page.getByPlaceholder('Enter Position').fill('34'); + await page.locator('div').filter({ hasText: /^4SADASDWE34Active0$/ }).locator('span').nth(2).click(); + await page.locator('.icon-delete').first().click(); + await page.locator('.icon-delete').click(); + await page.locator('#Brand').nth(1).click(); + await page.getByRole('button', { name: 'Save Category' }).click(); + + await expect(page.getByText('category updated successfully.')).toBeVisible(); +}); + +test('Delete Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Categories' }).click(); + await page.locator('div').filter({ hasText: /^4SADASDWE34Active0$/ }).locator('span').nth(3).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('The category has been successfully deleted.')).toBeVisible(); +}); + +test('Mass Delete Categories', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Categories' }).click(); + await page.locator('div').filter({ hasText: /^3Winter Wear1Active11$/ }).locator('label span').click(); + await page.locator('div').filter({ hasText: /^2Men1Active2$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('The category has been successfully deleted.')).toBeVisible(); +}); + +test('Mass Update Categories', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('link', { name: 'Categories' }).click(); + await page.locator('div').filter({ hasText: /^3Winter Wear1Active11$/ }).locator('label span').click(); + await page.locator('div').filter({ hasText: /^2Men1Active2$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Active', exact: true }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByRole('link', { name: 'Attributes' }).click(); + + await expect(page.getByText('category updated successfully.')).toBeVisible(); +}); diff --git a/tests/admin/catalog/products.spec.ts b/tests/admin/catalog/products.spec.ts new file mode 100644 index 00000000000..db575d52ba8 --- /dev/null +++ b/tests/admin/catalog/products.spec.ts @@ -0,0 +1,1047 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Product(simple)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('simple'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('123'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('021'); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#weight').click(); + await page.locator('#weight').fill('1222223'); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#length').click(); + await page.locator('#length').fill('12312'); + await page.locator('#width').click(); + await page.locator('#width').fill('1232'); + await page.locator('#height').click(); + await page.locator('#height').fill('3123'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Create Product(virtual)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('virtual'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('12345'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('021'); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Create Product(downloadable)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('downloadable'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('12343'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('12343'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7');await page.getByText('Add Link').first().click(); + await page.locator('input[name="title"]').click(); + await page.locator('input[name="title"]').fill('Demo_qwwee'); + await page.locator('input[name="price"]').first().click(); + await page.locator('input[name="price"]').first().fill('123213'); + await page.locator('select[name="type"]').selectOption('url'); + await page.locator('input[name="url"]').click(); + await page.locator('input[name="url"]').click(); + await page.locator('input[name="url"]').fill(`${config.baseUrl}/admin/catalog/products/edit/15`); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(simple)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Simple', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('021'); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#weight').click(); + await page.locator('#weight').fill('1222223'); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#length').click(); + await page.locator('#length').fill('12312'); + await page.locator('#width').click(); + await page.locator('#width').fill('1232'); + await page.locator('#height').click(); + await page.locator('#height').fill('3123'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(virtual)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Virtual', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('021'); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(downloadable)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Downloadable', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('12343'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#price').click(); + await page.locator('#price').fill('12312'); + await page.locator('#cost').click(); + await page.locator('#cost').fill('213'); + await page.locator('.box-shadow > div:nth-child(4) > div').click(); + await page.locator('#special_price').fill('12311'); + await page.locator('#special_price_from').click(); + await page.getByLabel('December 18,').first().click(); + await page.locator('#special_price_from').fill('2024-12-18'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 12,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-12'); + await page.locator('#special_price_to').click(); + await page.getByLabel('December 20,').nth(1).click(); + await page.locator('#special_price_to').fill('2024-12-20'); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByText('Add Link').first().click(); + await page.locator('input[name="title"]').click(); + await page.locator('input[name="title"]').fill('Demo_qwwee'); + await page.locator('input[name="price"]').first().click(); + await page.locator('input[name="price"]').first().fill('123213'); + await page.locator('select[name="type"]').selectOption('url'); + await page.locator('input[name="url"]').click(); + await page.locator('input[name="url"]').click(); + await page.locator('input[name="url"]').fill(`${config.baseUrl}/admin/catalog/products/edit/15`); + await page.locator('input[name="sample_file"]').nth(1).click(); + // await page.locator('input[name="sample_file"]').nth(1).setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Create Product(bundle)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('bundle'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('123'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByText('Add Option').click(); + await page.locator('input[name="label"]').click(); + await page.locator('input[name="label"]').fill('Demo_option1'); + await page.locator('select[name="type"]').selectOption('radio'); + await page.getByText('Type Select Radio Checkbox Multiselect Is Required Yes No').click(); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + await page.locator('.grid > .secondary-button').click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.locator('div:nth-child(5) > div:nth-child(6) > div > div > div > div:nth-child(2) > .cursor-pointer').first().click(); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(bundle)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Bundle', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('123'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.getByText('Add Option').click(); + await page.locator('input[name="label"]').click(); + await page.locator('input[name="label"]').fill('Demo_option1'); + await page.locator('select[name="type"]').selectOption('radio'); + await page.getByText('Type Select Radio Checkbox Multiselect Is Required Yes No').click(); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + await page.locator('.grid > .secondary-button').click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.locator('div:nth-child(5) > div:nth-child(6) > div > div > div > div:nth-child(2) > .cursor-pointer').first().click(); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Create Product(grouped)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('grouped'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('123'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.locator('.mb-2\\.5 > div:nth-child(2) > .secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByText('Add Selected Product').click(); + await page.locator('input[name="links\\[link_0\\]\\[qty\\]"]').click(); + await page.locator('input[name="links\\[link_0\\]\\[qty\\]"]').fill('13'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(grouped)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Grouped', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('123'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.locator('.mb-2\\.5 > div:nth-child(2) > .secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByText('Add Selected Product').click(); + await page.locator('input[name="links\\[link_0\\]\\[qty\\]"]').click(); + await page.locator('input[name="links\\[link_0\\]\\[qty\\]"]').fill('13'); + await page.getByRole('button', { name: 'Save Product' }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Create Product(configurable)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByRole('button', { name: 'Create Product' }).click(); + await page.locator('select[name="type"]').selectOption('configurable'); + await page.locator('select[name="attribute_family_id"]').selectOption('1'); + await page.locator('input[name="sku"]').click(); + await page.locator('input[name="sku"]').fill('Demo_12we'); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('p').filter({ hasText: 'Yellow' }).locator('span').click(); + await page.locator('div:nth-child(2) > div > p:nth-child(3) > .icon-cross').click(); + await page.locator('p').filter({ hasText: 'Red' }).locator('span').click(); + await page.getByRole('button', { name: 'Save Product' }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.locator('.flex > div:nth-child(6) > div:nth-child(2)').click(); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByText('Select Variants Color GreenColor BlackColor WhiteSize SSize MSize XL Select').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByText('Edit Names').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('.icon-cross').click(); + await page.locator('.grid > .flex > div > .cursor-pointer').first().click(); + await page.locator('input[name="name"]').nth(1).click(); + await page.locator('input[name="name"]').nth(1).fill('Demo_Variant 2 6asdsad'); + await page.locator('input[name="sku"]').nth(1).click(); + await page.locator('input[name="sku"]').nth(1).click(); + await page.locator('input[name="sku"]').nth(1).fill('Demo_12we-variant-2-6sds'); + await page.locator('input[name="sku"]').nth(1).press('CapsLock'); + await page.locator('input[name="sku"]').nth(1).fill('Demo_12we-variant-2-6sdsWDW'); + await page.locator('input[name="price"]').click(); + await page.locator('input[name="price"]').fill('342234'); + await page.locator('select[name="status"]').selectOption('0'); + await page.locator('input[name="weight"]').click(); + await page.locator('input[name="weight"]').fill('0234'); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('023'); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Edit Product(configurable)', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div:nth-child(2) > div > div > div > .relative').first().click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Select ' }).nth(2).click(); + await page.getByText('Grouped', { exact: true }).click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('.row > div:nth-child(3) > div:nth-child(2) > a:nth-child(2)').first().click(); + await page.locator('.icon-delete').first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.getByText('Delete', { exact: true }).nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('#sku').click(); + await page.locator('#product_number').click(); + await page.locator('#product_number').fill('1234'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_ajkshuyi'); + await page.locator('#short_description_ifr').contentFrame().locator('html').click(); + await page.locator('#short_description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdfhsiyu hsdgf'); + await page.locator('#description_ifr').contentFrame().locator('html').click(); + await page.locator('#description_ifr').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_skdhff isudiu'); + await page.locator('#meta_title').click(); + await page.locator('#meta_title').fill('Demo_sdfiughfier'); + await page.locator('#meta_keywords').click(); + await page.locator('#meta_keywords').fill('Demo_sdghfyuweib'); + await page.locator('#meta_description').click(); + await page.locator('#meta_description').fill('Demo_sudfgiweuyb'); + await page.locator('label').filter({ hasText: 'Add Image png, jpeg, jpg' }).locator('div').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('.secondary-button').first().click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Touchscreen Winter GlovesSKU - SP-003\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(1).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('div').filter({ hasText: /^Arctic Warmth Wool Blend SocksSKU - SP-004\$21\.00100 Available$/ }).locator('label').click(); + await page.locator('div').filter({ hasText: /^Arctic Bliss Stylish Winter ScarfSKU - SP-002\$17\.00100 Available$/ }).locator('label').click(); + await page.locator('div:nth-child(6) > div:nth-child(4) > div:nth-child(2)').click(); + await page.getByText('Add Selected Product').click(); + await page.getByText('Add Product').nth(2).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('Demo_shdgfyu'); + await page.getByText('Add Selected Product').click(); + await page.locator('label').filter({ hasText: 'Winter Wear' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('div:nth-child(6) > .relative > label').click(); + await page.locator('div:nth-child(4) > .relative > label').click(); + await page.locator('#visible_individually').click(); + await page.locator('div:nth-child(3) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#color').click(); + await page.locator('#color').selectOption('2'); + await page.locator('#size').selectOption('7'); + await page.locator('.flex > div:nth-child(6) > div:nth-child(2)').click(); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByText('Select Variants Color GreenColor BlackColor WhiteSize SSize MSize XL Select').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByText('Edit Names').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + await page.locator('.icon-cross').click(); + await page.locator('.grid > .flex > div > .cursor-pointer').first().click(); + await page.locator('input[name="name"]').nth(1).click(); + await page.locator('input[name="name"]').nth(1).fill('Demo_Variant 2 6asdsad'); + await page.locator('input[name="sku"]').nth(1).click(); + await page.locator('input[name="sku"]').nth(1).click(); + await page.locator('input[name="sku"]').nth(1).fill('Demo_12we-variant-2-6sds'); + await page.locator('input[name="sku"]').nth(1).press('CapsLock'); + await page.locator('input[name="sku"]').nth(1).fill('Demo_12we-variant-2-6sdsWDW'); + await page.locator('input[name="price"]').click(); + await page.locator('input[name="price"]').fill('342234'); + await page.locator('select[name="status"]').selectOption('0'); + await page.locator('input[name="weight"]').click(); + await page.locator('input[name="weight"]').fill('0234'); + await page.locator('input[name="inventories\\[1\\]"]').click(); + await page.locator('input[name="inventories\\[1\\]"]').fill('023'); + await page.getByRole('button', { name: 'Save', exact: true }).click(); + + await expect(page.getByText('Product updated successfully')).toBeVisible(); +}); + +test('Mass Delete Products', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.getByText('Filter', { exact: true }).click(); + await page.getByText('Clear All').first().click(); + await page.getByRole('button', { name: 'Apply Filters' }).click(); + await page.locator('div > .icon-uncheckbox').first().click(); + await page.locator('div:nth-child(4) > div > .icon-uncheckbox').click(); + await page.locator('div').filter({ hasText: /^NameSKUAttribute Family$/ }).locator('label span').click(); + await page.locator('div').filter({ hasText: /^NameSKUAttribute Family$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Products Deleted Successfully')).toBeVisible(); +}); + +test('Mass Update Products', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Catalog' }).click(); + await page.locator('div > .icon-uncheckbox').first().click(); + await page.locator('div:nth-child(3) > div > .icon-uncheckbox').click(); + await page.locator('div:nth-child(4) > div > .icon-uncheckbox').click(); + await page.locator('div:nth-child(5) > div > .icon-uncheckbox').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Active' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Products Updated Successfully')).toBeVisible(); +}); diff --git a/tests/admin/cms.spec.ts b/tests/admin/cms.spec.ts new file mode 100644 index 00000000000..4fb40b2ba3c --- /dev/null +++ b/tests/admin/cms.spec.ts @@ -0,0 +1,86 @@ +import { test, expect, config } from '../utils/setup'; + +test('Create Page', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' CMS' }).click(); + await page.getByRole('link', { name: 'Create Page' }).click(); + await page.getByPlaceholder('Title', { exact: true }).click(); + await page.getByPlaceholder('Title', { exact: true }).fill('Demo_Title'); + await page.locator('#channels_1').nth(1).click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().locator('html').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdkjfuhgyu hswdfgcwae'); + await page.getByPlaceholder('Meta Title').click(); + await page.getByPlaceholder('Meta Title').fill('Demo_wedwedwd'); + await page.getByPlaceholder('URL Key').click(); + await page.getByPlaceholder('URL Key').fill('Demo_ewdwqedqe4de'); + await page.getByPlaceholder('Meta Keywords').click(); + await page.getByPlaceholder('Meta Keywords').fill('Demo_qw3edxcwe'); + await page.getByPlaceholder('Meta Description').click(); + await page.getByPlaceholder('Meta Description').fill('Demo_ew3r4434'); + await page.getByRole('button', { name: 'Save Page' }).click(); + + await expect(page.getByText('CMS created successfully.')).toBeVisible(); +}); + +test('Edit Page', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' CMS' }).click(); + await page.locator('div').locator('span.cursor-pointer.rounded-md.icon-edit').nth(2).click(); + await page.getByPlaceholder('Page Title').fill('Demo_okhjasd'); + await page.locator('label:text("Default")').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().locator('html').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_sdkjfuhgyu hswdfgcwae'); + await page.getByPlaceholder('Meta Title').click(); + await page.getByPlaceholder('Meta Title').fill('Demo_wedwedwd'); + await page.getByPlaceholder('URL Key').click(); + await page.getByPlaceholder('URL Key').fill('Demo_ewdwqedqe4de'); + await page.getByPlaceholder('Meta Keywords').click(); + await page.getByPlaceholder('Meta Keywords').fill('Demo_qw3edxcwe'); + await page.getByPlaceholder('Meta Description').click(); + await page.getByPlaceholder('Meta Description').fill('Demo_ew3r4434'); + await page.getByRole('button', { name: 'Save Page' }).click(); + + await expect(page.getByText('CMS updated successfully.')).toBeVisible(); +}); + +test('Delete Page', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' CMS' }).click(); + await page.locator('div').locator('span.cursor-pointer.rounded-md.icon-delete').nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('CMS deleted successfully.')).toBeVisible(); +}); + +test('Mass Delete Pages', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' CMS' }).click(); + await page.locator('span.icon-uncheckbox').nth(2).click(); + await page.locator('span.icon-uncheckbox').nth(3).click(); + await page.locator('span.icon-uncheckbox').nth(4).click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Data Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/configuration/catalog.spec.ts b/tests/admin/configuration/catalog.spec.ts new file mode 100644 index 00000000000..6b298075e0b --- /dev/null +++ b/tests/admin/configuration/catalog.spec.ts @@ -0,0 +1,122 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Products of Catalog', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Products Product view page,' }).click(); + await page.getByLabel('Search Engine').selectOption('elastic'); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').first().click(); + await page.locator('label > div').first().click(); + await page.getByLabel('Compare options').click(); + await page.locator('div').filter({ hasText: 'Settings Settings refer to' }).nth(3).click(); + await page.locator('label > div').first().click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Image Search Option').click(); + await page.locator('div').filter({ hasText: 'Settings Settings refer to' }).nth(3).click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Search Engine').selectOption('database'); + await page.getByText('Search Engine DatabaseElastic SearchAdmin Search Mode DatabaseElastic').click(); + await page.getByLabel('Storefront Search Mode').selectOption('elastic'); + await page.getByLabel('Minimum query length').click(); + await page.getByLabel('Minimum query length').press('Tab'); + await page.getByLabel('Maximum query length').click(); + await page.getByLabel('Maximum query length').click(); + await page.getByLabel('Minimum query length').click(); + await page.getByLabel('Minimum query length').fill('211'); + await page.getByLabel('Maximum query length').click(); + await page.getByLabel('Maximum query length').fill('100'); + await page.getByLabel('Allowed number of Related').click(); + await page.getByLabel('Allowed number of Related').fill('21'); + await page.getByLabel('Allowed number of Up-Sell').click(); + await page.getByLabel('Allowed number of Up-Sell').fill('122'); + await page.getByLabel('Allowed number of Cross-Sell').click(); + await page.getByLabel('Allowed number of Cross-Sell').fill('1'); + await page.getByLabel('Default List Mode Default').selectOption('grid'); + await page.getByLabel('Products Per Page Default').click(); + await page.getByLabel('Products Per Page Default').click(); + await page.getByLabel('Products Per Page Default').fill('1222'); + await page.getByLabel('Sort By Default').selectOption('name-desc'); + await page.locator('div:nth-child(10) > div:nth-child(8) > .mb-4').click(); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').first().click(); + await page.locator('[id="catalog\\[products\\]\\[cache_small_image\\]\\[width\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_small_image\\]\\[width\\]"]').fill('12'); + await page.locator('[id="catalog\\[products\\]\\[cache_small_image\\]\\[height\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_small_image\\]\\[height\\]"]').fill('21'); + await page.getByLabel('Small Image Placeholder').click(); + // await page.getByLabel('Small Image Placeholder').setInputFiles('screenshot_1732536834544.png'); + await page.locator('[id="catalog\\[products\\]\\[cache_medium_image\\]\\[width\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_medium_image\\]\\[width\\]"]').fill('21'); + await page.locator('[id="catalog\\[products\\]\\[cache_medium_image\\]\\[height\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_medium_image\\]\\[height\\]"]').fill('22222221'); + await page.getByLabel('Medium Image Placeholder').click(); + // await page.getByLabel('Medium Image Placeholder').setInputFiles('screenshot_1732533139793.png'); + await page.locator('[id="catalog\\[products\\]\\[cache_large_image\\]\\[width\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_large_image\\]\\[width\\]"]').fill('12'); + await page.locator('[id="catalog\\[products\\]\\[cache_large_image\\]\\[height\\]"]').click(); + await page.locator('[id="catalog\\[products\\]\\[cache_large_image\\]\\[height\\]"]').fill('21'); + await page.locator('div:nth-child(18) > div > .mb-4').first().click(); + await page.locator('div:nth-child(18) > div > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Allowed Image Upload Size (in').click(); + await page.getByLabel('Allowed Image Upload Size (in').fill('12'); + await page.getByLabel('Allowed File Upload Size (in').click(); + await page.getByLabel('Allowed File Upload Size (in').fill('222'); + await page.locator('div:nth-child(22) > div > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Enable Social Share?').click(); + await page.locator('div:nth-child(22) > div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(22) > div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(22) > div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.getByText('Enable Share in What\'s App? What\'s App share link just will appear to mobile').click(); + await page.locator('div:nth-child(12) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(10) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(14) > .mb-4 > .relative > div').click(); + await page.getByLabel('Share Message').click(); + await page.getByLabel('Share Message').fill('Demo_qwsqc'); + await page.getByText('Products Back Save Configuration Default Default English Arabic Bengali').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Rich Snippets of Catalog', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Rich Snippets Set products' }).click(); + await page.locator('label > div').first().click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Show SKU').click(); + await page.locator('div:nth-child(12) > .mb-4 > .relative').click(); + await page.locator('div:nth-child(14) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(16) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(4) > div > .mb-4 > .relative > div').first().click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Inventory of Catalog', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Inventory Configure inventory' }).click(); + await page.locator('label > div').click(); + await page.getByLabel('Out-of-Stock Threshold').click(); + await page.getByLabel('Out-of-Stock Threshold').fill('01'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); diff --git a/tests/admin/configuration/customer.spec.ts b/tests/admin/configuration/customer.spec.ts new file mode 100644 index 00000000000..f81b380d2d7 --- /dev/null +++ b/tests/admin/configuration/customer.spec.ts @@ -0,0 +1,65 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Address of Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Address Set country, state,' }).click(); + await page.getByLabel('Lines in a Street Address').click(); + await page.getByLabel('Lines in a Street Address').fill('2'); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.getByLabel('State Default').click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.locator('div').filter({ hasText: /^Country Default$/ }).nth(1).click(); + await page.locator('label > div').first().click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Captcha of Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Captcha Set site key, secret' }).click(); + await page.getByLabel('Site Key Default').click(); + await page.getByLabel('Site Key Default').fill('asded@werwe/tyuyhg'); + await page.getByLabel('Secret Key Default').click(); + await page.getByLabel('Secret Key Default').fill('Demo_tyutyu yut'); + await page.locator('label > div').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Settings of Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Settings Set newsletter' }).click(); + await page.locator('label > div').first().click(); + await page.getByLabel('Redirect Customer to the').selectOption('account'); + await page.getByLabel('Default Group').selectOption('wholesale'); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').first().click(); + await page.locator('div').filter({ hasText: /^Enable Facebook Default$/ }).nth(1).click(); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(12) > div > .mb-4 > .relative > div').first().click(); + await page.locator('label > div').first().click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); diff --git a/tests/admin/configuration/email.spec.ts b/tests/admin/configuration/email.spec.ts new file mode 100644 index 00000000000..bddc465d052 --- /dev/null +++ b/tests/admin/configuration/email.spec.ts @@ -0,0 +1,48 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Settings of Email', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Email Settings Set email' }).click(); + await page.getByLabel('Email Sender Name Default').click(); + await page.getByLabel('Email Sender Name Default').fill('User _test'); + await page.getByLabel('Shop Email Address Default').click(); + await page.getByLabel('Shop Email Address Default').fill('Demo_User@gmail.com'); + await page.getByLabel('Admin Name Default').click(); + await page.getByLabel('Admin Name Default').fill('Admin'); + await page.getByLabel('Admin Email Default').click(); + await page.getByLabel('Admin Email Default').fill('Admin@gmail.com'); + await page.getByLabel('Contact Name Default').click(); + await page.getByLabel('Contact Name Default').fill('Name'); + await page.getByLabel('Contact Email Default').click(); + await page.getByLabel('Contact Email Default').fill('Demo_User@example.com'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Notifications of Email', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click();await page.getByText('Dashboard Sales Orders').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Notifications To configure,' }).click(); + await page.locator('.mb-4 > .mb-4').first().click(); + await page.locator('label > div').first().click(); + await page.locator('div:nth-child(4) > .mb-4').click(); + await page.locator('div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(12) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(20) > .mb-4 > .relative > div').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); diff --git a/tests/admin/configuration/general.spec.ts b/tests/admin/configuration/general.spec.ts new file mode 100644 index 00000000000..fb2b18fa43e --- /dev/null +++ b/tests/admin/configuration/general.spec.ts @@ -0,0 +1,99 @@ +import { test, expect, config } from '../../utils/setup'; + +test('General of General', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'General Set units options.' }).click(); + await page.getByLabel('Weight Unit Default').selectOption('lbs'); + await page.locator('label > div').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Content of General', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Content Set compare options,' }).click(); + await page.getByLabel('Offer Title').click(); + await page.getByLabel('Offer Title').fill('Demo_Get UPTO 40% OFF on your 1st orderd'); + await page.getByLabel('Redirection Title').click(); + await page.getByLabel('Redirection Title').fill('SHOP NOW'); + await page.getByLabel('Redirection Link').click(); + await page.getByLabel('Redirection Link').click(); + await page.getByLabel('Redirection Link').fill(`${config.baseUrl}/admin/configuration/general/content`); + await page.getByLabel('Custom CSS Default').click(); + await page.getByLabel('Custom CSS Default').fill('Demo_qqwee'); + await page.getByLabel('Custom Javascript Default').click(); + await page.getByLabel('Custom Javascript Default').fill('Demo_wqqwqw'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Design of General', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Design Set logo and favicon' }).click(); + await page.getByLabel('Logo Image').click(); + await page.getByLabel('Logo Image').setInputFiles('user.png'); + await page.getByLabel('Favicon').click(); + // await page.getByLabel('Favicon').setInputFiles('screenshot_1732536834544.png'); + await page.locator('[id="general\\[design\\]\\[admin_logo\\]\\[favicon\\]\\[delete\\]"]').nth(1).click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Magic AI of General', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Magic AI Set Magic AI options.' }).click(); + await page.locator('label > div').first().click(); + await page.getByLabel('API Key Default').click(); + await page.getByLabel('API Key Default').fill('Demo_asds asdasdsa'); + await page.getByLabel('Organization Default').click(); + await page.getByLabel('Organization Default').fill('Demo_asdqwqw sad'); + await page.getByLabel('LLM API Domain Default').click(); + await page.getByLabel('LLM API Domain Default').fill('Demo_asdqw sdsd'); + await page.locator('div:nth-child(4) > div > .mb-4 > .relative > div').click(); + await page.getByLabel('Product Short Description').click(); + await page.getByLabel('Product Short Description').fill('Demo_asd saadssa'); + await page.getByLabel('Product Description Prompt').click(); + await page.getByLabel('Product Description Prompt').fill('Demo_sadqwdwe sdasdas'); + await page.getByLabel('Category Description Prompt').click(); + await page.getByLabel('Category Description Prompt').fill('Demo_dasdweq'); + await page.getByLabel('CMS Page Content Prompt').click(); + await page.getByLabel('CMS Page Content Prompt').fill('Demo_sadawdqwwwwww'); + await page.locator('div:nth-child(6) > div > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(8) > div > .mb-4 > .relative > div').click(); + await page.locator('[id="general\\[magic_ai\\]\\[review_translation\\]\\[model\\]"]').selectOption('llava'); + await page.locator('div:nth-child(10) > div > .mb-4').first().click(); + await page.locator('div:nth-child(10) > div > .mb-4 > .relative > div').click(); + await page.locator('[id="general\\[magic_ai\\]\\[checkout_message\\]\\[model\\]"]').selectOption('llama2:70b'); + await page.getByLabel('Prompt DefaultEnglish').click(); + await page.getByLabel('Prompt DefaultEnglish').fill('Demo_qwqwasdf'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); diff --git a/tests/admin/configuration/sales.spec.ts b/tests/admin/configuration/sales.spec.ts new file mode 100644 index 00000000000..f8354c67c80 --- /dev/null +++ b/tests/admin/configuration/sales.spec.ts @@ -0,0 +1,232 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Shipping Settings of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Shipping Settings Configure' }).click(); + await page.getByLabel('Country DefaultEnglish').selectOption('IN'); + await page.getByLabel('State DefaultEnglish').selectOption('UP'); + await page.getByLabel('City DefaultEnglish').click(); + await page.getByLabel('City DefaultEnglish').fill('Noida'); + await page.getByLabel('Street Address DefaultEnglish').click(); + await page.getByLabel('Street Address DefaultEnglish').fill('Sector 22'); + await page.getByLabel('Zip DefaultEnglish').click(); + await page.getByLabel('Zip DefaultEnglish').fill('201302'); + await page.getByLabel('Store Name DefaultEnglish').click(); + await page.getByLabel('Store Name DefaultEnglish').fill('Demo_qwertyuiop'); + await page.getByLabel('Vat Number Default').click(); + await page.getByLabel('Contact Number Default').click(); + await page.getByLabel('Contact Number Default').fill('9876543210'); + await page.getByLabel('Bank Details DefaultEnglish').click(); + await page.getByLabel('Bank Details DefaultEnglish').fill('Demo_sjdhjd shdgyuw'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Shipping Methods of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Shipping Methods Configure' }).click(); + await page.locator('input[name="sales\\[carriers\\]\\[free\\]\\[title\\]"]').click(); + await page.locator('input[name="sales\\[carriers\\]\\[free\\]\\[title\\]"]').fill('Demo_Free Shipping'); + await page.locator('[id="sales\\[carriers\\]\\[free\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[carriers\\]\\[free\\]\\[description\\]"]').fill('Demo_Free Shipping'); + await page.locator('label > div').first().click(); + await page.locator('label > div').first().click(); + await page.locator('[id="sales\\[carriers\\]\\[flatrate\\]\\[title\\]"]').click(); + await page.locator('[id="sales\\[carriers\\]\\[flatrate\\]\\[title\\]"]').fill('Demo_Flat Rate'); + await page.locator('[id="sales\\[carriers\\]\\[flatrate\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[carriers\\]\\[flatrate\\]\\[description\\]"]').fill('Demo_Flat Rate Shipping'); + await page.getByLabel('Rate Default').click(); + await page.getByLabel('Rate Default').fill('104'); + await page.getByLabel('Type Default').selectOption('per_order'); + await page.locator('div:nth-child(10) > .mb-4 > .relative > div').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Payment Methods of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Payment Methods Set payment' }).click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[title\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[title\\]"]').fill('Demo_PayPal Smart Buttonfcg'); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[description\\]"]').fill('Demo_PayPaldfgdg'); + await page.getByLabel('Client ID Default').click(); + await page.getByLabel('Client ID Default').fill('Demo_sbdfgdf'); + await page.getByLabel('Client Secret Default').click(); + await page.getByLabel('Client Secret Default').fill('Demo_dfgdrtger'); + await page.getByLabel('Accepted currencies Default').click(); + await page.getByLabel('Accepted currencies Default').fill('Demo_fdgrter'); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_smart_button\\]\\[sort\\]"]').selectOption('2'); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[title\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[title\\]"]').fill('Demo_Cash On Deliverygdgdf'); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[description\\]"]').fill('Demo_Cash On Deliverydfgdfger'); + await page.getByLabel('Instructions DefaultEnglish').click(); + await page.getByLabel('Instructions DefaultEnglish').fill('Demo_dfgdrt4t'); + await page.locator('div:nth-child(10) > .mb-4 > .relative > div').first().click(); + await page.getByLabel('Set the invoice status after').selectOption('paid'); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[order_status\\]"]').selectOption('pending_payment'); + await page.locator('div:nth-child(4) > div:nth-child(16) > .mb-4 > .relative > div').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[sort\\]"]').selectOption('3'); + await page.locator('div:nth-child(10) > .mb-4 > .relative > div').first().click(); + await page.locator('[id="sales\\[payment_methods\\]\\[cashondelivery\\]\\[generate_invoice\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_standard\\]\\[sort\\]"]').selectOption('2'); + await page.locator('div:nth-child(8) > div:nth-child(10) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(12) > .mb-4 > .relative > div').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_standard\\]\\[description\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_standard\\]\\[description\\]"]').fill('Demo_PayPal Standardert'); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_standard\\]\\[title\\]"]').click(); + await page.locator('[id="sales\\[payment_methods\\]\\[paypal_standard\\]\\[title\\]"]').fill('Demo_PayPal Standarderter'); + await page.getByLabel('Business Account Default').click(); + await page.getByLabel('Business Account Default').fill('test@webkul.comre'); + await page.getByLabel('Send Check to DefaultEnglish').click(); + await page.getByLabel('Send Check to DefaultEnglish').fill('Demo_reter'); + await page.locator('[id="sales\\[payment_methods\\]\\[moneytransfer\\]\\[order_status\\]"]').selectOption('pending_payment'); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.getByLabel('Set the invoice status after').selectOption('pending'); + await page.locator('div:nth-child(4) > div:nth-child(16) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(10) > .mb-4 > .relative > div').first().click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Order Settings of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Order Settings Set order' }).click(); + await page.getByLabel('Order Number Prefix Default').click(); + await page.getByLabel('Order Number Prefix Default').fill('Demo_sdfwee'); + await page.getByLabel('Order Number Length Default').click(); + await page.getByLabel('Order Number Length Default').fill('32'); + await page.getByLabel('Order Number Suffix Default').click(); + await page.getByLabel('Order Number Suffix Default').fill('Demo_frwerf'); + await page.getByLabel('Order Number Generator Default').click(); + await page.getByLabel('Order Number Generator Default').fill('Demo_erwr34'); + await page.locator('.mt-6 > div:nth-child(4) > div > .mb-4').first().click(); + await page.locator('label > div').first().click(); + await page.getByLabel('Minimum Order Amount Default').click(); + await page.getByLabel('Minimum Order Amount Default').fill('324'); + await page.locator('div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.getByLabel('Description Default').click(); + await page.getByLabel('Description Default').fill('Demo_dfgter df'); + await page.locator('div:nth-child(6) > div > .mb-4 > .relative > div').first().click(); + await page.locator('div:nth-child(6) > div > .mb-4 > .relative > div').first().click(); + await page.getByText('Shop Reorder Enable or').click(); + await page.getByText('Shop Reorder Enable or').click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.getByLabel('Shop Reorder').click(); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Invoice Settings of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Invoice Settings Set invoice' }).click(); + await page.getByLabel('Invoice Number Prefix').click(); + await page.getByLabel('Invoice Number Prefix').fill('Demo_asdadas'); + await page.getByLabel('Invoice Number Length').click(); + await page.getByLabel('Invoice Number Length').fill('3'); + await page.getByLabel('Invoice Number Suffix').click(); + await page.getByLabel('Invoice Number Suffix').fill('Demo_we23'); + await page.getByLabel('Invoice Number Generator').click(); + await page.getByLabel('Invoice Number Generator').fill('Demo_we23edw'); + await page.getByLabel('Due Duration Default').click(); + await page.getByLabel('Due Duration Default').fill('23'); + await page.locator('label > div').first().click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.getByLabel('Footer text DefaultEnglish').click(); + await page.getByLabel('Footer text DefaultEnglish').fill('Demo_fdwsewr'); + await page.getByLabel('Maximum limit of reminders').click(); + await page.getByLabel('Maximum limit of reminders').fill('23'); + await page.getByLabel('Interval between reminders').selectOption('P2W'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Taxes of Sales', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Taxes Taxes are mandatory' }).click(); + await page.getByLabel('Product Default Tax Category').click(); + await page.getByLabel('Calculation Based On').selectOption('billing_address'); + await page.getByText('Calculation Based On Shipping AddressBilling AddressShipping OriginProduct').click(); + await page.getByLabel('Product Prices').selectOption('including_tax'); + await page.getByLabel('Shipping Prices').selectOption('including_tax'); + await page.getByLabel('Default Country').selectOption('AU'); + await page.getByLabel('Default State').click(); + await page.getByLabel('Default State').fill('Demo_asdwe'); + await page.getByLabel('Default Post Code').click(); + await page.getByLabel('Default Post Code').fill('23424'); + await page.locator('[id="sales\\[taxes\\]\\[shopping_cart\\]\\[display_prices\\]"]').selectOption('including_tax'); + await page.locator('[id="sales\\[taxes\\]\\[shopping_cart\\]\\[display_subtotal\\]"]').selectOption('both'); + await page.locator('[id="sales\\[taxes\\]\\[shopping_cart\\]\\[display_shipping_amount\\]"]').selectOption('both'); + await page.locator('[id="sales\\[taxes\\]\\[sales\\]\\[display_prices\\]"]').selectOption('including_tax'); + await page.locator('[id="sales\\[taxes\\]\\[sales\\]\\[display_subtotal\\]"]').selectOption('both'); + await page.locator('[id="sales\\[taxes\\]\\[sales\\]\\[display_shipping_amount\\]"]').selectOption('both'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); + +test('Checkout of Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Configure' }).click(); + await page.getByRole('link', { name: 'Checkout Set guest checkout,' }).click(); + await page.locator('label > div').first().click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(6) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(8) > .mb-4 > .relative > div').click(); + await page.locator('div:nth-child(4) > .mb-4 > .relative > div').click(); + await page.getByLabel('Summary').selectOption('display_item_quantity'); + await page.getByLabel('Mini Cart Offer Information').click(); + await page.getByLabel('Mini Cart Offer Information').fill('Get Up To 30% OFF on your 1st orderawsqw'); + await page.getByRole('button', { name: 'Save Configuration' }).click(); + + await expect(page.getByText('Configuration saved successfully')).toBeVisible(); +}); diff --git a/tests/admin/customers/customers.spec.ts b/tests/admin/customers/customers.spec.ts new file mode 100644 index 00000000000..8016961f844 --- /dev/null +++ b/tests/admin/customers/customers.spec.ts @@ -0,0 +1,251 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('button', { name: 'Create Customer' }).click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_User'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_test'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('Demo_asdghwyug@jksyeuw.wshg'); + await page.getByPlaceholder('Contact Number').click(); + await page.getByPlaceholder('Contact Number').fill('9234783632'); + await page.locator('#gender').selectOption('Other'); + await page.locator('#customerGroup').selectOption('3'); + await page.getByPlaceholder('Date of Birth').fill('2024-12-03'); + await page.getByRole('button', { name: 'Save customer' }).click(); + + await expect(page.getByText('Customer created successfully')).toBeVisible(); +}); + +test('Edit Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Edit', { exact: true }).click(); + await page.locator('div:nth-child(2) > .relative > label').click(); + await page.locator('div:nth-child(2) > .relative > label').click(); + await page.locator('.relative > label').first().click(); + await page.locator('#status').click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_User'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_test'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('Demo_asdghwyug@jksyeuw.wshg'); + await page.getByPlaceholder('Contact Number').click(); + await page.getByPlaceholder('Contact Number').fill('9234783632'); + await page.locator('#gender').selectOption('Other'); + await page.locator('#customerGroup').selectOption('3'); + await page.getByPlaceholder('Date of Birth').fill('2024-12-03'); + await page.getByRole('button', { name: 'Save customer' }).click(); + + await expect(page.getByText('Customer Updated Successfully')).toBeVisible(); +}); + +test('Add Address', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Create', { exact: true }).click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('Demo_Webkul'); + await page.getByPlaceholder('Vat ID').click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_yhdguwyeew'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_rwereter'); + await page.getByPlaceholder('Email').click(); + await page.getByPlaceholder('Email').fill('Demo_rferfce@hsfgyuwe.dfiu'); + await page.getByPlaceholder('Phone').click(); + await page.getByPlaceholder('Phone').fill('236237562374'); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('Demo_jkdsfhueur'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_djfnkkerf'); + await page.getByPlaceholder('Post Code').click(); + await page.getByPlaceholder('Post Code').fill('2132136'); + await page.locator('select[name="country"]').selectOption('IN'); + await page.locator('#state').selectOption('DL'); + await page.locator('#default_address').nth(1).click(); + await page.getByRole('button', { name: 'Save Address' }).click(); + + await expect(page.getByText('Address Created Successfully')).toBeVisible(); +}); + +test('Edit Address', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Edit').nth(1).click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('Demo_Webkul'); + await page.getByPlaceholder('Vat ID').click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_yhdguwyeew'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_rwereter'); + await page.getByPlaceholder('Email').click(); + await page.getByPlaceholder('Email').fill('Demo_rferfce@hsfgyuwe.dfiu'); + await page.getByPlaceholder('Phone').click(); + await page.getByPlaceholder('Phone').fill('236237562374'); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('Demo_jkdsfhueur'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_djfnkkerf'); + await page.getByPlaceholder('Post Code').click(); + await page.getByPlaceholder('Post Code').fill('2132136'); + await page.locator('select[name="country"]').selectOption('IN'); + await page.locator('#state').selectOption('DL'); + await page.locator('#default_address').nth(1).click(); + await page.getByRole('button', { name: 'Save Address' }).click(); + + await expect(page.getByText('Address Updated Successfully')).toBeVisible(); +}); + +test('Set Default Address', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('button', { name: 'Set as Default' }).first().click(); + + await expect(page.getByText('Default Address Updated Successfully')).toBeVisible(); +}); + +test('Delete Address', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Delete', { exact: true }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Address Deleted Successfully')).toBeVisible(); +}); + +test('Add Note', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByPlaceholder('Write Your Note here').click(); + await page.getByPlaceholder('Write Your Note here').fill('Demo_sjdhiude'); + await page.getByText('Notify Customer').click(); + await page.getByRole('button', { name: 'Submit Note' }).click(); + + await expect(page.getByText('Note Created Successfully')).toBeVisible(); +}); + +test('Delete Account', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Delete Account').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Customer Deleted Successfully')).toBeVisible(); +}); + +test('Create Order', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + await page.getByText('Create Order').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Cart Items')).toBeVisible(); +}); + +test('login as Customer', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: '' }).first().click(); + const page3Promise = page.waitForEvent('popup'); + await page.getByRole('link', { name: ' Login as customer' }).click(); + const page3 = await page3Promise; + + await expect(page.getByPlaceholder('Search products here').first()).toBeVisible(); +}); + +test('Mass Delete Customers', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.locator('label').nth(1).click(); + await page.locator('label').nth(3).click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected data successfully deleted')).toBeVisible(); +}); + +test('Mass Update Customers', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.locator('div').filter({ hasText: /^Customer NameEmailContact Number$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Update' }).hover(); + await page.getByRole('link', { name: 'Active', exact: true }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Customers successfully updated')).toBeVisible(); +}); diff --git a/tests/admin/customers/groups.spec.ts b/tests/admin/customers/groups.spec.ts new file mode 100644 index 00000000000..1b0d82ae678 --- /dev/null +++ b/tests/admin/customers/groups.spec.ts @@ -0,0 +1,54 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Group', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Groups' }).click(); + await page.getByRole('button', { name: 'Create Group' }).click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('Demo_fsfwew'); + await page.locator('.box-shadow > div:nth-child(2) > div:nth-child(2)').click(); + await page.getByPlaceholder('Name').fill('Demo_wewerw'); + await page.getByRole('button', { name: 'Save Group' }).click(); + + await expect(page.getByText('Group created successfully')).toBeVisible(); +}); + +test('Edit Group', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Groups' }).click(); + await page.locator('div').filter({ hasText: /^4fsfwewwewerw$/ }).locator('a').first().click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('Demo_fsfwew'); + await page.locator('.box-shadow > div:nth-child(2) > div:nth-child(2)').click(); + await page.getByPlaceholder('Name').fill('Demo_wewerw'); + await page.getByRole('button', { name: 'Save Group' }).click(); + + await expect(page.getByText('Group Updated Successfully')).toBeVisible(); +}); + +test('Delete Group', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Groups' }).click(); + await page.locator('div').filter({ hasText: /^4fsfwewwewerw$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Group Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/customers/reviews.spec.ts b/tests/admin/customers/reviews.spec.ts new file mode 100644 index 00000000000..3c94057e9e6 --- /dev/null +++ b/tests/admin/customers/reviews.spec.ts @@ -0,0 +1,66 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Update Status of Review', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Reviews' }).click(); + await page.locator('div:nth-child(4) > a:nth-child(2)').click(); + await page.locator('select[name="status"]').selectOption('approved'); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Review Update Successfully')).toBeVisible(); +}); + +test('Delete Review', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Reviews' }).click(); + await page.locator('.row > div:nth-child(4) > a').first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Review Deleted Successfully')).toBeVisible(); +}); + +test('Mass Delete Reviews', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Reviews' }).click(); + await page.locator('div').filter({ hasText: /^NameProductStatus$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Review Deleted Successfully')).toBeVisible(); +}); + +test('Mass Update Reviews', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Customers' }).click(); + await page.getByRole('link', { name: 'Reviews' }).click(); + await page.locator('div').filter({ hasText: /^NameProductStatus$/ }).locator('label span').click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Disapproved' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected Review Updated Successfully')).toBeVisible(); +}); diff --git a/tests/admin/marketing/communications.spec.ts b/tests/admin/marketing/communications.spec.ts new file mode 100644 index 00000000000..bf1b6c43fcc --- /dev/null +++ b/tests/admin/marketing/communications.spec.ts @@ -0,0 +1,219 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Create Template', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Create Template' }).click(); + await page.locator('select[name="status"]').selectOption('active'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_User'); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByRole('paragraph').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_wsdbwdhwasd'); + await page.getByRole('button', { name: 'Save Template' }).click(); + + await expect(page.getByText('Email template created successfully.')).toBeVisible(); +}); + +test('Edit Create Template', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.locator('div').filter({ hasText: /^1UserActive$/ }).locator('span').first().click(); + await page.locator('select[name="status"]').selectOption('active'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_User'); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByRole('paragraph').click(); + await page.locator('iframe[title="Rich Text Area"]').contentFrame().getByLabel('Rich Text Area. Press ALT-0').fill('Demo_wsdbwdhwasd'); + await page.getByRole('button', { name: 'Save Template' }).click(); + + await expect(page.getByText('Updated successfully')).toBeVisible(); +}); + +test('Delete Template', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.locator('div').filter({ hasText: /^1UserActive$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Template Deleted successfully')).toBeVisible(); +}); + +test('Create Event', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Events' }).click(); + await page.getByText('Create Event').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_My'); + await page.locator('#description').click(); + await page.locator('#description').fill('Demo_jkhfw sdhskd'); + await page.getByPlaceholder('Date').click(); + await page.getByLabel('December 12,').click(); + await page.getByPlaceholder('Date').fill('2024-12-12'); + await page.getByRole('button', { name: 'Save Event' }).click(); + + await expect(page.getByText('Events Created Successfully')).toBeVisible(); +}); + +test('Edit Event', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Events' }).click(); + await page.locator('div').filter({ hasText: /^2My2024-12-12$/ }).locator('a').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_My'); + await page.locator('#description').click(); + await page.locator('#description').fill('Demo_jkhfw sdhskd'); + await page.getByPlaceholder('Date').click(); + await page.getByLabel('December 12,').click(); + await page.getByPlaceholder('Date').fill('2024-12-12'); + await page.getByRole('button', { name: 'Save Event' }).click(); + + await expect(page.getByText('Events Updated Successfully')).toBeVisible(); +}); + +test('Delete Event', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Events' }).click(); + await page.locator('div').filter({ hasText: /^2My2024-12-12$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Events Deleted Successfully')).toBeVisible(); +}); + +test('Create Campaign', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Campaigns' }).click(); + await page.getByRole('link', { name: 'Create Campaign' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_User'); + await page.getByPlaceholder('Subject').click(); + await page.getByPlaceholder('Subject').fill('Demo_sdgfjsdfg'); + await page.getByText('Event', { exact: true }).click(); + await page.locator('select[name="marketing_event_id"]').selectOption('1'); + await page.locator('select[name="marketing_template_id"]').selectOption('2'); + await page.locator('select[name="channel_id"]').selectOption('1'); + await page.locator('select[name="customer_group_id"]').selectOption('2'); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save Campaign' }).click(); + + await expect(page.getByText('Campaign created successfully.')).toBeVisible(); +}); + +test('Edit Campaign', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Campaigns' }).click(); + await page.locator('div').filter({ hasText: /^1dfgsdefgdfgsdActive$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_User'); + await page.getByPlaceholder('Subject').click(); + await page.getByPlaceholder('Subject').fill('Demo_sdgfjsdfg'); + await page.getByText('Event', { exact: true }).click(); + await page.locator('select[name="marketing_event_id"]').selectOption('1'); + await page.locator('select[name="marketing_template_id"]').selectOption('2'); + await page.locator('select[name="channel_id"]').selectOption('1'); + await page.locator('select[name="customer_group_id"]').selectOption('2'); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save Campaign' }).click(); + + await expect(page.getByText('Campaign updated successfully.')).toBeVisible(); +}); + +test('Delete Campaign', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Campaigns' }).click(); + await page.locator('div').filter({ hasText: /^1dfgsdefgdfgsdActive$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Campaign deleted successfully')).toBeVisible(); +}); + +test('Edit Newsletter Subscriber', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Newsletter Subscriptions' }).click(); + await page.locator('div').filter({ hasText: /^2TruetestUser@gmail\.coma$/ }).locator('a').first().click(); + await page.locator('select[name="is_subscribed"]').selectOption('0'); + await page.getByRole('button', { name: 'Save Subscriber' }).click(); + + await expect(page.getByText('Newsletter Subscription Updated Successfully')).toBeVisible(); +}); + +test('Delete Newsletter Subscriber', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Communications' }).click(); + await page.getByRole('link', { name: 'Newsletter Subscriptions' }).click(); + await page.locator('div').filter({ hasText: /^2FalsetestUser@gmail\.coma$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Subscriber Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/marketing/promotions.spec.ts b/tests/admin/marketing/promotions.spec.ts new file mode 100644 index 00000000000..4b09bbffb3a --- /dev/null +++ b/tests/admin/marketing/promotions.spec.ts @@ -0,0 +1,249 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Cart Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Cart Rules' }).click(); + await page.getByRole('link', { name: 'Create Cart Rule' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_jksdhwsd'); + await page.getByPlaceholder('Name').press('Tab'); + await page.getByPlaceholder('Description').fill('Demo_usdwoe'); + await page.getByPlaceholder('Description').press('Tab'); + await page.locator('#coupon_type').selectOption('1'); + await page.getByPlaceholder('Coupon Code').click(); + await page.getByPlaceholder('Coupon Code').fill('ewiyduew'); + await page.getByText('General Name Description').click(); + await page.getByPlaceholder('Uses Per Coupon').click(); + await page.getByPlaceholder('Uses Per Coupon').fill('23'); + await page.getByPlaceholder('Uses Per Customer').click(); + await page.getByPlaceholder('Uses Per Customer').fill('32'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[0\\]\\[attribute\\]"]').selectOption('cart_item|base_total'); + await page.locator('select[name="conditions\\[0\\]\\[operator\\]"]').selectOption('<='); + await page.locator('.mt-4 > div').click(); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').fill('32232'); + await page.getByText('Add Condition').click(); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[2\\]\\[attribute\\]"]').selectOption('product|attribute_family_id'); + await page.locator('select[name="conditions\\[2\\]\\[operator\\]"]').selectOption('!='); + await page.locator('select[name="conditions\\[2\\]\\[value\\]"]').selectOption('1'); + await page.locator('#action_type').selectOption('by_fixed'); + await page.getByPlaceholder('Discount Amount').click(); + await page.getByPlaceholder('Discount Amount').fill('03232'); + await page.getByPlaceholder('Maximum Quantity allowed to').click(); + await page.getByPlaceholder('Maximum Quantity allowed to').fill('32'); + await page.locator('#apply_to_shipping').selectOption('1'); + await page.locator('#free_shipping').selectOption('1'); + await page.getByPlaceholder('Buy X Quantity').click(); + await page.getByPlaceholder('Buy X Quantity').fill('023'); + await page.getByText('End Of Other Rules').click(); + await page.getByPlaceholder('To', { exact: true }).click(); + await page.getByLabel('December 5,').nth(1).click(); + await page.getByPlaceholder('From').click(); + await page.getByLabel('December 1,').first().click(); + await page.locator('.px-4 > div:nth-child(4)').click(); + await page.locator('.relative > label').click(); + await page.locator('#customer_group__3').nth(1).click(); + await page.getByLabel('Wholesale').click(); + await page.locator('.mb-2\\.5 > .mb-4').first().click(); + await page.locator('#channel__1').nth(1).click(); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('21'); + await page.getByRole('button', { name: 'Save Cart Rule' }).click(); + + await expect(page.getByText('Cart rule created successfully')).toBeVisible(); +}); + +test('Edit Cart Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Cart Rules' }).click(); + await page.locator('div').filter({ hasText: /^1jksdhwsdewiyduew2024-12-01 12:00:002024-12-05 12:00:00Active21$/ }).locator('span').first().click(); + await page.getByRole('link', { name: 'Create Cart Rule' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_jksdhwsd'); + await page.getByPlaceholder('Name').press('Tab'); + await page.getByPlaceholder('Description').fill('Demo_usdwoe'); + await page.getByPlaceholder('Description').press('Tab'); + await page.locator('#coupon_type').selectOption('1'); + await page.getByPlaceholder('Coupon Code').click(); + await page.getByPlaceholder('Coupon Code').fill('ewiyduew'); + await page.getByText('General Name Description').click(); + await page.getByPlaceholder('Uses Per Coupon').click(); + await page.getByPlaceholder('Uses Per Coupon').fill('23'); + await page.getByPlaceholder('Uses Per Customer').click(); + await page.getByPlaceholder('Uses Per Customer').fill('32'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[0\\]\\[attribute\\]"]').selectOption('cart_item|base_total'); + await page.locator('select[name="conditions\\[0\\]\\[operator\\]"]').selectOption('<='); + await page.locator('.mt-4 > div').click(); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').fill('32232'); + await page.getByText('Add Condition').click(); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[2\\]\\[attribute\\]"]').selectOption('product|attribute_family_id'); + await page.locator('select[name="conditions\\[2\\]\\[operator\\]"]').selectOption('!='); + await page.locator('select[name="conditions\\[2\\]\\[value\\]"]').selectOption('1'); + await page.locator('#action_type').selectOption('by_fixed'); + await page.getByPlaceholder('Discount Amount').click(); + await page.getByPlaceholder('Discount Amount').fill('03232'); + await page.getByPlaceholder('Maximum Quantity allowed to').click(); + await page.getByPlaceholder('Maximum Quantity allowed to').fill('32'); + await page.locator('#apply_to_shipping').selectOption('1'); + await page.locator('#free_shipping').selectOption('1'); + await page.getByPlaceholder('Buy X Quantity').click(); + await page.getByPlaceholder('Buy X Quantity').fill('023'); + await page.getByText('End Of Other Rules').click(); + await page.getByPlaceholder('To', { exact: true }).click(); + await page.getByLabel('December 5,').nth(1).click(); + await page.getByPlaceholder('From').click(); + await page.getByLabel('December 1,').first().click(); + await page.locator('.px-4 > div:nth-child(4)').click(); + await page.locator('.relative > label').click(); + await page.locator('#customer_group__3').nth(1).click(); + await page.getByLabel('Wholesale').click(); + await page.locator('.mb-2\\.5 > .mb-4').first().click(); + await page.locator('#channel__1').nth(1).click(); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('21'); + await page.getByRole('button', { name: 'Save Cart Rule' }).click(); + + await expect(page.getByText('Cart rule updated successfully')).toBeVisible(); +}); + +test('Delete Cart Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Cart Rules' }).click(); + await page.locator('div').filter({ hasText: /^1jksdhwsdewiyduew2024-12-01 12:00:002024-12-05 12:00:00Active21$/ }).locator('span').nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Cart Rule Deleted Successfully')).toBeVisible(); +}); + +test('Create Catalog Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Create Catalog Rule' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('test'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sduy hsdgyu'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[0\\]\\[attribute\\]"]').selectOption('product|price'); + await page.locator('select[name="conditions\\[0\\]\\[operator\\]"]').selectOption('>='); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').click(); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').fill('7625342673'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[1\\]\\[attribute\\]"]').selectOption('product|special_price_to'); + await page.locator('select[name="conditions\\[1\\]\\[operator\\]"]').selectOption('>='); + await page.locator('input[name="conditions\\[1\\]\\[value\\]"]').click(); + await page.getByLabel('December 17,').nth(2).click(); + await page.locator('input[name="conditions\\[1\\]\\[value\\]"]').fill('2024-12-17'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[2\\]\\[attribute\\]"]').selectOption('product|category_ids'); + await page.locator('select[name="conditions\\[2\\]\\[operator\\]"]').selectOption('!{}'); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Root' }).locator('span').click();await page.locator('#discount_amount').click(); + await page.locator('#discount_amount').fill('64'); + await page.locator('#end_other_rules').selectOption('1'); + await page.getByPlaceholder('From').click(); + await page.getByLabel('December 9,').first().click(); + await page.getByPlaceholder('From').fill('2024-12-09'); + await page.getByPlaceholder('To').click(); + await page.getByPlaceholder('To').fill('2024-12-25'); + await page.locator('.relative > label').click(); + await page.locator('#customer_group__3').nth(1).click(); + await page.locator('#customer_group__2').nth(1).click(); + await page.locator('#customer_group__1').nth(1).click(); + await page.locator('#channel__1').nth(1).click(); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('Demo_wqdqedqw'); + await page.getByRole('button', { name: 'Save Catalog Rule' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Edit Catalog Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.locator('div').filter({ hasText: /^1User2024-12-092024-12-25Active0$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('test'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sduy hsdgyu'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[0\\]\\[attribute\\]"]').selectOption('product|price'); + await page.locator('select[name="conditions\\[0\\]\\[operator\\]"]').selectOption('>='); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').click(); + await page.locator('input[name="conditions\\[0\\]\\[value\\]"]').fill('7625342673'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[1\\]\\[attribute\\]"]').selectOption('product|special_price_to'); + await page.locator('select[name="conditions\\[1\\]\\[operator\\]"]').selectOption('>='); + await page.locator('input[name="conditions\\[1\\]\\[value\\]"]').click(); + await page.getByLabel('December 17,').nth(2).click(); + await page.locator('input[name="conditions\\[1\\]\\[value\\]"]').fill('2024-12-17'); + await page.getByText('Add Condition').click(); + await page.locator('[id="conditions\\[2\\]\\[attribute\\]"]').selectOption('product|category_ids'); + await page.locator('select[name="conditions\\[2\\]\\[operator\\]"]').selectOption('!{}'); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Men' }).locator('span').click(); + await page.locator('label').filter({ hasText: 'Root' }).locator('span').click();await page.locator('#discount_amount').click(); + await page.locator('#discount_amount').fill('64'); + await page.locator('#end_other_rules').selectOption('1'); + await page.getByPlaceholder('From').click(); + await page.getByLabel('December 9,').first().click(); + await page.getByPlaceholder('From').fill('2024-12-09'); + await page.getByPlaceholder('To').click(); + await page.getByPlaceholder('To').fill('2024-12-25'); + await page.locator('.relative > label').click(); + await page.locator('#customer_group__3').nth(1).click(); + await page.locator('#customer_group__2').nth(1).click(); + await page.locator('#customer_group__1').nth(1).click(); + await page.locator('#channel__1').nth(1).click(); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('Demo_wqdqedqw'); + await page.getByRole('button', { name: 'Save Catalog Rule' }).click(); + + await expect(page.getByText('Catalog rule deleted successfully')).toBeVisible(); +}); + +test('Delete Catalog Rule', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.locator('div').filter({ hasText: /^1User2024-12-092024-12-25Active0$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Catalog rule updated successfully')).toBeVisible(); +}); diff --git a/tests/admin/marketing/search-seo.spec.ts b/tests/admin/marketing/search-seo.spec.ts new file mode 100644 index 00000000000..f01ddaee3f8 --- /dev/null +++ b/tests/admin/marketing/search-seo.spec.ts @@ -0,0 +1,287 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create URL Rewrite', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByText('Create URL Rewrite').click(); + await page.locator('select[name="entity_type"]').selectOption('product'); + await page.getByPlaceholder('Request Path').click(); + await page.getByPlaceholder('Request Path').fill(`${config.baseUrl}/admin/marketing/search-seo/url-rewrites`); + await page.getByPlaceholder('Target Path').click(); + await page.getByPlaceholder('Target Path').fill(`${config.baseUrl}/admin/marketing/search-seo/url-rewrites`); + await page.locator('select[name="redirect_type"]').selectOption('302'); + await page.locator('select[name="locale"]').selectOption('tr'); + await page.getByRole('button', { name: 'Save URL Rewrite' }).click(); + + await expect(page.getByText('URL Rewrite created successfully')).toBeVisible(); +}); + +test('Edit URL Rewrite', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.locator('.row > .flex > a').first().click(); + await page.locator('select[name="entity_type"]').selectOption('product'); + await page.getByPlaceholder('Request Path').click(); + await page.getByPlaceholder('Request Path').fill(`${config.baseUrl}/admin/marketing/search-seo/url-rewrites`); + await page.getByPlaceholder('Target Path').click(); + await page.getByPlaceholder('Target Path').fill(`${config.baseUrl}/admin/marketing/search-seo/url-rewrites`); + await page.locator('select[name="redirect_type"]').selectOption('302'); + await page.locator('select[name="locale"]').selectOption('tr'); + await page.getByRole('button', { name: 'Save URL Rewrite' }).click(); + + + await expect(page.getByText('URL Rewrite updated successfully')).toBeVisible(); +}); + +test('Delete URL Rewrite', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.locator('.row > .flex > a:nth-child(2)').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('URL Rewrite deleted successfully')).toBeVisible(); +}); + +test('Mass Delete URL Rewrite', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('URL Rewrite deleted successfully')).toBeVisible(); +}); + +test('Create Search Term', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Terms' }).click(); + await page.getByText('Create Search Term').click(); + await page.getByPlaceholder('Search Query').click(); + await page.getByPlaceholder('Search Query').fill('Demo_asdwed'); + await page.getByPlaceholder('Redirect Url').click(); + await page.getByPlaceholder('Redirect Url').fill(`${config.baseUrl}/admin/marketing/search-seo/search-terms`); + await page.locator('select[name="channel_id"]').selectOption('1'); + await page.locator('select[name="locale"]').selectOption('it'); + await page.getByRole('button', { name: 'Save Search Term' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Edit Search Term', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Terms' }).click(); + await page.locator('.row > .flex > a').first().click(); + await page.getByPlaceholder('Search Query').click(); + await page.getByPlaceholder('Search Query').fill('Demo_asdwed'); + await page.getByPlaceholder('Redirect Url').click(); + await page.getByPlaceholder('Redirect Url').fill(`${config.baseUrl}/admin/marketing/search-seo/search-terms`); + await page.locator('select[name="channel_id"]').selectOption('1'); + await page.locator('select[name="locale"]').selectOption('it'); + await page.getByRole('button', { name: 'Save Search Term' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Delete Search Term', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Terms' }).click(); + await page.locator('.row > .flex > a:nth-child(2)').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Mass Delete Search Term', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Terms' }).click(); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Create Search Synonym', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Synonyms' }).click(); + await page.getByText('Create Search Synonym').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_kahsyg'); + await page.getByPlaceholder('Terms').click(); + await page.getByPlaceholder('Terms').fill('Demo_sdjfghhfdw'); + await page.getByRole('button', { name: 'Save Search Synonym' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Edit Search Synonym', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Synonyms' }).click(); + await page.locator('div').filter({ hasText: /^1kahsygsdjfghhfdw$/ }).locator('a').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_kahsyg'); + await page.getByPlaceholder('Terms').click(); + await page.getByPlaceholder('Terms').fill('Demo_sdjfghhfdw'); + await page.getByRole('button', { name: 'Save Search Synonym' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Delete Search Synonym', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Synonyms' }).click(); + await page.locator('div').filter({ hasText: /^1kahsygsdjfghhfdw$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Mass Delete Search Synonym', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Search Synonyms' }).click(); + await page.locator('.icon-uncheckbox').first().click(); + await page.getByRole('button', { name: 'Select Action ' }).click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Create Sitemap', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Sitemaps' }).click(); + await page.getByText('Create Sitemap').click(); + await page.getByPlaceholder('File Name').click(); + await page.getByPlaceholder('File Name').fill('abc.xml'); + await page.getByPlaceholder('Path').click(); + await page.getByPlaceholder('Path').fill('/public/'); + await page.getByRole('button', { name: 'Save Sitemap' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Edit Sitemap', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Sitemaps' }).click(); + await page.locator('div').filter({ hasText: /^1abc\.xml\/public\/http:\/\/192\.168\.15\.121\/test\/bagisto\/public\/storage\/public\/abc\.xml$/ }).locator('a').nth(1).click(); + await page.getByPlaceholder('File Name').click(); + await page.getByPlaceholder('File Name').fill('abc.xml'); + await page.getByPlaceholder('Path').click(); + await page.getByPlaceholder('Path').fill('/public/'); + await page.getByRole('button', { name: 'Save Sitemap' }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); + +test('Delete Sitemap', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Marketing' }).click(); + await page.getByRole('link', { name: 'Search & SEO' }).click(); + await page.getByRole('link', { name: 'Sitemaps' }).click(); + await page.locator('div').filter({ hasText: /^1abc\.xml\/public\/http:\/\/192\.168\.15\.121\/test\/bagisto\/public\/storage\/public\/abc\.xml$/ }).locator('a').nth(2).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Catalog rule created successfully')).toBeVisible(); +}); diff --git a/tests/admin/sales.spec.ts b/tests/admin/sales.spec.ts new file mode 100644 index 00000000000..c774a3ae815 --- /dev/null +++ b/tests/admin/sales.spec.ts @@ -0,0 +1,226 @@ +import { test, expect, config } from '../utils/setup'; + +test('Create Orders', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.getByRole('button', { name: 'Create Order' }).click(); + await page.getByPlaceholder('Search by email or name').click(); + await page.getByPlaceholder('Search by email or name').fill('Demo_Webkul'); + await page.getByPlaceholder('Search by email or name').press('Enter'); + await page.getByPlaceholder('Search by email or name').press('Enter'); + await page.getByRole('button', { name: 'Create Customer' }).click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_User'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_test'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('Demo_rte21@gmail.com'); + await page.getByPlaceholder('Contact Number').click(); + await page.getByPlaceholder('Contact Number').fill('09812878623'); + await page.getByPlaceholder('Date of Birth').click(); + await page.getByLabel('December 6,').click(); + await page.getByPlaceholder('Date of Birth').fill('2024-12-06'); + await page.locator('#gender').selectOption('Female'); + await page.locator('#customerGroup').selectOption('3'); + await page.getByRole('button', { name: 'Save customer' }).click(); + await page.getByRole('button', { name: 'Add Product' }).click(); + await page.getByPlaceholder('Search by name').click(); + await page.getByPlaceholder('Search by name').fill('arct'); + await page.locator('input:nth-child(3)').first().click(); + await page.locator('input:nth-child(3)').first().fill('13'); + await page.locator('form > .grid > .cursor-pointer').first().click(); + await page.getByText('+').click(); + await page.getByText('-', { exact: true }).click(); + await page.getByText('Add Address').click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('Demo_webkul'); + await page.getByPlaceholder('Vat ID').click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_User_test'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo_test'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('Demo_wey@dg.sdd'); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('Demo_hsdguywe'); + await page.locator('select[name="billing\\.country"]').selectOption('BS'); + await page.locator('select[name="billing\\.country"]').selectOption('WF'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_dwedwd'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_dewdw'); + await page.getByPlaceholder('Zip/Postcode').click(); + await page.getByPlaceholder('Zip/Postcode').fill('2312'); + await page.getByPlaceholder('Telephone').click(); + await page.getByPlaceholder('Telephone').fill('98765432'); + await page.getByPlaceholder('Telephone').press('Enter'); + await page.getByRole('button', { name: 'Save' }).click(); + await page.getByText('Use same address for shipping?').click(); + await page.locator('#address-step-container div').filter({ hasText: 'Shipping Address Add Address' }).nth(2).click(); + await page.getByText('Add Address').click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('Demo_sdsad'); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo_adasdasa'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').dblclick(); + await page.getByPlaceholder('Last Name').fill('Demo_adsdasda'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('Demo_dasd@dwew.fgh'); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('Demo_qwerwe'); + await page.locator('select[name="shipping\\.country"]').selectOption('AC'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_wewqe'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_qweqw3e1'); + await page.getByPlaceholder('Zip/Postcode').click(); + await page.getByPlaceholder('Zip/Postcode').fill('23123'); + await page.getByPlaceholder('Telephone').click(); + await page.getByPlaceholder('Telephone').fill('21111111143'); + await page.getByRole('button', { name: 'Save' }).click(); + await page.getByRole('button', { name: 'Proceed' }).click(); + await page.locator('div').filter({ hasText: /^Free Shipping$/ }).getByRole('paragraph').click(); + await page.getByRole('button', { name: 'Place Order' }).click(); + + await expect(page.getByText('Order created successfully')).toBeVisible(); +}); + +test('Comment on Order', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('.row > div:nth-child(4) > a').first().click(); + await page.getByPlaceholder('Write your comment').click(); + await page.getByPlaceholder('Write your comment').fill('Demo_asdasd sdcsda'); + await page.getByRole('button', { name: '' }).click(); + await page.getByLabel('Submit Comment').click(); + + await expect(page.getByText('Comment added successfully.')).toBeVisible(); +}); + +test('Cancel Order', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('.row > div:nth-child(4) > a').first().click(); + await page.locator('.icon-cancel').click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Order cancelled successfully')).toBeVisible(); +}); + +test('Reorder', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('.row > div:nth-child(4) > a').first().click(); + await page.getByRole('link', { name: ' Reorder' }).click(); + + await expect(page.getByText('Cart Items')).toBeVisible(); +}); + +test('Create Invoice', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('div:nth-child(7) > div:nth-child(4) > a').click(); + await page.getByText('Invoice', { exact: true }).click(); + await page.locator('#can_create_transaction').nth(1).click(); + await page.getByRole('button', { name: 'Create Invoice' }).click(); + + await expect(page.getByText('Invoice created successfully')).toBeVisible(); +}); + +test('Create Shipment', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('div:nth-child(7) > div:nth-child(4) > a').click(); + await page.getByText('Ship', { exact: true }).click(); + await page.getByPlaceholder('Tracking Number').click(); + await page.getByPlaceholder('Tracking Number').fill('23'); + await page.getByPlaceholder('Carrier Name').click(); + await page.getByPlaceholder('Carrier Name').fill('Demo_dsfsdf'); + await page.locator('[id="shipment\\[source\\]"]').selectOption('1'); + await page.getByRole('button', { name: 'Create Shipment' }).click(); + + await expect(page.getByText('Shipment created successfully')).toBeVisible(); +}); + +test('Create Refund', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.locator('div:nth-child(7) > div:nth-child(4) > a').click(); + await page.locator('.icon-cancel').click(); + await page.getByRole('button', { name: 'Refund' }).click(); + + await expect(page.getByText('Refund created successfully')).toBeVisible(); +}); + +test('Mail Invoice', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.getByRole('link', { name: 'Invoices' }).click(); + await page.waitForSelector('span.icon-view:visible'); + await page.locator('span.icon-view:visible')[0].click(); + await page.getByRole('button', { name: ' Send Duplicate Invoice' }).click(); + await page.locator('#email').click(); + await page.locator('#email').fill('testUser@gmail.com'); + await page.getByRole('button', { name: 'Send', exact: true }).click(); + + await expect(page.getByText('Invoice sent successfully')).toBeVisible(); +}); + +test('Print Invoice', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Sales' }).click(); + await page.getByRole('link', { name: 'Invoices' }).click(); + await page.waitForSelector('span.icon-view:visible'); + await page.locator('span.icon-view:visible')[0].click(); + const downloadPromise = page.waitForEvent('download'); + await page.getByRole('link', { name: ' Print' }).click(); + const download = await downloadPromise; + + await expect(download); +}); diff --git a/tests/admin/settings/channels.spec.ts b/tests/admin/settings/channels.spec.ts new file mode 100644 index 00000000000..bc7ea4b83d0 --- /dev/null +++ b/tests/admin/settings/channels.spec.ts @@ -0,0 +1,126 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Channel', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Channels' }).click(); + await page.getByRole('link', { name: 'Create Channel' }).click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('sdsdfwe'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_dfsfwe'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_dfsfwe wewe'); + await page.getByPlaceholder('Description', { exact: true }).click(); + await page.getByPlaceholder('Description', { exact: true }).fill('Demo_sdfwe ewrwew'); + await page.locator('#inventory_sources_1').nth(1).click(); + await page.locator('#root_category_id').selectOption('1'); + await page.getByPlaceholder('https://www.example.com (Don\'').click(); + await page.getByPlaceholder('https://www.example.com (Don\'').fill('Demo_dfsdeew'); + await page.getByPlaceholder('Meta title').click(); + await page.getByPlaceholder('Meta title').fill('Demo_werewrwe'); + await page.getByPlaceholder('Meta keywords').click(); + await page.getByPlaceholder('Meta keywords').fill('Demo_sdfser'); + await page.getByPlaceholder('Meta description').click(); + await page.getByPlaceholder('Meta description').fill('Demo_dsfwerwewe'); + await page.getByPlaceholder('Message').click(); + await page.getByPlaceholder('Message').fill('Demo_werwewe'); + await page.getByPlaceholder('Allowed IPs').click(); + await page.getByPlaceholder('Allowed IPs').fill('Demo_rwe'); + await page.locator('.relative > label').click(); + await page.locator('#currencies_64').nth(1).click(); + await page.locator('#currencies_62').nth(1).click(); + await page.getByLabel('CFA Franc BEAC').click(); + await page.locator('#base_currency_id').selectOption('18'); + await page.locator('label').filter({ hasText: 'Russian Ruble' }).click(); + await page.getByText('Locales Arabic Bengali').click(); + await page.locator('label').filter({ hasText: 'Sinhala' }).click(); + await page.getByText('Turkish').first().click(); + await page.locator('#default_locale_id').selectOption('17'); + await page.locator('label').filter({ hasText: 'South African Rand' }).click(); + await page.locator('label').filter({ hasText: 'Zambian Kwacha' }).click(); + await page.locator('label').filter({ hasText: 'CFA Franc BEAC' }).click(); + await page.locator('label').filter({ hasText: 'Fijian Dollar' }).click(); + await page.locator('#inventory_sources_1').nth(1).click(); + await page.getByText('Ukrainian').first().click(); + await page.getByLabel('Ukrainian', { exact: true }).click(); + await page.getByText('Turkish').first().click(); + await page.getByRole('button', { name: 'Save Channel' }).click(); + + await expect(page.getByText('Channel created successfully.')).toBeVisible(); +}); + +test('Edit Channel', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Channels' }).click(); + await page.locator('div').filter({ hasText: /^2sdsdfwedfsfwe wewedfsdeew$/ }).locator('span').first().click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('sdsdfwe'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_dfsfwe'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_dfsfwe wewe'); + await page.getByPlaceholder('Description', { exact: true }).click(); + await page.getByPlaceholder('Description', { exact: true }).fill('Demo_sdfwe ewrwew'); + await page.locator('#inventory_sources_1').nth(1).click(); + await page.locator('#root_category_id').selectOption('1'); + await page.getByPlaceholder('https://www.example.com (Don\'').click(); + await page.getByPlaceholder('https://www.example.com (Don\'').fill('Demo_dfsdeew'); + await page.getByPlaceholder('Meta title').click(); + await page.getByPlaceholder('Meta title').fill('Demo_werewrwe'); + await page.getByPlaceholder('Meta keywords').click(); + await page.getByPlaceholder('Meta keywords').fill('Demo_sdfser'); + await page.getByPlaceholder('Meta description').click(); + await page.getByPlaceholder('Meta description').fill('Demo_dsfwerwewe'); + await page.getByPlaceholder('Message').click(); + await page.getByPlaceholder('Message').fill('Demo_werwewe'); + await page.getByPlaceholder('Allowed IPs').click(); + await page.getByPlaceholder('Allowed IPs').fill('Demo_rwe'); + await page.locator('.relative > label').click(); + await page.locator('#currencies_64').nth(1).click(); + await page.locator('#currencies_62').nth(1).click(); + await page.getByLabel('CFA Franc BEAC').click(); + await page.locator('#base_currency_id').selectOption('18'); + await page.locator('label').filter({ hasText: 'Russian Ruble' }).click(); + await page.getByText('Locales Arabic Bengali').click(); + await page.locator('label').filter({ hasText: 'Sinhala' }).click(); + await page.getByText('Turkish').first().click(); + await page.locator('#default_locale_id').selectOption('17'); + await page.locator('label').filter({ hasText: 'South African Rand' }).click(); + await page.locator('label').filter({ hasText: 'Zambian Kwacha' }).click(); + await page.locator('label').filter({ hasText: 'CFA Franc BEAC' }).click(); + await page.locator('label').filter({ hasText: 'Fijian Dollar' }).click(); + await page.locator('#inventory_sources_1').nth(1).click(); + await page.getByText('Ukrainian').first().click(); + await page.getByLabel('Ukrainian', { exact: true }).click(); + await page.getByText('Turkish').first().click(); + await page.getByRole('button', { name: 'Save Channel' }).click(); + + await expect(page.getByText('Update Channel Successfully')).toBeVisible(); +}); + +test('Delete Channel', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Channels' }).click(); + await page.locator('div').filter({ hasText: /^2sdsdfwedfsfwe wewedfsdeew$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Channel deleted successfully.')).toBeVisible(); +}); diff --git a/tests/admin/settings/currencies.spec.ts b/tests/admin/settings/currencies.spec.ts new file mode 100644 index 00000000000..63b2cc85fc0 --- /dev/null +++ b/tests/admin/settings/currencies.spec.ts @@ -0,0 +1,69 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Currency', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Currencies' }).click(); + await page.getByRole('button', { name: 'Create Currency' }).click(); + await page.locator('form').filter({ hasText: 'Create New Currency Code Name' }).locator('span').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('sassss'); + await page.getByPlaceholder('Symbol').click(); + await page.getByPlaceholder('Symbol').fill('#'); + await page.getByPlaceholder('Decimal', { exact: true }).click(); + await page.getByPlaceholder('Decimal', { exact: true }).fill('123.34'); + await page.getByPlaceholder('Group Separator').click(); + await page.getByPlaceholder('Group Separator').fill('Demo_ert'); + await page.getByPlaceholder('Decimal Separator').click(); + await page.getByPlaceholder('Decimal Separator').fill('Demo_erter'); + await page.locator('select[name="currency_position"]').selectOption('left_with_space'); + await page.getByRole('button', { name: 'Save Currency' }).click(); + + await expect(page.getByText('Currency created successfully.')).toBeVisible(); +}); + +test('Edit Currency', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Currencies' }).click(); + await page.locator('div').filter({ hasText: /^66sassssASS$/ }).locator('a').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_sassss'); + await page.getByPlaceholder('Symbol').click(); + await page.getByPlaceholder('Symbol').fill('#'); + await page.getByPlaceholder('Decimal', { exact: true }).click(); + await page.getByPlaceholder('Decimal', { exact: true }).fill('123.34'); + await page.getByPlaceholder('Group Separator').click(); + await page.getByPlaceholder('Group Separator').fill('Demo_ert'); + await page.getByPlaceholder('Decimal Separator').click(); + await page.getByPlaceholder('Decimal Separator').fill('Demo_erter'); + await page.locator('select[name="currency_position"]').selectOption('left_with_space'); + await page.getByRole('button', { name: 'Save Currency' }).click(); + + await expect(page.getByText('Currency updated successfully.')).toBeVisible(); +}); + +test('Delete Currency', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Currencies' }).click(); + await page.locator('div').filter({ hasText: /^66sassssASS$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Currency deleted successfully.')).toBeVisible(); +}); diff --git a/tests/admin/settings/exchange-rates.spec.ts b/tests/admin/settings/exchange-rates.spec.ts new file mode 100644 index 00000000000..88bde2f9574 --- /dev/null +++ b/tests/admin/settings/exchange-rates.spec.ts @@ -0,0 +1,54 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Exchange Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Exchange Rates' }).click(); + await page.getByRole('button', { name: 'Create Exchange Rate' }).click(); + await page.getByText('Source Currency Target').click(); + await page.locator('select[name="target_currency"]').selectOption('8'); + await page.getByPlaceholder('Rate').click(); + await page.getByPlaceholder('Rate').fill('2323'); + await page.getByRole('button', { name: 'Save Exchange Rate' }).click(); + + await expect(page.getByText('Exchange Rate Created Successfully')).toBeVisible(); +}); + +test('Edit Exchange Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Exchange Rates' }).click(); + await page.locator('div').filter({ hasText: /^1Canadian Dollar2323\.000000000000$/ }).locator('a').first().click(); + await page.getByText('Source Currency Target').click(); + await page.locator('select[name="target_currency"]').selectOption('8'); + await page.getByPlaceholder('Rate').click(); + await page.getByPlaceholder('Rate').fill('2323'); + await page.getByRole('button', { name: 'Save Exchange Rate' }).click(); + + await expect(page.getByText('Exchange Rate Updated Successfully')).toBeVisible(); +}); + +test('Delete Exchange Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Exchange Rates' }).click(); + await page.locator('div').filter({ hasText: /^1Canadian Dollar2323\.000000000000$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Exchange Rate Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/settings/inventory-sources.spec.ts b/tests/admin/settings/inventory-sources.spec.ts new file mode 100644 index 00000000000..38540c2bae8 --- /dev/null +++ b/tests/admin/settings/inventory-sources.spec.ts @@ -0,0 +1,110 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Inventory Sources', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Inventory Sources' }).click(); + await page.getByRole('link', { name: 'Create Inventory Source' }).click(); + await page.getByPlaceholder('Code', { exact: true }).click(); + await page.getByPlaceholder('Code', { exact: true }).fill('sdsdsds'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_sdf'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_sdfsdfsdfwe'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_fwewefsdd'); + await page.locator('#contact_name').click(); + await page.locator('#contact_name').fill('Demo_sdfserw'); + await page.getByPlaceholder('Email').click(); + await page.getByPlaceholder('Email').fill('Demo_sfdfweer@sf.fgd'); + await page.getByPlaceholder('Contact Number').click(); + await page.getByPlaceholder('Contact Number').fill('9876543323'); + await page.getByPlaceholder('Fax').click(); + await page.getByPlaceholder('Fax').fill('3235746'); + await page.locator('#country').selectOption('AZ'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_tyutyu'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_yturtyu'); + await page.getByPlaceholder('Street').click(); + await page.getByPlaceholder('Street').fill('Demo_5t6y456'); + await page.getByPlaceholder('Postcode').click(); + await page.getByPlaceholder('Postcode').fill('4565677'); + await page.locator('.relative > label').click(); + await page.getByPlaceholder('Latitude').click(); + await page.getByPlaceholder('Latitude').fill('45'); + await page.getByPlaceholder('Longitude').click(); + await page.getByPlaceholder('Longitude').fill('54'); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('45'); + await page.getByRole('button', { name: 'Save Inventory Sources' }).click(); + + await expect(page.getByText('Inventory Source Created Successfully')).toBeVisible(); +}); + +test('Edit Inventory Sources', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Inventory Sources' }).click(); + await page.locator('div').filter({ hasText: /^2sdsdsdsdsdfsdfsdfwe45Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Code', { exact: true }).click(); + await page.getByPlaceholder('Code', { exact: true }).fill('sdsdsds'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_sdf'); + await page.locator('#name').click(); + await page.locator('#name').fill('Demo_sdfsdfsdfwe'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_fwewefsdd'); + await page.locator('#contact_name').click(); + await page.locator('#contact_name').fill('Demo_sdfserw'); + await page.getByPlaceholder('Email').click(); + await page.getByPlaceholder('Email').fill('Demo_sfdfweer@sf.fgd'); + await page.getByPlaceholder('Contact Number').click(); + await page.getByPlaceholder('Contact Number').fill('9876543323'); + await page.getByPlaceholder('Fax').click(); + await page.getByPlaceholder('Fax').fill('3235746'); + await page.locator('#country').selectOption('AZ'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_tyutyu'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo_yturtyu'); + await page.getByPlaceholder('Street').click(); + await page.getByPlaceholder('Street').fill('Demo_5t6y456'); + await page.getByPlaceholder('Postcode').click(); + await page.getByPlaceholder('Postcode').fill('4565677'); + await page.locator('.relative > label').click(); + await page.getByPlaceholder('Latitude').click(); + await page.getByPlaceholder('Latitude').fill('45'); + await page.getByPlaceholder('Longitude').click(); + await page.getByPlaceholder('Longitude').fill('54'); + await page.getByPlaceholder('Priority').click(); + await page.getByPlaceholder('Priority').fill('45'); + await page.getByRole('button', { name: 'Save Inventory Sources' }).click(); + + await expect(page.getByText('Inventory Sources Updated Successfully')).toBeVisible(); +}); + +test('Delete Inventory Sources', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Inventory Sources' }).click(); + await page.locator('div').filter({ hasText: /^2sdsdsdsdsdfsdfsdfwe45Active$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Inventory Sources Deleted Successfully')).toBeVisible(); +}); diff --git a/tests/admin/settings/locales.spec.ts b/tests/admin/settings/locales.spec.ts new file mode 100644 index 00000000000..cbb703710f6 --- /dev/null +++ b/tests/admin/settings/locales.spec.ts @@ -0,0 +1,53 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Locale', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('button', { name: 'Create Locale' }).click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('we'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_web'); + await page.locator('#direction').selectOption('rtl'); + await page.getByRole('button', { name: 'Save Locale' }).click(); + + await expect(page.getByText('Locale created successfully.')).toBeVisible(); +}); + +test('Edit Locale', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.locator('div').filter({ hasText: /^20wewebRTL$/ }).locator('a').first().click(); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('we'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_web'); + await page.locator('#direction').selectOption('rtl'); + await page.getByRole('button', { name: 'Save Locale' }).click(); + + await expect(page.getByText('Locale updated successfully.')).toBeVisible(); +}); + +test('Delete Locale', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.locator('div').filter({ hasText: /^20wewebRTL$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Locale deleted successfully.')).toBeVisible(); +}); diff --git a/tests/admin/settings/roles.spec.ts b/tests/admin/settings/roles.spec.ts new file mode 100644 index 00000000000..d1d79512afa --- /dev/null +++ b/tests/admin/settings/roles.spec.ts @@ -0,0 +1,88 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Role', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Roles' }).click(); + await page.getByRole('link', { name: 'Create Role' }).click(); + await page.locator('label').filter({ hasText: 'Dashboard' }).locator('span').click(); + await page.locator('div').filter({ hasText: /^OrdersCreateViewCancel$/ }).locator('span').nth(1).click(); + await page.locator('label').filter({ hasText: 'Cancel' }).locator('span').click(); + await page.locator('div').filter({ hasText: /^InvoicesViewCreate$/ }).locator('label').nth(2).click(); + await page.locator('label').filter({ hasText: /^View$/ }).nth(2).click(); + await page.locator('div').filter({ hasText: /^CategoriesCreateEditDelete$/ }).locator('span').nth(1).click(); + await page.locator('div').filter({ hasText: /^AddressesCreateEditDelete$/ }).locator('span').nth(2).click(); + await page.locator('div').filter({ hasText: /^Catalog RulesCreateEditDelete$/ }).locator('span').nth(1).click(); + await page.locator('div').filter({ hasText: /^Cart RulesCreateCopyEditDelete$/ }).locator('span').nth(3).click(); + await page.locator('div').filter({ hasText: /^URL RewritesCreateEditDelete$/ }).locator('span').nth(2).click(); + await page.locator('.v-tree-item-wrapper > div:nth-child(7) > div:nth-child(6) > .group > div').click(); + await page.locator('div').filter({ hasText: /^Inventory SourcesCreateEditDelete$/ }).locator('label').nth(2).click(); + await page.locator('div').filter({ hasText: /^ThemesCreateEditDelete$/ }).locator('label').nth(3).click(); + await page.locator('div').filter({ hasText: /^Tax CategoriesCreateEditDelete$/ }).locator('label').nth(3).click(); + await page.locator('div').filter({ hasText: /^ImportsCreateEditDeleteImport$/ }).locator('label').nth(3).click(); + await page.locator('label').filter({ hasText: 'Dashboard' }).locator('div').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('test'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sdfsdfsdsd dsf'); + await page.getByRole('button', { name: 'Save Role' }).click(); + + await expect(page.getByText('Roles Created Successfully')).toBeVisible(); +}); + +test('Edit Role', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Roles' }).click(); + await page.getByRole('link', { name: 'Create Role' }).click(); + await page.locator('div').filter({ hasText: /^2Usercustom$/ }).locator('span').first().click(); + await page.locator('label').filter({ hasText: 'Dashboard' }).locator('span').click(); + await page.locator('div').filter({ hasText: /^OrdersCreateViewCancel$/ }).locator('span').nth(1).click(); + await page.locator('label').filter({ hasText: 'Cancel' }).locator('span').click(); + await page.locator('div').filter({ hasText: /^InvoicesViewCreate$/ }).locator('label').nth(2).click(); + await page.locator('label').filter({ hasText: /^View$/ }).nth(2).click(); + await page.locator('div').filter({ hasText: /^CategoriesCreateEditDelete$/ }).locator('span').nth(1).click(); + await page.locator('div').filter({ hasText: /^AddressesCreateEditDelete$/ }).locator('span').nth(2).click(); + await page.locator('div').filter({ hasText: /^Catalog RulesCreateEditDelete$/ }).locator('span').nth(1).click(); + await page.locator('div').filter({ hasText: /^Cart RulesCreateCopyEditDelete$/ }).locator('span').nth(3).click(); + await page.locator('div').filter({ hasText: /^URL RewritesCreateEditDelete$/ }).locator('span').nth(2).click(); + await page.locator('.v-tree-item-wrapper > div:nth-child(7) > div:nth-child(6) > .group > div').click(); + await page.locator('div').filter({ hasText: /^Inventory SourcesCreateEditDelete$/ }).locator('label').nth(2).click(); + await page.locator('div').filter({ hasText: /^ThemesCreateEditDelete$/ }).locator('label').nth(3).click(); + await page.locator('div').filter({ hasText: /^Tax CategoriesCreateEditDelete$/ }).locator('label').nth(3).click(); + await page.locator('div').filter({ hasText: /^ImportsCreateEditDeleteImport$/ }).locator('label').nth(3).click(); + await page.locator('label').filter({ hasText: 'Dashboard' }).locator('div').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('test'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sdfsdfsdsd dsf'); + await page.getByRole('button', { name: 'Save Role' }).click(); + + await expect(page.getByText('Roles is updated successfully')).toBeVisible(); +}); + +test('Delete Role', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Roles' }).click(); + await page.getByRole('link', { name: 'Create Role' }).click(); + await page.locator('div').filter({ hasText: /^2Usercustom$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Roles is deleted successfully')).toBeVisible(); +}); diff --git a/tests/admin/settings/taxes.spec.ts b/tests/admin/settings/taxes.spec.ts new file mode 100644 index 00000000000..4ab49b388a0 --- /dev/null +++ b/tests/admin/settings/taxes.spec.ts @@ -0,0 +1,134 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Tax Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.getByRole('link', { name: 'Tax Rates' }).click(); + await page.getByRole('link', { name: 'Create Tax Rate' }).click(); + await page.locator('select[name="country"]').selectOption('AI'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_asdweas'); + await page.getByPlaceholder('Rate').click(); + await page.getByPlaceholder('Rate').fill('32'); + await page.getByPlaceholder('Identifier').click(); + await page.getByPlaceholder('Identifier').fill('Demo_sasd'); + await page.locator('.relative > label').click(); + await page.getByText('Zip From Zip To').click(); + await page.getByPlaceholder('Zip From').click(); + await page.getByPlaceholder('Zip From').fill('234234'); + await page.getByPlaceholder('Zip To').click(); + await page.getByPlaceholder('Zip To').fill('2344234'); + await page.getByRole('button', { name: 'Save Tax Rate' }).click(); + + await expect(page.getByText('Tax rate created successfully.')).toBeVisible(); +}); + +test('Edit Tax Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.getByRole('link', { name: 'Tax Rates' }).click(); + await page.locator('div').filter({ hasText: /^1sasdasdweasAI2342344234423432\.0000$/ }).locator('span').first().click(); + await page.locator('select[name="country"]').selectOption('AI'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo_asdweas'); + await page.getByPlaceholder('Rate').click(); + await page.getByPlaceholder('Rate').fill('32'); + await page.getByPlaceholder('Identifier').click(); + await page.getByPlaceholder('Identifier').fill('Demo_sasd'); + await page.locator('.relative > label').click(); + await page.getByText('Zip From Zip To').click(); + await page.getByPlaceholder('Zip From').click(); + await page.getByPlaceholder('Zip From').fill('234234'); + await page.getByPlaceholder('Zip To').click(); + await page.getByPlaceholder('Zip To').fill('2344234'); + await page.getByRole('button', { name: 'Save Tax Rate' }).click(); + + await expect(page.getByText('Tax Rate Update Successfully')).toBeVisible(); +}); + +test('Delete Tax Rate', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.getByRole('link', { name: 'Tax Rates' }).click(); + await page.locator('div').filter({ hasText: /^1sasdasdweasAI2342344234423432\.0000$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Tax rate deleted successfully')).toBeVisible(); +}); + +test('Create Tax Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.getByRole('button', { name: 'Create Tax Category' }).click(); + await page.getByRole('listbox').selectOption('2'); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('Demo_23w'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_kayuwe'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sdfhg hsgd'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + + await expect(page.getByText('New Tax Category Created.')).toBeVisible(); +}); + +test('Edit Tax Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.locator('div').filter({ hasText: /^1kayuwe23w$/ }).locator('a').first().click(); + await page.getByRole('listbox').selectOption('2'); + await page.getByPlaceholder('Code').click(); + await page.getByPlaceholder('Code').fill('Demo_23w'); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_kayuwe'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sdfhg hsgd'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + + await expect(page.getByText('Tax Category Successfully Updated.')).toBeVisible(); +}); + +test('Delete Tax Category', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Taxes' }).click(); + await page.locator('div').filter({ hasText: /^1kayuwe23w$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Tax Category Deleted Successfully.')).toBeVisible(); +}); diff --git a/tests/admin/settings/themes.spec.ts b/tests/admin/settings/themes.spec.ts new file mode 100644 index 00000000000..e73487e5824 --- /dev/null +++ b/tests/admin/settings/themes.spec.ts @@ -0,0 +1,409 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Product Carousel Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('User _test'); + await page.getByPlaceholder('Name').press('CapsLock'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('2'); + await page.locator('select[name="type"]').selectOption('product_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_Product'); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[sort\\]"]').selectOption('name-desc'); + await page.locator('.box-shadow').first().click(); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[limit\\]"]').selectOption('12'); + await page.getByText('Add Filter').click(); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('select[name="key"]').selectOption('color'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Filter').click(); + await page.locator('select[name="key"]').selectOption('featured'); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Create Category Carousel Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_HJGy'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('32'); + await page.locator('select[name="type"]').selectOption('category_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[sort\\]"]').selectOption('desc'); + await page.getByPlaceholder('Limit').click(); + await page.getByPlaceholder('Limit').fill('32'); + await page.getByText('Add Filter').first().click(); + await page.locator('select[name="key"]').selectOption('name'); + await page.getByPlaceholder('Value').click(); + await page.getByPlaceholder('Value').fill('Demo_32e2eq'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Filter').click(); + await page.locator('select[name="key"]').selectOption('status'); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Create Static Content Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_asd asd'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('767'); + await page.locator('select[name="type"]').selectOption('static_content'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.locator('.CodeMirror-scroll').click(); + await page.locator('textarea').fill('Demo_sdadwse sdfs'); + await page.getByText('CSS').click(); + await page.locator('.CodeMirror-scroll').click(); + await page.locator('textarea').fill('Demo_sdf sdfdf'); + await page.getByText('Preview').click(); + await page.getByText('Preview').click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Create Image Slider Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_asdasd'); + await page.locator('.box-shadow > div:nth-child(2) > div:nth-child(2)').click(); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('32'); + await page.locator('select[name="type"]').selectOption('image_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Slider').first().click(); + await page.getByPlaceholder('Image Title').click(); + await page.getByPlaceholder('Image Title').fill('Demo_fdgsdf sfds'); + await page.getByPlaceholder('Link').click(); + await page.getByPlaceholder('Link').click(); + await page.getByPlaceholder('Link').fill(`${config.baseUrl}/admin/settings/themes/edit/16`); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Image png, jpeg, jpg').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Create Footer Link Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_hsdguiwe'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('23'); + await page.locator('select[name="type"]').selectOption('footer_links'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Link').click(); + await page.locator('select[name="column"]').selectOption('column_2'); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_asdw'); + await page.getByPlaceholder('URL').click(); + await page.getByPlaceholder('URL').fill(`${config.baseUrl}/admin/settings/themes/edit/16`); + await page.getByPlaceholder('Sort Order').first().click(); + await page.getByPlaceholder('Sort Order').first().fill('23'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.px-4 > div:nth-child(6)').click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Create Services Content Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.getByRole('button', { name: 'Create Theme' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_aSDAS'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('23'); + await page.getByPlaceholder('Sort Order').press('CapsLock'); + await page.locator('select[name="type"]').selectOption('footer_links'); + await page.locator('select[name="type"]').selectOption('services_content'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Services').first().click(); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_asdddddddddas'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sadqweqw'); + await page.getByPlaceholder('Service Icon Class').click(); + await page.getByPlaceholder('Service Icon Class').fill('Demo_dasdqww'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Product Carousel Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^13DefaultDefaultproduct_carouselUser _test2Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('User _test'); + await page.getByPlaceholder('Name').press('CapsLock'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('2'); + await page.locator('select[name="type"]').selectOption('product_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_Product'); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[sort\\]"]').selectOption('name-desc'); + await page.locator('.box-shadow').first().click(); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[limit\\]"]').selectOption('12'); + await page.getByText('Add Filter').click(); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('select[name="key"]').selectOption('color'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Filter').click(); + await page.locator('select[name="key"]').selectOption('featured'); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Category Carousel Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^14DefaultDefaultcategory_carouselHJGy32Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_HJGy'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('32'); + await page.locator('select[name="type"]').selectOption('category_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.locator('select[name="en\\[options\\]\\[filters\\]\\[sort\\]"]').selectOption('desc'); + await page.getByPlaceholder('Limit').click(); + await page.getByPlaceholder('Limit').fill('32'); + await page.getByText('Add Filter').first().click(); + await page.locator('select[name="key"]').selectOption('name'); + await page.getByPlaceholder('Value').click(); + await page.getByPlaceholder('Value').fill('Demo_32e2eq'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Filter').click(); + await page.locator('select[name="key"]').selectOption('status'); + await page.locator('select[name="value"]').selectOption('1'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Static Content Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^15DefaultDefaultstatic_contentasd asd767Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_asd asd'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('767'); + await page.locator('select[name="type"]').selectOption('static_content'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.locator('.CodeMirror-scroll').click(); + await page.locator('textarea').fill('Demo_sdadwse sdfs'); + await page.getByText('CSS').click(); + await page.locator('.CodeMirror-scroll').click(); + await page.locator('textarea').fill('Demo_sdf sdfdf'); + await page.getByText('Preview').click(); + await page.getByText('Preview').click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Image Slider Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^16DefaultDefaultimage_carouselasdasd32Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_asdasd'); + await page.locator('.box-shadow > div:nth-child(2) > div:nth-child(2)').click(); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('32'); + await page.locator('select[name="type"]').selectOption('image_carousel'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Slider').first().click(); + await page.getByPlaceholder('Image Title').click(); + await page.getByPlaceholder('Image Title').fill('Demo_fdgsdf sfds'); + await page.getByPlaceholder('Link').click(); + await page.getByPlaceholder('Link').click(); + await page.getByPlaceholder('Link').fill(`${config.baseUrl}/admin/settings/themes/edit/16`); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.getByText('Add Image png, jpeg, jpg').click(); + // await page.locator('body').setInputFiles('Screenshot from 2024-12-18 11-00-34.png'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Footer Link Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^17DefaultDefaultfooter_linkshsdguiwe23Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_hsdguiwe'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('23'); + await page.locator('select[name="type"]').selectOption('footer_links'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Link').click(); + await page.locator('select[name="column"]').selectOption('column_2'); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_asdw'); + await page.getByPlaceholder('URL').click(); + await page.getByPlaceholder('URL').fill(`${config.baseUrl}/admin/settings/themes/edit/16`); + await page.getByPlaceholder('Sort Order').first().click(); + await page.getByPlaceholder('Sort Order').first().fill('23'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.px-4 > div:nth-child(6)').click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Edit Services Content Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^18DefaultDefaultservices_contentaSDASSA23Active$/ }).locator('span').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('Demo_aSDAS'); + await page.getByPlaceholder('Sort Order').click(); + await page.getByPlaceholder('Sort Order').fill('23'); + await page.getByPlaceholder('Sort Order').press('CapsLock'); + await page.locator('select[name="type"]').selectOption('footer_links'); + await page.locator('select[name="type"]').selectOption('services_content'); + await page.getByRole('button', { name: 'Save Theme' }).click(); + await page.getByText('Add Services').first().click(); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('Demo_asdddddddddas'); + await page.getByPlaceholder('Description').click(); + await page.getByPlaceholder('Description').fill('Demo_sadqweqw'); + await page.getByPlaceholder('Service Icon Class').click(); + await page.getByPlaceholder('Service Icon Class').fill('Demo_dasdqww'); + await page.locator('button').filter({ hasText: /^Save$/ }).click(); + await page.locator('.relative > label').click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Theme updated successfully')).toBeVisible(); +}); + +test('Delete Theme', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Themes' }).click(); + await page.locator('div').filter({ hasText: /^18DefaultDefaultservices_contentaSDASSA23Active$/ }).locator('span').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Theme deleted successfully')).toBeVisible(); +}); diff --git a/tests/admin/settings/users.spec.ts b/tests/admin/settings/users.spec.ts new file mode 100644 index 00000000000..873cc74a04a --- /dev/null +++ b/tests/admin/settings/users.spec.ts @@ -0,0 +1,69 @@ +import { test, expect, config } from '../../utils/setup'; + +test('Create Users', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Users' }).click(); + await page.getByRole('button', { name: 'Create User' }).click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('User'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('User@gmail.com'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('Password', { exact: true }).click(); + await page.getByPlaceholder('Password', { exact: true }).fill('User'); + await page.getByPlaceholder('Confirm Password').click(); + await page.getByPlaceholder('Confirm Password').fill('User'); + await page.locator('.relative > label').click(); + await page.locator('select[name="role_id"]').selectOption('1'); + await page.getByRole('button', { name: 'Save User' }).click(); + await page.locator('div').filter({ hasText: /^2KUserActiveUser@gmail\.comAdministrator$/ }).locator('a').first().click(); + + await expect(page.getByText('User created successfully.')).toBeVisible(); +}); + +test('Edit Users', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Users' }).click(); + await page.locator('div').filter({ hasText: /^2KUserActiveUser@gmail\.comAdministrator$/ }).locator('a').first().click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('User'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('User@gmail.com'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('Password', { exact: true }).click(); + await page.getByPlaceholder('Password', { exact: true }).fill('User'); + await page.getByPlaceholder('Confirm Password').click(); + await page.getByPlaceholder('Confirm Password').fill('User'); + await page.locator('.relative > label').click(); + await page.locator('select[name="role_id"]').selectOption('1'); + await page.getByRole('button', { name: 'Save User' }).click(); + + await expect(page.getByText('User updated successfully.')).toBeVisible(); +}); + +test('Delete Users', async ({page}) => { + await page.goto(`${config.baseUrl}/admin/login`); + await page.getByPlaceholder('Email Address').click(); + await page.getByPlaceholder('Email Address').fill(config.adminEmail); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(config.adminPassword); + await page.getByLabel('Sign In').click(); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: 'Users' }).click(); + await page.locator('div').filter({ hasText: /^2KUserActiveUser@gmail\.comAdministrator$/ }).locator('a').nth(1).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('User deleted successfully.')).toBeVisible(); +}); diff --git a/tests/shop/add-to-cart.spec.ts b/tests/shop/add-to-cart.spec.ts new file mode 100644 index 00000000000..a423f8d6aaa --- /dev/null +++ b/tests/shop/add-to-cart.spec.ts @@ -0,0 +1,8 @@ +import { test, expect, config } from '../utils/setup'; + +test('Add to cart', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + + await expect(page.getByText('Item Added Successfully').first()).toBeVisible(); +}); diff --git a/tests/shop/auth.spec.ts b/tests/shop/auth.spec.ts new file mode 100644 index 00000000000..0987e59125f --- /dev/null +++ b/tests/shop/auth.spec.ts @@ -0,0 +1,55 @@ +import { test, expect, config } from '../utils/setup'; + +test('register', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign Up' }).click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('testUser'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo'); + await page.getByPlaceholder('email@example.com').click(); + const randomEmail = `testUser${Date.now()}@gmail.com`; + await page.getByPlaceholder('email@example.com').fill(randomEmail); + await page.getByPlaceholder('Password', { exact: true }).click(); + await page.getByPlaceholder('Password', { exact: true }).fill('testUser@123'); + await page.getByPlaceholder('Confirm Password').click(); + await page.getByPlaceholder('Confirm Password').fill('testUser@123'); + await page.locator('#main form div').filter({ hasText: 'Subscribe to newsletter' }).locator('label').first().click(); + await page.getByRole('button', { name: 'Register' }).click(); + + await expect(page.getByText('Account created successfully, an e-mail has been sent for verification.').first()).toBeVisible(); +}); + +test('login', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + + await page.getByLabel('Profile').click(); + await expect(page.getByText('Logout').first()).toBeVisible(); +}); + +test('logout', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.waitForTimeout(5000); + + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Logout' }).click(); + await page.waitForTimeout(5000); + + await page.getByLabel('Profile').click(); + await expect(page.getByText('Welcome Guest').first()).toBeVisible(); +}); diff --git a/tests/shop/cart.spec.ts b/tests/shop/cart.spec.ts new file mode 100644 index 00000000000..a173b01bf06 --- /dev/null +++ b/tests/shop/cart.spec.ts @@ -0,0 +1,67 @@ +import { test, expect, config } from '../utils/setup'; + +test('Increment', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.getByText('Arctic Touchscreen Winter Gloves $21.00 Add To Cart').first().click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.waitForTimeout(5000); + await page.goto(`${config.baseUrl}/checkout/cart`); + await page.getByLabel('Increase Quantity').first().click(); + await page.getByRole('button', { name: 'Update Cart' }).click(); + + await expect(page.getByText('Quantity updated successfully').first()).toBeVisible(); +}); + +test('Decrement', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.waitForTimeout(5000); + await page.goto(`${config.baseUrl}/checkout/cart`); + await page.getByLabel('Increase Quantity').first().click(); + await page.getByLabel('Decrease Quantity').click(); + await page.getByRole('button', { name: 'Update Cart' }).click(); + + await expect(page.getByText('Quantity updated successfully').first()).toBeVisible(); +}); + +test('Remove One', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.waitForTimeout(5000); + await page.goto(`${config.baseUrl}/checkout/cart`); + await page.getByRole('button', { name: 'Remove' }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Item is successfully removed from the cart.').first()).toBeVisible(); +}); + +test('Remove All', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.waitForTimeout(5000); + await page.goto(`${config.baseUrl}/checkout/cart`); + await page.locator('.icon-uncheck').first().click(); + await page.getByRole('button', { name: 'Remove' }).first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Selected items successfully removed from cart.').first()).toBeVisible(); +}); + +test('Apply Coupon', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.waitForTimeout(5000); + await page.goto(`${config.baseUrl}/checkout/cart`); + await page.getByRole('button', { name: 'Apply Coupon' }).click(); + await page.getByPlaceholder('Enter your code').click(); + await page.getByPlaceholder('Enter your code').fill('12345'); + await page.getByRole('button', { name: 'Apply', exact: true }).click(); + + await expect(page.getByText('Coupon code applied successfully.').first()).toBeVisible(); +}); diff --git a/tests/shop/checkout.spec.ts b/tests/shop/checkout.spec.ts new file mode 100644 index 00000000000..68be0da31fd --- /dev/null +++ b/tests/shop/checkout.spec.ts @@ -0,0 +1,97 @@ +import { test, expect, config } from '../utils/setup'; + +test('Customer CheckOut', async ({page}) => { + test.setTimeout(120000); + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('email@example.com').press('Tab'); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.waitForTimeout(5000); + await page.getByRole('button', { name: 'Shopping Cart' }).click(); + await page.getByRole('link', { name: 'Continue to Checkout' }).click(); + try { + await page.getByPlaceholder('Company Name').click({timeout: 5000}); + await page.getByPlaceholder('Company Name').fill('Example'); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Test'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('User'); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('webkul@example.com'); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('demo'); + await page.locator('select[name="billing\\.country"]').selectOption('AQ'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('any'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('any'); + await page.getByPlaceholder('Zip/Postcode').click(); + await page.getByPlaceholder('Zip/Postcode').fill('123456'); + await page.getByPlaceholder('Telephone').click(); + await page.getByPlaceholder('Telephone').fill('9876543210'); + await page.locator('#save_address').nth(1).click(); + await page.getByRole('button', { name: 'Save' }).click(); + } catch(e) { + await page.locator('span[class="icon-checkout-address text-6xl text-navyBlue max-sm:text-5xl"]').nth(0).click(); + } + await page.getByRole('button', { name: 'Proceed' }).click(); + await page.waitForSelector('text=Free Shipping'); + await page.getByText('Free Shipping').first().click(); + await page.waitForSelector('text=Cash On Delivery'); + await page.getByText('Cash On Delivery').first().click(); + await page.getByRole('button', { name: 'Place Order' }).click(); + await page.waitForSelector('text=Thank you for your order!'); + + await expect(page.locator('text=Thank you for your order!')).toBeVisible(); +}); + +test('Guest CheckOut', async ({page}) => { + test.setTimeout(120000); + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(1).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.waitForTimeout(5000); + await page.getByRole('button', { name: 'Shopping Cart' }).click(); + await page.getByRole('link', { name: 'Continue to Checkout' }).click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('WEBKUL'); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('Demo'); + await page.getByPlaceholder('First Name').press('Tab'); + await page.getByPlaceholder('Last Name').fill('Demo'); + await page.getByPlaceholder('Last Name').press('Tab'); + await page.getByRole('textbox', { name: 'email@example.com' }).press('CapsLock'); + await page.getByRole('textbox', { name: 'email@example.com' }).fill('Demo_ashdghsd@hjdg.sad'); + await page.getByRole('textbox', { name: 'email@example.com' }).press('Tab'); + await page.getByPlaceholder('Street Address').fill('Demo2367'); + await page.getByPlaceholder('Street Address').press('Tab'); + await page.locator('select[name="billing\\.country"]').selectOption('AI'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('Demo'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('Demo'); + await page.getByPlaceholder('Zip/Postcode').click(); + await page.getByPlaceholder('Zip/Postcode').fill('Demo_djsbfuweh'); + await page.getByPlaceholder('Telephone').click(); + await page.getByPlaceholder('Telephone').fill('9023723564'); + await page.getByRole('button', { name: 'Proceed' }).click(); + await page.getByPlaceholder('Zip/Postcode').click(); + await page.getByPlaceholder('Zip/Postcode').fill('2673854'); + await page.getByRole('button', { name: 'Proceed' }).click(); + await page.waitForSelector('text=Free Shipping'); + await page.getByText('Free Shipping').first().click(); + await page.waitForSelector('text=Cash On Delivery'); + await page.getByText('Cash On Delivery').first().click(); + await page.getByRole('button', { name: 'Place Order' }).click(); + await page.waitForSelector('text=Thank you for your order!'); + + await expect(page.locator('text=Thank you for your order!')).toBeVisible(); +}); diff --git a/tests/shop/compare.spec.ts b/tests/shop/compare.spec.ts new file mode 100644 index 00000000000..3c07a3e9f92 --- /dev/null +++ b/tests/shop/compare.spec.ts @@ -0,0 +1,32 @@ +import { test, expect, config } from '../utils/setup'; + +test('Add', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.locator('div:nth-child(2) > .-mt-9 > .action-items > .icon-compare').first().click(); + await page.locator('.action-items > .icon-compare').first().click(); + await page.locator('div:nth-child(3) > .-mt-9 > .action-items > .icon-compare').first().click(); + + await expect(page.getByText('Item added successfully to compare list').first()).toBeVisible(); +}); + +test('Remove', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.locator('div:nth-child(2) > .-mt-9 > .action-items > .icon-compare').first().click(); + await page.locator('.action-items > .icon-compare').first().click(); + await page.locator('div:nth-child(3) > .-mt-9 > div').first().click(); + await page.getByRole('link', { name: 'Compare' }).click(); + await page.locator('.relative > .icon-cancel').first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); +}); + +test('Remove all', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.locator('div:nth-child(2) > .-mt-9 > .action-items > .icon-compare').first().click(); + await page.locator('.action-items > .icon-compare').first().click(); + await page.locator('div:nth-child(3) > .-mt-9 > div').first().click(); + await page.getByRole('link', { name: 'Compare' }).click(); + await page.getByText('Delete All', { exact: true }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('All items removed successfully.').first()).toBeVisible(); +}); diff --git a/tests/shop/customer.spec.ts b/tests/shop/customer.spec.ts new file mode 100644 index 00000000000..9fb6486bb76 --- /dev/null +++ b/tests/shop/customer.spec.ts @@ -0,0 +1,327 @@ +import { test, expect, config } from '../utils/setup'; + +test('Profile Edit', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: 'Edit' }).click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('testUser1'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo1'); + await page.getByPlaceholder('Email', { exact: true }).click(); + await page.getByPlaceholder('Email', { exact: true }).fill('testUser@gmail.com'); + await page.getByPlaceholder('Phone').click(); + await page.getByPlaceholder('Phone').fill('987654323'); + await page.getByLabel('shop::app.customers.account.').selectOption('Male'); + await page.getByPlaceholder('Date of Birth').click(); + const date = new Date(); + date.setFullYear(date.getFullYear() - 1); + const formattedDate = date.toISOString().split('T')[0]; + await page.getByPlaceholder('Date of Birth').fill(formattedDate); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Profile updated successfully').first()).toBeVisible(); +}); + +test('Add Address', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: ' Address ' }).click(); + await page.getByRole('link', { name: 'Add Address' }).click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('Webkul'); + await page.getByPlaceholder('Company Name').press('Tab'); + await page.getByPlaceholder('First Name').fill('Demo'); + await page.getByPlaceholder('First Name').press('Tab'); + await page.getByPlaceholder('Last Name').fill('User'); + await page.getByPlaceholder('Last Name').press('Tab'); + await page.getByPlaceholder('Email', { exact: true }).fill('test@example.com'); + await page.getByPlaceholder('Email', { exact: true }).press('Tab'); + await page.getByPlaceholder('Vat ID').press('Tab'); + await page.getByPlaceholder('Street Address').fill('Demo'); + await page.getByPlaceholder('Street Address').press('Tab'); + await page.getByLabel('Country').selectOption('DZ'); + await page.getByPlaceholder('State').click(); + await page.getByPlaceholder('State').fill('any'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('any'); + await page.getByPlaceholder('Post Code').click(); + await page.getByPlaceholder('Post Code').fill('123456'); + await page.getByPlaceholder('Phone').click(); + await page.getByPlaceholder('Phone').fill('9876543210'); + await page.locator('#main form div').filter({ hasText: 'Set as Default' }).locator('label').first().click(); + await page.locator('#main form div').filter({ hasText: 'Set as Default' }).locator('label').first().click(); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Address have been successfully added.').first()).toBeVisible(); +}); + +test('Edit Address', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: ' Address ' }).click(); + await page.getByLabel('More Options').first().click(); + await page.getByRole('link', { name: 'Edit' }).click(); + await page.getByPlaceholder('Company Name').click(); + await page.getByPlaceholder('Company Name').fill('webkul1'); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').click(); + await page.getByPlaceholder('First Name').fill('User1'); + await page.getByPlaceholder('Last Name').click(); + await page.getByPlaceholder('Last Name').fill('Demo1'); + await page.getByPlaceholder('Email', { exact: true }).click(); + await page.getByPlaceholder('Email', { exact: true }).fill('User_test@gmail.coma'); + await page.getByPlaceholder('Vat ID').click(); + await page.getByPlaceholder('Street Address').click(); + await page.getByPlaceholder('Street Address').fill('123ghds1'); + await page.getByLabel('Country').selectOption('IN'); + await page.locator('#state').selectOption('TR'); + await page.getByPlaceholder('City').click(); + await page.getByPlaceholder('City').fill('noida'); + await page.getByPlaceholder('Post Code').click(); + await page.getByPlaceholder('Post Code').fill('201301'); + await page.getByPlaceholder('Phone').click(); + await page.getByPlaceholder('Phone').fill('9876543219'); + await page.getByRole('button', { name: 'Update' }).click(); + + await expect(page.getByText('Address updated successfully.').first()).toBeVisible(); +}); + +test('Default Address', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: ' Address ' }).click(); + await page.getByLabel('More Options').first().click(); + await page.getByRole('button', { name: 'Set as Default' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Default Address').first()).toBeVisible(); +}); + +test('Delete Address', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: ' Address ' }).click(); + await page.getByLabel('More Options').first().click(); + await page.getByRole('link', { name: 'Delete' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Address successfully deleted').first()).toBeVisible(); +}); + +test('Reorder', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Orders', exact: true }).click(); + await page.locator('div').locator('span.icon-eye').first().click(); + await page.getByRole('link', { name: 'Reorder' }).click(); + + + await page.getByRole('button', { name: 'Update Cart' }).click(); + + await expect(page.getByText('Quantity updated successfully').first()).toBeVisible(); +}); + +test('Cancel Order', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Orders', exact: true }).click(); + await page.locator('div').locator('span.icon-eye').first().click(); + await page.getByRole('link', { name: 'Cancel' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Your order has been canceled').first()).toBeVisible(); +}); + +test('Print Invoice', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Orders', exact: true }).click(); + await page.locator('div').locator('span.icon-eye').first().click(); + await page.getByRole('button', { name: 'Invoices' }).click(); + const downloadPromise = page.waitForEvent('download'); + await page.getByRole('link', { name: ' Print' }).click(); + const download = await downloadPromise; + + console.log(download); +}); + +test('Downloadable Orders', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile', exact: true }).click(); + await page.getByRole('link', { name: ' Downloadable Products ' }).click(); + const page2Promise = page.waitForEvent('popup'); + const download1Promise = page.waitForEvent('download'); + await page.getByRole('link', { name: 'file', exact: true }).click(); + const page2 = await page2Promise; + const download1 = await download1Promise; + + console.log(download1); +}); + +test('Wishlist to Cart', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('.action-items > span').first().click(); + await page.locator('div:nth-child(9) > div:nth-child(2) > div:nth-child(2) > .-mt-9 > .action-items > span').first().click(); + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Wishlist', exact: true }).click(); + await page.getByRole('button', { name: 'Move To Cart' }).first().click(); + + await expect(page.getByText('Item Successfully Moved to Cart').first()).toBeVisible(); +}); + +test('Remove from Wishlist', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('div:nth-child(9) > div:nth-child(2) > div:nth-child(3) > .-mt-9 > .action-items > span').first().click(); + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Wishlist', exact: true }).click(); + await page.locator('.max-md\\:hidden > .flex').first().click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Item Successfully Removed From Wishlist').first()).toBeVisible(); +}); + +test('Clear Wishlist', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Wishlist', exact: true }).click(); + await page.getByText('Delete All', { exact: true }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Item Successfully Removed From Wishlist').first()).toBeVisible(); +}); + +test('Change Password', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByRole('link', { name: 'Edit' }).click(); + await page.getByPlaceholder('Current Password').click(); + await page.getByPlaceholder('Current Password').fill('testUser@123'); + await page.getByPlaceholder('New Password').click(); + await page.getByPlaceholder('New Password').fill('testUser@1234'); + await page.getByPlaceholder('Confirm Password').click(); + await page.getByPlaceholder('Confirm Password').fill('testUser@1234'); + await page.getByRole('button', { name: 'Save' }).click(); + + await expect(page.getByText('Profile updated successfully').first()).toBeVisible(); +}); + +test('Delete Profile', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@1234'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Profile' }).click(); + await page.getByText('Delete Profile').first().click(); + await page.getByPlaceholder('Enter your password').click(); + await page.getByPlaceholder('Enter your password').fill('testUser@1234'); + await page.getByRole('button', { name: 'Delete' }).click(); + + await expect(page.getByText('Customer deleted successfully').first()).toBeVisible(); +}); diff --git a/tests/shop/mini-cart.spec.ts b/tests/shop/mini-cart.spec.ts new file mode 100644 index 00000000000..2f8b97851fc --- /dev/null +++ b/tests/shop/mini-cart.spec.ts @@ -0,0 +1,33 @@ +import { test, expect, config } from '../utils/setup'; + +test('Increment', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').first().click(); + await page.getByRole('button', { name: 'Shopping Cart' }).click(); + await page.getByRole('button', { name: 'Increase Quantity' }).click(); + await page.getByRole('button', { name: 'Increase Quantity' }).click(); + + await expect(page.locator('svg.text-blue.animate-spin.font-semibold')).toBeVisible(); +}); + +test('Decrement', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.getByRole('button', { name: 'Shopping Cart' }).click(); + await page.getByRole('button', { name: 'Increase Quantity' }).click(); + await page.getByRole('button', { name: 'Increase Quantity' }).click(); + await page.getByRole('button', { name: 'Decrease Quantity' }).click(); + await page.getByRole('button', { name: 'Decrease Quantity' }).click(); + + await expect(page.locator('svg.text-blue.animate-spin.font-semibold')).toBeVisible(); +}); + +test('Remove', async ({ page }) => { + await page.goto(`${config.baseUrl}`); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).locator('button').nth(2).click(); + await page.getByRole('button', { name: 'Shopping Cart' }).click(); + await page.getByRole('button', { name: 'Remove' }).click(); + await page.getByRole('button', { name: 'Agree', exact: true }).click(); + + await expect(page.getByText('Item is successfully removed from the cart.').first()).toBeVisible(); +}); diff --git a/tests/shop/products-categories.spec.ts b/tests/shop/products-categories.spec.ts new file mode 100644 index 00000000000..44161ebfaa6 --- /dev/null +++ b/tests/shop/products-categories.spec.ts @@ -0,0 +1,24 @@ +import { test, expect, config } from '../utils/setup'; + +test('Review Product', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('#main div').filter({ hasText: 'New Products View All New' }).getByLabel('Arctic Touchscreen Winter').click(); + await page.getByRole('button', { name: 'Reviews' }).click(); + await page.locator('#review-tab').getByText('Write a Review').click(); + await page.locator('#review-tab span').nth(3).click(); + await page.locator('#review-tab span').nth(4).click(); + await page.getByPlaceholder('Title').click(); + await page.getByPlaceholder('Title').fill('My Review'); + await page.getByPlaceholder('Comment').click(); + await page.getByPlaceholder('Comment').fill('Great Product'); + await page.getByRole('button', { name: 'Submit Review' }).click(); + + await expect(page.getByText('Review submitted successfully.').first()).toBeVisible(); +}); diff --git a/tests/shop/search.spec.ts b/tests/shop/search.spec.ts new file mode 100644 index 00000000000..81e99999a68 --- /dev/null +++ b/tests/shop/search.spec.ts @@ -0,0 +1,11 @@ +import { test, expect, config } from '../utils/setup'; + +test('Search by query', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Search products here').click(); + await page.getByLabel('Search products here').fill('arct'); + await page.getByLabel('Search products here').press('Enter'); + + await expect(page.getByText('Search results for : arct').first()).toBeVisible(); + +}); diff --git a/tests/shop/wishlist.spec.ts b/tests/shop/wishlist.spec.ts new file mode 100644 index 00000000000..f81bc8a252d --- /dev/null +++ b/tests/shop/wishlist.spec.ts @@ -0,0 +1,31 @@ +import { test, expect, config } from '../utils/setup'; + +test('Add To Wishlist', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('email@example.com').press('Tab'); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('.action-items > span').first().click(); + await page.locator('div:nth-child(9) > div:nth-child(2) > div > .-mt-9 > .action-items > span').first().click(); + + await expect(page.getByText('Item Successfully Added To Wishlist').first()).toBeVisible(); +}); + +test('Remove from Wishlist', async ({page}) => { + await page.goto(`${config.baseUrl}`); + await page.getByLabel('Profile').click(); + await page.getByRole('link', { name: 'Sign In' }).click(); + await page.getByPlaceholder('email@example.com').click(); + await page.getByPlaceholder('email@example.com').fill('testUser@gmail.com'); + await page.getByPlaceholder('email@example.com').press('Tab'); + await page.getByPlaceholder('Password').fill('testUser@123'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.locator('.action-items > span').first().click(); + await page.locator('div:nth-child(9) > div:nth-child(2) > div > .-mt-9 > .action-items > span').first().click(); + + await expect(page.getByText('Item Successfully Removed From Wishlist').first()).toBeVisible(); +}); diff --git a/tests/utils/README.md b/tests/utils/README.md new file mode 100644 index 00000000000..c000373c32c --- /dev/null +++ b/tests/utils/README.md @@ -0,0 +1,125 @@ +# Bagisto Playwright Test Cases for Bagisto v2.2.2 + +This document provides instructions for running Playwright test cases for Bagisto, covering both Shop and Admin ends. + +--- + +## Prerequisites + +1. **Install Node.js dependencies** + ```bash + npm install + ``` + +2. **Install Playwright Browsers** + ```bash + npx playwright install --with-deps + ``` + +--- + +## Running Playwright Tests + +### Shop End Tests + +#### Auth Tests +```bash +npx playwright test tests/shop/auth.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Auth || echo "Continue" +``` + +#### Add To Cart Tests +```bash +npx playwright test tests/shop/add-to-cart.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Add-to-cart || echo "Continue" +``` + +#### Mini Cart Tests +```bash +npx playwright test tests/shop/mini-cart.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Mini-cart || echo "Continue" +``` + +#### Cart Tests +```bash +npx playwright test tests/shop/cart.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Cart || echo "Continue" +``` + +#### Wishlist Tests +```bash +npx playwright test tests/shop/wishlist.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Wishlist || echo "Continue" +``` + +#### Checkout Tests +```bash +npx playwright test tests/shop/checkout.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Checkout || echo "Continue" +``` + +#### Compare Tests +```bash +npx playwright test tests/shop/compare.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Compare || echo "Continue" +``` + +#### Product-Category Tests +```bash +npx playwright test tests/shop/products-categories.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Product-category || echo "Continue" +``` + +#### Customer Tests +```bash +npx playwright test tests/shop/customer.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Customer || echo "Continue" +``` + +#### Search Tests +```bash +npx playwright test tests/shop/search.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/shop/Search || echo "Continue" +``` + +--- + +### Admin End Tests + +#### Auth Tests +```bash +npx playwright test tests/admin/auth.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Auth || echo "Continue" +``` + +#### Sales Tests +```bash +npx playwright test tests/admin/sales.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Sales || echo "Continue" +``` + +#### Catalog Tests +```bash +npx playwright test tests/admin/Catalog --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Catalog || echo "Continue" +``` + +#### Customers Tests +```bash +npx playwright test tests/admin/Customers --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Customers || echo "Continue" +``` + +#### CMS Tests +```bash +npx playwright test tests/admin/cms.spec --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/CMS || echo "Continue" +``` + +#### Marketing Tests +```bash +npx playwright test tests/admin/Marketing --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Marketing || echo "Continue" +``` + +#### Settings Tests +```bash +npx playwright test tests/admin/Settings --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Settings || echo "Continue" +``` + +#### Configuration Tests +```bash +npx playwright test tests/admin/Configuration --workers=1 --project=chromium --retries=2 --quiet --reporter html --output=playwright-report-temp/admin/Configuration || echo "Continue" +``` + +--- + +## Merging Playwright Reports +To merge all the generated reports: +```bash +npx playwright merge-reports playwright-report/* +``` \ No newline at end of file diff --git a/tests/utils/setup.ts b/tests/utils/setup.ts new file mode 100644 index 00000000000..4762dc1be35 --- /dev/null +++ b/tests/utils/setup.ts @@ -0,0 +1,5 @@ +import { test as base, expect } from '@playwright/test'; +import config from '../../config/setup'; + +export const test = base.extend({}); +export { expect, config };