Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4a962fc
wrriten script for datatransfer product,lead and persons
sagarkumar-webkul Jul 15, 2025
61617fc
fixed issue in click button
sagarkumar-webkul Aug 12, 2025
cdf51ab
change path of validate button
sagarkumar-webkul Aug 12, 2025
600c6f9
increase timeout
sagarkumar-webkul Aug 13, 2025
4f92080
fix try-1
sagarkumar-webkul Aug 13, 2025
c6c9442
fix test-2
sagarkumar-webkul Aug 13, 2025
737a99e
fix-try-3
sagarkumar-webkul Aug 13, 2025
2e6b6fb
Merge branch 'script/datatransfer' of https://github.com/sagarkumar-w…
sagarkumar-webkul Aug 13, 2025
c6d9a24
try-3
sagarkumar-webkul Aug 13, 2025
4589fbb
try-4
sagarkumar-webkul Aug 13, 2025
51b5355
Update datatransfer-leads.spec.ts
harshit-webkul Aug 13, 2025
2b83553
Update datatransfer-leads.spec.ts
harshit-webkul Aug 13, 2025
25f4a86
Update datatransfer-leads.spec.ts
harshit-webkul Aug 13, 2025
46b0015
update changes
sagarkumar-webkul Aug 13, 2025
5bf3519
update changes
sagarkumar-webkul Aug 13, 2025
c67e592
update changes
sagarkumar-webkul Aug 13, 2025
09542b2
update changes
sagarkumar-webkul Aug 13, 2025
66cb5b4
Update leads_updated.csv
sagarkumar-webkul Sep 1, 2025
f7a535f
Update leads.csv
sagarkumar-webkul Sep 1, 2025
29d57f5
Refactor import management tests for persons: update CSV data structu…
sagarkumar-webkul Sep 2, 2025
4953a78
Merge branch '2.1' of https://github.com/sagarkumar-webkul/laravel-cr…
sagarkumar-webkul Sep 2, 2025
ff91ecd
Merge branch 'script/datatransfer' of https://github.com/sagarkumar-w…
sagarkumar-webkul Sep 2, 2025
e63a9fb
Merge branch 'krayin:2.1' into script/datatransfer
sagarkumar-webkul Sep 2, 2025
0eafdb4
Merge branch 'script/datatransfer' of https://github.com/sagarkumar-w…
sagarkumar-webkul Sep 2, 2025
94261c1
Refactor import management tests: update CSV data structure, add new …
sagarkumar-webkul Sep 2, 2025
a0b5cc7
Update admin authentication state and modify lead import management t…
sagarkumar-webkul Sep 2, 2025
89ed4a5
Refactor import management test: streamline file upload and selection…
sagarkumar-webkul Sep 2, 2025
230ce0b
Refactor import management tests: update file input handling and enha…
sagarkumar-webkul Sep 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions packages/Webkul/Admin/tests/e2e-pw/.state/admin-auth.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
3 changes: 3 additions & 0 deletions packages/Webkul/Admin/tests/e2e-pw/data/sample/leads.csv
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions packages/Webkul/Admin/tests/e2e-pw/data/sample/persons.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name,emails,contact_numbers,organization_id,job_title,user_id
Wilson Fisk,"[{""label"": ""work"", ""value"": ""[email protected]""}, {""label"": ""home"", ""value"": ""[email protected]""}]","[{""label"": ""work"", ""value"": ""5454445454""}]",1,Sales Executive,1
Sasha Calle,"[{""label"": ""work"", ""value"": ""[email protected]""}]","[{""label"": ""work"", ""value"": ""15454445454""}]",1,Sales Representatives,1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name,emails,contact_numbers,organization_id,job_title,user_id
Wilson Updated Fisk,"[{""label"": ""work"", ""value"": ""[email protected]""}, {""label"": ""home"", ""value"": ""[email protected]""}]","[{""label"": ""work"", ""value"": ""5454445454""}]",1,Sales Executive,1
Sasha Updated Calle,"[{""label"": ""work"", ""value"": ""[email protected]""}]","[{""label"": ""work"", ""value"": ""15454445454""}]",1,Sales Representatives,1
3 changes: 3 additions & 0 deletions packages/Webkul/Admin/tests/e2e-pw/data/sample/products.csv
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/tests/e2e-pw/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig({

timeout: 30 * 1000,

expect: { timeout: 20 * 1000 },
expect: { timeout: 30 * 1000 },

outputDir: "./test-results",

Expand Down
76 changes: 63 additions & 13 deletions packages/Webkul/Admin/tests/e2e-pw/setup.ts
Original file line number Diff line number Diff line change
@@ -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<void>;
}

type AdminFixtures = {
adminPage: Page;
adminPage: AdminPage;
};

export const test = base.extend<AdminFixtures>({
adminPage: async ({ page }, use) => {
const adminCredentials = {
email: "[email protected]",
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 };
Original file line number Diff line number Diff line change
@@ -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();
});
});

Original file line number Diff line number Diff line change
@@ -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();
});
});

Loading
Loading