Skip to content
Merged
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
36 changes: 19 additions & 17 deletions playwright/tests/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import fs from "fs";
import path from "path";

setup.describe.configure({ mode: "serial" });

const authenticateAndSaveState = async (
request: APIRequestContext,
email: string,
Expand All @@ -19,7 +17,7 @@
const loginJsonInfo = await request.storageState();

loginJsonInfo.origins.push({
origin: process.env.BASE_URL!,

Check warning on line 20 in playwright/tests/auth.setup.ts

View workflow job for this annotation

GitHub Actions / tsc-and-linters

Forbidden non-null assertion
localStorage: [
{
name: "_saleorRefreshToken",
Expand Down Expand Up @@ -48,20 +46,24 @@
}
};

setup("Authenticate as admin via API", async ({ request }) => {
await authSetup(
request,
process.env.E2E_USER_NAME!,
process.env.E2E_USER_PASSWORD!,
"admin.json",
);
});

const user: UserPermissionType = USER_PERMISSION;
const password: string = process.env.E2E_PERMISSIONS_USERS_PASSWORD!;
setup.describe(() => {
setup.describe.configure({ mode: "serial" });

for (const permission of permissions) {
setup(`Authenticate as ${permission} user via API`, async ({ request }) => {
await authSetup(request, user[permission], password, `${permission}.json`);
setup("Authenticate as admin via API", async ({ request }) => {
await authSetup(
request,
process.env.E2E_USER_NAME!,

Check warning on line 55 in playwright/tests/auth.setup.ts

View workflow job for this annotation

GitHub Actions / tsc-and-linters

Forbidden non-null assertion
process.env.E2E_USER_PASSWORD!,

Check warning on line 56 in playwright/tests/auth.setup.ts

View workflow job for this annotation

GitHub Actions / tsc-and-linters

Forbidden non-null assertion
"admin.json",
);
});
}

const user: UserPermissionType = USER_PERMISSION;
const password: string = process.env.E2E_PERMISSIONS_USERS_PASSWORD!;

Check warning on line 62 in playwright/tests/auth.setup.ts

View workflow job for this annotation

GitHub Actions / tsc-and-linters

Forbidden non-null assertion

for (const permission of permissions) {
setup(`Authenticate as ${permission} user via API`, async ({ request }) => {
await authSetup(request, user[permission], password, `${permission}.json`);
});
}
});
Loading