Browse Source

feat(testing): Cleanup

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
c361537e5e
  1. 4
      scripts/playwright/setup/server.ts
  2. 6
      scripts/playwright/tests/01-webhook.spec.ts
  3. 1
      scripts/playwright/tests/rolesCreate.spec.ts
  4. 8
      scripts/playwright/tests/rolesPreview.spec.ts

4
scripts/playwright/setup/server.ts

@ -46,12 +46,12 @@ async function makeServer() {
return new Promise((resolve) => {
const server = app.listen(port, function () {
const port = server.address().port;
console.log("Example app listening at port %d", port);
// console.log("Example app listening at port %d", port);
// close the server
const close = () => {
return new Promise((resolve) => {
console.log("closing server");
// console.log("closing server");
server.close(resolve);
});
};

6
scripts/playwright/tests/webhook.spec.ts → scripts/playwright/tests/01-webhook.spec.ts

@ -35,7 +35,7 @@ async function verifyHookTrigger(count: number, value: string, request) {
}
}
test.describe.skip("Webhook", async () => {
test.describe.serial("Webhook", async () => {
// start a server locally for webhook tests
let dashboard: DashboardPage, toolbar: ToolbarPage, webhook: WebhookFormPage;
@ -54,6 +54,7 @@ test.describe.skip("Webhook", async () => {
test("CRUD", async ({ request }) => {
// close 'Team & Auth' tab
await clearServerData({ request });
await dashboard.closeTab({ title: "Team & Auth" });
await dashboard.treeView.createTable({ title: "Test" });
@ -155,7 +156,8 @@ test.describe.skip("Webhook", async () => {
await verifyHookTrigger(0, "", request);
});
test("Conditional webhooks", async ({ request }) => {
test("webhook Conditional webhooks", async ({ request }) => {
await clearServerData({ request });
// close 'Team & Auth' tab
await dashboard.closeTab({ title: "Team & Auth" });
await dashboard.treeView.createTable({ title: "Test" });

1
scripts/playwright/tests/rolesCreate.spec.ts

@ -62,7 +62,6 @@ test.describe("User roles", () => {
// Role test
for (let i = 0; i < roleDb.length; i++) {
console.log("Role: ", roleDb[i].role);
await roleTest(i);
}
});

8
scripts/playwright/tests/rolesPreview.spec.ts

@ -48,7 +48,6 @@ test.describe("Preview Mode", () => {
// Role test
for (let i = 0; i < roles.length; i++) {
console.log("Role: ", roles[i]);
await roleTest(roles[i]);
}
});
@ -63,41 +62,34 @@ test.describe("Preview Mode", () => {
// wait for preview mode to be enabled
await dashboard.rootPage.locator(".nc-preview-btn-exit-to-app").waitFor();
console.log("project menu");
await dashboard.validateProjectMenu({
role: role.toLowerCase(),
});
await dashboard.treeView.openTable({ title: "Country" });
console.log("view sidebar");
await dashboard.viewSidebar.validateRoleAccess({
role: role.toLowerCase(),
});
console.log("toolbar");
await toolbar.validateRoleAccess({
role: role.toLowerCase(),
});
console.log("tree view");
await dashboard.treeView.validateRoleAccess({
role: role.toLowerCase(),
});
console.log("grid");
await dashboard.grid.validateRoleAccess({
role: role.toLowerCase(),
});
await dashboard.grid.openExpandedRow({ index: 0 });
console.log("expanded row");
await dashboard.expandedForm.validateRoleAccess({
role: role.toLowerCase(),
});
// Access control validation
console.log("access control");
await dashboard.treeView.verifyTable({
title: "Language",
exists: role.toLowerCase() === "creator" ? true : false,

Loading…
Cancel
Save