diff --git a/packages/Webkul/Admin/tests/e2e-pw/.state/admin-auth.json b/packages/Webkul/Admin/tests/e2e-pw/.state/admin-auth.json new file mode 100644 index 0000000000..b16122ce31 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/.state/admin-auth.json @@ -0,0 +1,35 @@ +{ + "cookies": [ + { + "name": "XSRF-TOKEN", + "value": "eyJpdiI6Im9hWTgvaU8zYmVETS9SRGlJdFVEaVE9PSIsInZhbHVlIjoiUnhiL3drR0ozNzhBRmM1OHIwbS9PbjFUWDBlR3NNdHEwRiswR0szR1piMCs3eUx6WnlQM0E0TGpPSG1tbkc1R1dQOTBWemFxVDJyS0x0ZUVtTVY0aHE1K0djT2lBalpFTGFJK1pyaVlJK2xkbGgwM0NWU0VVZ05kY2V5VlJBUHYiLCJtYWMiOiIxZTU3YmJjZDRhZWI1M2Q1YzA2YjUxY2ZhYzZlYTk1NmYzNTljNTAxMGFhZWNlYmM4NGM5OWVlYTdlNmU0NDkxIiwidGFnIjoiIn0%3D", + "domain": "192.168.15.131", + "path": "/", + "expires": 1756803946.117523, + "httpOnly": false, + "secure": false, + "sameSite": "Lax" + }, + { + "name": "krayin_crm_session", + "value": "eyJpdiI6IitaU042aVUwcEE0VVFMckZRSFdiTXc9PSIsInZhbHVlIjoiUFQyY2Q4bVlsMWJ0anE3NWt2ZU0yS2JqYUprUmZUQWNJcTNmYm5oWmU4R09PcFdSTDFNc1dVWlQ4ekl1WFlqNnVCUXd6Q0xmRWw0OHRXb3h0SHVnYWpnRTdkSEQrbW9sUjJrdy9LTDRCeHRrK01NVHdPcDV0TXN3d1hqNnVTc08iLCJtYWMiOiI1ZjRkMDRlMmQ5YmM3ZDlkNWU0MzgwM2ExMmM3NGYyZDdkMWNkMTU5ODNiYmVlNWRjZWI1YWUwMGY5MjhkMWYwIiwidGFnIjoiIn0%3D", + "domain": "192.168.15.131", + "path": "/", + "expires": 1756803946.117604, + "httpOnly": true, + "secure": false, + "sameSite": "Lax" + } + ], + "origins": [ + { + "origin": "http://192.168.15.131", + "localStorage": [ + { + "name": "phpdebugbar-height", + "value": "300" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads.csv new file mode 100644 index 0000000000..c4de0d92ef --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads.csv @@ -0,0 +1,3 @@ +id,title,description,lead_value,status,lost_reason,closed_at,user_id,person_id,lead_source_id,lead_type_id,lead_pipeline_id,product,lead_pipeline_stage_id,expected_close_date +1,Updated Urgent Requirement of Product -> TaskMaster Pro - Advanced Project Management Tool,"Urgent Requirement: TaskMaster Pro – an advanced project management tool designed to enhance team collaboration, streamline task tracking, and optimize time management for small to medium-sized teams. Ideal for businesses looking to improve project efficiency and productivity.",50000,1,,2024-08-30 14:39:58,1,1,1,1,1,"price=45,quantity=2,id=1",5,2024-09-02 +,Need more information About Product -> CyberGuard Pro,A client wants to know about the CyberGuard Pro Product in details and he is interested in the product.,100000,1,,,1,1,1,1,1,"price=45,quantity=2,id=2",3,2024-09-06 diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads_updated.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads_updated.csv new file mode 100644 index 0000000000..e124bae9d7 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/leads_updated.csv @@ -0,0 +1,3 @@ +id,title,description,lead_value,status,lost_reason,closed_at,user_id,person_id,lead_source_id,lead_type_id,lead_pipeline_id,product,lead_pipeline_stage_id,expected_close_date +1,Urgent Requirement of Product -> TaskMaster Pro - Advanced Project Management Tool," Requirement: TaskMaster Pro – an advanced project management tool designed to enhance team collaboration, streamline task tracking, and optimize time management for small to medium-sized teams. Ideal for businesses looking to improve project efficiency and productivity.",50000,1,,2024-08-30 14:39:58,1,1,2,2,1,"price=45,quantity=2,id=1",5,2024-09-02 +2,Need more information About Product -> Pro,A wants to know about the CyberGuard Pro Product in details and he is interested in the product.,100000,1,,,1,2,4,1,1,"price=45,quantity=2,id=2",3,2024-09-06 diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons.csv new file mode 100644 index 0000000000..d4155444d9 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons.csv @@ -0,0 +1,3 @@ +name,emails,contact_numbers,organization_id,job_title,user_id +Wilson Fisk,"[{""label"": ""work"", ""value"": ""contact@wilson.com""}, {""label"": ""home"", ""value"": ""contact.home@wilson.com""}]","[{""label"": ""work"", ""value"": ""5454445454""}]",1,Sales Executive,1 +Sasha Calle,"[{""label"": ""work"", ""value"": ""contact@sasha.com""}]","[{""label"": ""work"", ""value"": ""15454445454""}]",1,Sales Representatives,1 diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons_updated.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons_updated.csv new file mode 100644 index 0000000000..62782d9c48 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/persons_updated.csv @@ -0,0 +1,3 @@ +name,emails,contact_numbers,organization_id,job_title,user_id +Wilson Updated Fisk,"[{""label"": ""work"", ""value"": ""contact@wilson.com""}, {""label"": ""home"", ""value"": ""contact.home@wilson.com""}]","[{""label"": ""work"", ""value"": ""5454445454""}]",1,Sales Executive,1 +Sasha Updated Calle,"[{""label"": ""work"", ""value"": ""contact@sasha.com""}]","[{""label"": ""work"", ""value"": ""15454445454""}]",1,Sales Representatives,1 diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/products.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/products.csv new file mode 100644 index 0000000000..b27b317b29 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/products.csv @@ -0,0 +1,3 @@ +sku,name,description,quantity,price +100,TaskMaster Pro - Advanced Project Management Tool,"A project management tool designed for small to medium-sized teams. It offers task tracking, team collaboration, and time management features. It also integrates with popular communication platforms.",45,500 +101,ProjectPulse - A Simple and Effective Project Management Tool,"A cloud-based project management solution that provides Gantt charts, resource allocation, and project reporting. It is designed for large enterprises and supports multi-project management with real-time analytics.",20,450 diff --git a/packages/Webkul/Admin/tests/e2e-pw/data/sample/products_updated.csv b/packages/Webkul/Admin/tests/e2e-pw/data/sample/products_updated.csv new file mode 100644 index 0000000000..df14f2d7d6 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/data/sample/products_updated.csv @@ -0,0 +1,3 @@ +sku,name,description,quantity,price +100,TaskMaster updated Pro - Advanced Project Management Tool,"A project management tool designed for small to medium-sized teams. It offers task tracking, team collaboration, and time management features. It also integrates with popular communication platforms.",45,500 +101,ProjectPulse updated - A Simple and Effective Project Management Tool,"A cloud-based project management solution that provides Gantt charts, resource allocation, and project reporting. It is designed for large enterprises and supports multi-project management with real-time analytics.",20,450 diff --git a/packages/Webkul/Admin/tests/e2e-pw/playwright.config.ts b/packages/Webkul/Admin/tests/e2e-pw/playwright.config.ts index 35d745e339..30760f076f 100644 --- a/packages/Webkul/Admin/tests/e2e-pw/playwright.config.ts +++ b/packages/Webkul/Admin/tests/e2e-pw/playwright.config.ts @@ -17,7 +17,7 @@ export default defineConfig({ timeout: 30 * 1000, - expect: { timeout: 20 * 1000 }, + expect: { timeout: 30 * 1000 }, outputDir: "./test-results", diff --git a/packages/Webkul/Admin/tests/e2e-pw/setup.ts b/packages/Webkul/Admin/tests/e2e-pw/setup.ts index 80a053e050..acd5e23ec0 100644 --- a/packages/Webkul/Admin/tests/e2e-pw/setup.ts +++ b/packages/Webkul/Admin/tests/e2e-pw/setup.ts @@ -1,25 +1,75 @@ import { test as base, expect, type Page } from "@playwright/test"; +import fs from "fs"; +import { ADMIN_AUTH_STATE_PATH } from "./playwright.config"; +import { loginAsAdmin } from "./utils/admin"; + +interface AdminPage extends Page { + fillInTinymce: (iframeSelector: string, content: string) => Promise; +} type AdminFixtures = { - adminPage: Page; + adminPage: AdminPage; }; export const test = base.extend({ - adminPage: async ({ page }, use) => { - const adminCredentials = { - email: "admin@example.com", - password: "admin123", - }; + adminPage: async ({ browser }, use) => { + const authExists = fs.existsSync(ADMIN_AUTH_STATE_PATH); + + const context = await browser.newContext( + authExists ? { storageState: ADMIN_AUTH_STATE_PATH } : {} + ); + + const page = await context.newPage(); - await page.goto("admin/login"); - await page.fill('input[name="email"]', adminCredentials.email); - await page.fill('input[name="password"]', adminCredentials.password); - await page.press('input[name="password"]', "Enter"); + if (!authExists) { + /** + * Authenticate the admin user. + */ + await loginAsAdmin(page); - await page.waitForURL("**/admin/dashboard"); + /** + * Save authentication state to a file. + */ + await context.storageState({ path: ADMIN_AUTH_STATE_PATH }); + } else { + /** + * Navigate to the dashboard. + */ + await page.goto("admin/dashboard"); + } + + if (page.url().includes("admin/login")) { + /** + * Authenticate the admin user. + */ + await loginAsAdmin(page); + + /** + * Save authentication state to a file. + */ + await context.storageState({ path: ADMIN_AUTH_STATE_PATH }); + } + + /** + * Extend the page object with custom methods. + */ + (page as AdminPage).fillInTinymce = async function ( + iframeSelector: string, + content: string + ) { + await page.waitForSelector(iframeSelector); + const iframe = page.frameLocator(iframeSelector); + const editorBody = iframe.locator("body"); + await editorBody.click(); + await editorBody.press("Control+a"); + await editorBody.press("Backspace"); + await editorBody.pressSequentially(content); + await expect(editorBody).toHaveText(content); + }; - await use(page); + await use(page as AdminPage); + await context.close(); }, }); -export { expect }; +export { expect }; \ No newline at end of file diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-0-products.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-0-products.spec.ts new file mode 100644 index 0000000000..cd727d4fd5 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-0-products.spec.ts @@ -0,0 +1,98 @@ +import { test, expect } from '../../../setup'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + + +/* -------------------------- Import Management for Products -------------------------- */ +test.describe('Import Management for Products', () => { + const csvFileName = 'products.csv'; + const updatedCsvFileName = 'products_updated.csv'; + const csvPath = path.resolve(__dirname, `../../../data/sample/${csvFileName}`); + const updatedCsvPath = path.resolve(__dirname, `../../../data/sample/${updatedCsvFileName}`); + + test('should create a new import and validate records', async ({ adminPage }) => { + /* Navigate to Data Transfer section */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click 'Create Import' */ + await adminPage.getByRole('link', { name: 'Create Import' }).click(); + + /* Upload CSV file */ + await adminPage.setInputFiles('input[name="file"]', csvPath); + + await adminPage.locator('.peer.h-5').click(); + /* Select Entity Type (products) */ + + await adminPage.locator('#import-type').selectOption('products'); + + + /* Save the import job */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[@class="primary-button place-self-start"]').click(); + + + /* Wait for validation results */ + await expect(adminPage.getByText('Your import is valid. Click')).toBeVisible(); + await expect(adminPage.getByText('Total Rows Processed: 2')).toBeVisible(); + await expect(adminPage.getByText('Total Invalid Rows: 0')).toBeVisible(); + await expect(adminPage.getByText('Total Errors: 0')).toBeVisible(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await expect(adminPage.getByText('Congratulations! Your import')).toBeVisible(); + }); + + test('should update the import record (if editable)', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click edit icon for the first import */ + const editIcon = adminPage.locator('.icon-edit').first(); + + + await editIcon.click(); + + /* Re-upload updated CSV file */ + await adminPage.setInputFiles('input[name="file"]', updatedCsvPath); + + /* Save changes */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[@class="primary-button place-self-start"]').click(); + + /* Wait for validation results */ + await expect(adminPage.getByText('Your import is valid. Click')).toBeVisible(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await expect(adminPage.getByText('Congratulations! Your import')).toBeVisible(); + }); + + test('should delete the import', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click delete icon for the first import */ + const deleteIcon = adminPage.locator('.icon-delete').first(); + + + await deleteIcon.click(); + + /* Confirm deletion */ + await adminPage.getByRole('button', { name: 'Agree', exact: true }).click(); + + /* Assert deleted file name is not visible */ + await expect(adminPage.getByText(updatedCsvFileName).first()).not.toBeVisible(); + }); +}); + diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-1-persons.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-1-persons.spec.ts new file mode 100644 index 0000000000..3d5b2f4a5d --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-1-persons.spec.ts @@ -0,0 +1,110 @@ +import { test, expect } from '../../../setup'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { createOrganization } from '../../../utils/faker'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +test.describe('Import Management for Persons', () => { + const csvFileName = 'persons.csv'; + const updatedCsvFileName = 'persons_updated.csv'; + const csvPath = path.resolve(__dirname, `../../../data/sample/${csvFileName}`); + const updatedCsvPath = path.resolve(__dirname, `../../../data/sample/${updatedCsvFileName}`); + + test('organization should present for import person', async ({ adminPage }) => { + /** + * Create Organization. + */ + const companyName = await createOrganization(adminPage); + + + + }); + + test('should create a new import and validate records', async ({ adminPage }) => { + /* Navigate to Data Transfer section */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click 'Create Import' */ + await adminPage.getByRole('link', { name: 'Create Import' }).click(); + + /* Upload CSV file */ + await adminPage.setInputFiles('input[name="file"]', csvPath); + + /* Uncheck proccess in queue */ + await adminPage.locator('.peer.h-5').click(); // Adjust selector if multiple checkboxes present + + /* Save the import job */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[@class="primary-button place-self-start"]').click(); + + + /* Wait for validation results */ + await expect(adminPage.getByText('Your import is valid. Click')).toBeVisible(); + await expect(adminPage.getByText('Total Rows Processed: 2')).toBeVisible(); + await expect(adminPage.getByText('Total Invalid Rows: 0')).toBeVisible(); + await expect(adminPage.getByText('Total Errors: 0')).toBeVisible(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await expect(adminPage.getByText('Congratulations! Your import')).toBeVisible(); + + }); + + test('should update the import record (if editable)', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click edit icon for the first import */ + const editIcon = adminPage.locator('.icon-edit').first(); + + + await editIcon.click(); + + /* Change file or settings if editable (depends on system behavior) */ + + await adminPage.setInputFiles('input[name="file"]', updatedCsvPath); + + /* Save changes (if applicable) */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[@class="primary-button place-self-start"]').click(); + + + /* Wait for validation results */ + await expect(adminPage.getByText('Your import is valid. Click')).toBeVisible(); + await expect(adminPage.getByText('Total Rows Processed: 2')).toBeVisible(); + await expect(adminPage.getByText('Total Invalid Rows: 0')).toBeVisible(); + await expect(adminPage.getByText('Total Errors: 0')).toBeVisible(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await expect(adminPage.getByText('Congratulations! Your import')).toBeVisible(); + }); + + test('should delete the import', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click delete icon for first import */ + const deleteIcon = adminPage.locator('.icon-delete').first(); + + + await deleteIcon.click(); + + /* Confirm deletion */ + await adminPage.getByRole('button', { name: 'Agree', exact: true }).click(); + + /* Optional: Assert file name is no longer visible */ + await expect(adminPage.getByText('No Records Available.')).toBeVisible(); + }); +}); + diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-2-leads.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-2-leads.spec.ts new file mode 100644 index 0000000000..6087a8ad8a --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/datatransfer-2-leads.spec.ts @@ -0,0 +1,97 @@ +import { test, expect } from '../../../setup'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +/* -------------------------- Import Management for Leads -------------------------- */ +test.describe('Import Management for Leads', () => { + const csvFileName = 'leads.csv'; + const updatedCsvFileName = 'leads_updated.csv'; + const csvPath = path.resolve(__dirname, `../../../data/sample/${csvFileName}`); + const updatedCsvPath = path.resolve(__dirname, `../../../data/sample/${updatedCsvFileName}`); + + test('should create a new import and validate records', async ({ adminPage }) => { + /* Navigate to Data Transfer section */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + await adminPage.waitForTimeout(2000); + + /* Click 'Create Import' */ + // await adminPage.getByRole('link', { name: 'Create Import' }).click(); + await adminPage.locator('a.primary-button').click(); + + /* Upload CSV file */ + await adminPage.setInputFiles('input[name="file"]', csvPath); + + /* Uncheck proccess in queue */ + await adminPage.locator('.peer.h-5').click(); // Adjust selector if multiple checkboxes present + + /* Select Entity Type (leads) */ + await adminPage.locator('#import-type').selectOption('leads'); // Adjust selector if multiple checkboxes present + + + + /* Save the import job */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[contains(.,"Validate")]').click(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + await expect(adminPage.getByRole('paragraph').filter({ hasText: /^leads$/ }).first().first()).toBeVisible(); + + }); + + test('should update the import record (if editable)', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click edit icon for the first import */ + const editIcon = adminPage.locator('.icon-edit').first(); + + await editIcon.click(); + + /* Re-upload updated CSV file */ + await adminPage.setInputFiles('input[name="file"]', updatedCsvPath);; + + /* Save changes */ + await adminPage.getByRole('button', { name: 'Save Import' }).click(); + + /* Click 'Validate' */ + await adminPage.locator('//button[@class="primary-button place-self-start"]').click(); + + + /* Wait for validation results */ + await expect(adminPage.getByText('Your import is valid. Click')).toBeVisible(); + + /* Execute the import */ + await adminPage.getByRole('button', { name: 'Import' }).click(); + + /* Confirm import success */ + await expect(adminPage.getByText('Congratulations! Your import')).toBeVisible(); + }); + + test('should delete the import', async ({ adminPage }) => { + /* Navigate to Import listing */ + await adminPage.goto('admin/settings/data-transfer/imports'); + + /* Click delete icon for the first import */ + const deleteIcon = adminPage.locator('.icon-delete').first(); + + + await deleteIcon.click(); + + /* Confirm deletion */ + await adminPage.getByRole('button', { name: 'Agree', exact: true }).click(); + + /* Assert deleted file name is not visible */ + await expect(adminPage.getByText('No Records Available.')).toBeVisible(); + }); +}); diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/events.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/events.spec.ts index 5026aa4784..e394d28fd8 100644 --- a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/events.spec.ts +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/events.spec.ts @@ -47,7 +47,8 @@ test.describe("event management", () => { /** * Clicking on the edit button for the first event opens the modal. */ - await adminPage.locator('.row > div:nth-child(6) > a').first().click(); + const editIcon = adminPage.locator('.row > div:nth-child(6) > a').first(); + await editIcon.click(); /** * Fill the form with the event details. @@ -80,7 +81,10 @@ test.describe("event management", () => { /** * Delete the first event. */ - await adminPage.locator('div:nth-child(6) > a:nth-child(2)').first().click(); + const deleteIcon = adminPage.locator('div:nth-child(6) > a:nth-child(2)').first(); + + + await deleteIcon.click(); /** * Delete confirmation modal. diff --git a/packages/Webkul/Admin/tests/e2e-pw/utils/admin.ts b/packages/Webkul/Admin/tests/e2e-pw/utils/admin.ts new file mode 100644 index 0000000000..ea134905e2 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/utils/admin.ts @@ -0,0 +1,24 @@ +export async function loginAsAdmin(page) { + /** + * Admin credentials. + */ + const adminCredentials = { + email: "admin@example.com", + password: "admin123", + }; + + /** + * Authenticate the admin user. + */ + await page.goto("admin/login"); + await page.fill('input[name="email"]', adminCredentials.email); + await page.fill('input[name="password"]', adminCredentials.password); + await page.press('input[name="password"]', "Enter"); + + /** + * Wait for the dashboard to load. + */ + await page.waitForURL("**/admin/dashboard"); + + return adminCredentials; +} \ No newline at end of file