diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/emailtamplet.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/emailtamplet.spec.ts new file mode 100644 index 000000000..9ad6abdbf --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/automation/emailtamplet.spec.ts @@ -0,0 +1,76 @@ +import { test } from "../../../setup"; +import { generateDescription, generateFullName } from "../../../utils/faker"; + + +test.describe("email template management", () => { + + test("should create an email template", async ({ adminPage }) => { + /** + * Reaching to the email template listing page. + */ + await adminPage.goto("admin/settings/email-templates"); + /** + * click on the create email template button + */ + await adminPage.getByRole('link', { name: 'Create Email Template' }).click(); + + /** + * Filling the form with email template details. + */ + await adminPage.getByRole('textbox', { name: 'Subject' }).fill(generateFullName()); + await adminPage.locator('#placeholder').selectOption('{%leads.title%}'); + await adminPage.getByRole('textbox', { name: 'Content' }).fill(generateDescription()); + await adminPage.getByRole('textbox', { name: 'Name' }).fill('name'); + + /** + * Save email template and close the modal. + */ + await adminPage.getByRole('button', { name: 'Save Email Template' }).click(); + + }); + test("should edit an email template", async ({ adminPage }) => { + + + /** + * Reaching to the email template listing page. + */ + await adminPage.goto("admin/settings/email-templates"); + + /** + * Clicking on the edit button for the first email template opens the modal. + */ + await adminPage.locator('//span[@class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center icon-edit"]').first().click(); + + /** + * Fill the form with the email template details. + */ + await adminPage.getByRole('textbox', { name: 'Subject' }).fill(generateFullName()); + await adminPage.getByRole('textbox', { name: 'Content' }).fill(generateDescription()); + + /** + * Save email template and close the modal. + */ + await adminPage.getByRole('button', { name: 'Save Email Template' }).click(); + } ); + + test("should delete an email template", async ({ adminPage }) => { + /** + * Reaching to the email template listing page. + */ + await adminPage.goto("admin/settings/email-templates"); + + /** + * Clicking on the delete button for the first email template opens the modal. + */ + await adminPage.locator('//span[@class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center icon-delete"]').first().click(); + + /** + * Confirming the deletion of the email template. + */ + await adminPage.getByRole('button', { name: 'Delete' }).click(); + } + ); + + + +}); \ No newline at end of file diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/settings/other settings/tags.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/other settings/tags.spec.ts new file mode 100644 index 000000000..693974ace --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/settings/other settings/tags.spec.ts @@ -0,0 +1,95 @@ +import { expect, test } from "../../../setup"; +import { generateName } from "../../../utils/faker"; + + +test.describe("tags management", () => { + + test("should create a tag", async ({ adminPage }) => { + + /** + * Reaching to the tags listing page. + */ + await adminPage.goto("admin/settings/tags"); + /** + * Clicking on the create tag button opens the modal. + */ + await adminPage.getByRole('button', { name: 'Create Tag' }).click(); + /** + * Fill the form with the tag details. + */ + await adminPage.getByRole('textbox', { name: 'Name' }).click(); + await adminPage.getByRole('textbox', { name: 'Name' }).fill(generateName()); + await adminPage.locator('span:nth-child(6) > .block').click(); + + /** + * Save tag and close the modal. + */ + + await adminPage.getByRole('button', { name: 'Save Tag' }).click(); + /** + * Checking if the tag is created successfully. + */ + await expect(adminPage.getByText('Tag created successfully')).toBeVisible(); + + + + }) + test("should edit a tag", async ({ adminPage }) => { + /** + * Reaching to the tags listing page. + */ + + await adminPage.goto("admin/settings/tags"); + /** + * Clicking on the edit button for the first tag opens the modal. + */ + await adminPage.locator('//span[@class="icon-edit cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center"]').first().click(); + /** + * Fill the form with the tag details. + */ + await adminPage.getByRole('textbox', { name: 'Name' }).click(); + await adminPage.getByRole('textbox', { name: 'Name' }).fill(generateName()); + + /** + * Save tag and close the modal. + */ + await adminPage.getByRole('button', { name: 'Save Tag' }).click(); + /** + * Checking if the tag is updated successfully. + */ + await expect(adminPage.getByText('Tag updated successfully.').first()).toBeVisible(); + + }) + + test("should delete a tag", async ({ adminPage }) => { + + /** + * Reaching to the tags listing page. + */ + await adminPage.goto("admin/settings/tags"); + /** + * Clicking on the delete button for the first tag opens the modal. + */ + await adminPage.locator('//span[@class="icon-delete cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center"]').first().click(); + /** + * Clicking on the delete button in the modal. + */ + await adminPage.getByRole('button', { name: 'Agree', exact: true }).click(); + /** + * Checking if the tag is deleted successfully. + */ + await expect(adminPage.getByText('Tag deleted successfully')).toBeVisible(); + + /** + * Closing the modal. + */ + + await adminPage.close(); + + }) + + + + + +}) \ No newline at end of file diff --git a/packages/Webkul/Admin/tests/e2e-pw/tests/test-1.spec.ts b/packages/Webkul/Admin/tests/e2e-pw/tests/test-1.spec.ts new file mode 100644 index 000000000..a017a7fb5 --- /dev/null +++ b/packages/Webkul/Admin/tests/e2e-pw/tests/test-1.spec.ts @@ -0,0 +1,13 @@ +import { test, expect } from '@playwright/test'; + +test('test', async ({ page }) => { + await page.locator('body').click(); + await page.locator('body').press('Enter'); + await page.getByRole('link', { name: ' Settings' }).click(); + await page.getByRole('link', { name: ' Tags Add, edit or delete' }).click(); + await page.getByRole('button', { name: 'Create Tag' }).click(); + await page.getByRole('textbox', { name: 'Name' }).click(); + await page.getByRole('textbox', { name: 'Name' }).fill('tagname '); + await page.locator('span:nth-child(6) > .block').click(); + await page.getByRole('button', { name: 'Save Tag' }).click(); +}); \ No newline at end of file