Skip to content

Commit

Permalink
fix: frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed Sep 15, 2024
1 parent 9545475 commit e0be246
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 30 deletions.
30 changes: 15 additions & 15 deletions izanami-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion izanami-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@playwright/test": "^1.41.1",
"@playwright/test": "^1.47.1",
"@types/node": "^20.12.11",
"@types/react-dom": "^18.3.0",
"@types/swagger-ui": "^3.52.4",
Expand Down
3 changes: 3 additions & 0 deletions izanami-frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const STORAGE_STATE = path.join(__dirname, "playwright/.auth/user.json");
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
timeout: 120_000,
expect: { timeout: 10_000 },
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
Expand Down Expand Up @@ -45,6 +47,7 @@ export default defineConfig({
name: "chromium",
dependencies: ["setup"],
use: { ...devices["Desktop Chrome"], storageState: STORAGE_STATE },
fullyParallel: true,
},

/*{
Expand Down
20 changes: 16 additions & 4 deletions izanami-frontend/src/components/GenericTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function GenericTable<T extends RowData>(props: TProps<T>) {
aria-expanded="false"
aria-label="actions"
>
<i className="bi bi-three-dots-vertical" aria-label="actions"></i>
<i className="bi bi-three-dots-vertical"></i>
</button>
<ul className="dropdown-menu">{actionList}</ul>
</div>
Expand Down Expand Up @@ -287,11 +287,23 @@ export function GenericTable<T extends RowData>(props: TProps<T>) {
let sortIcon = <></>;
const sorted = header.column.getIsSorted();
if (sorted === "desc") {
sortIcon = <i className="bi bi-arrow-down ms-2" aria-label="move down"></i>;
sortIcon = (
<i
className="bi bi-arrow-down ms-2"
aria-label="move down"
></i>
);
} else if (sorted === "asc") {
sortIcon = <i className="bi bi-arrow-up ms-2" aria-label="move up"></i>;
sortIcon = (
<i className="bi bi-arrow-up ms-2" aria-label="move up"></i>
);
} else if (header.column.getCanSort()) {
sortIcon = <i className="bi bi-arrow-down-up ms-2" aria-label="move"></i>;
sortIcon = (
<i
className="bi bi-arrow-down-up ms-2"
aria-label="move"
></i>
);
}
return (
<th
Expand Down
6 changes: 3 additions & 3 deletions izanami-frontend/tests/features.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ test.use({

async function featureAction(page: Page, name: string) {
await page.getByLabel("actions").click();
if ((await page.getByRole("link", { name: name }).count()) === 0) {
/*if ((await page.getByRole("link", { name: name }).count()) === 0) {
await page.getByLabel("actions").click();
}
await page.getByRole("link", { name: name }).click();
}*/
await page.getByRole("link", { name: name }).click({ force: true });
}

test.describe("Project screen should", () => {
Expand Down
5 changes: 1 addition & 4 deletions izanami-frontend/tests/tenants.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ test.use({
});

async function createTenant(page: Page, tenant: string) {
Promise.race([
page.getByRole("button", { name: "create a new tenant" }).click(),
page.getByRole("button", { name: "Create new tenant" }).click(),
]);
await page.getByRole("button", { name: "Create new tenant" }).click();

await page.getByLabel("Tenant name").fill(tenant);
await page.getByRole("button", { name: "Save" }).click();
Expand Down
8 changes: 5 additions & 3 deletions izanami-frontend/tests/webhooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ test.use({

async function webhookAction(page: Page, name: string) {
await page.getByLabel("actions").click();
if (
/*if (
(await page.getByRole("link", { name: name, exact: true }).count()) === 0
) {
await page.getByLabel("actions").click();
}
await page.getByRole("link", { name: name, exact: true }).click();
}*/
await page
.getByRole("link", { name: name, exact: true })
.click({ force: true });
}

test.describe("Webhook screen should", () => {
Expand Down

0 comments on commit e0be246

Please sign in to comment.