Skip to content

Tags management script #2177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 2.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -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();
}
);



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

})





})
13 changes: 13 additions & 0 deletions packages/Webkul/Admin/tests/e2e-pw/tests/test-1.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});