Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardZaydler committed Dec 10, 2024
1 parent ea33731 commit 615e8e4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 3 additions & 1 deletion playwright/e2eTests/teamsOperations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test("Add team", async ({ page, teamName, teamDescription, teamsPage }) => {
});

test("Edit team description", async ({ page, teamDescription, teamsPage, teamName }) => {
await teamsPage.teamCardKebab.click();
await teamsPage.editTeamButton.click();
await expect(teamsPage.nameInput("Team name")).toHaveValue(teamName);
await expect(teamsPage.teamDescription).toContainText(teamDescription);
Expand Down Expand Up @@ -64,7 +65,8 @@ test("Delete user", async ({ page, userName, teamsPage }) => {
});

test("Delete team", async ({ page, teamName, teamsPage }) => {
await teamsPage.deleteTeamButton(teamName + " changed").click();
await teamsPage.teamCardKebab.click();
await teamsPage.deleteTeamButton.click();
await page.getByRole("button", { name: "Confirm" }).click();
await expect(
page.locator(`:text("${teamName}"):right-of(span[data-tid='Delete team ${teamName}'])`)
Expand Down
3 changes: 1 addition & 2 deletions playwright/e2eTests/triggerOperations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ test("Set trigger maintenance for all intervals", async ({ triggerName, page })

const requestBody = JSON.parse(setMaintenanceRequest.postData() || "{}");
expect(requestBody).not.toBeNull();
expect(requestBody.trigger).toEqual(expectedTriggerTime);

expect(Math.abs(requestBody.trigger - expectedTriggerTime)).toBeLessThanOrEqual(1);
if (maintenance === Maintenance.off) {
await expect(page.getByText("Maintenance")).toBeVisible();
} else
Expand Down
8 changes: 5 additions & 3 deletions playwright/pages/teams.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@ export class TeamsPage {
readonly nameInput: (testId: string) => Locator;
readonly teamDescription: Locator;
readonly previewButton: Locator;
readonly teamCardKebab: Locator;
readonly editTeamButton: Locator;
readonly showUsersButton: Locator;
readonly addUserModalButton: Locator;
readonly deleteUserButton: (userName: string) => Locator;
readonly deleteTeamButton: (teamName: string) => Locator;
readonly deleteTeamButton: Locator;

constructor(page: Page) {
this.page = page;
this.addTeamButton = page.getByText("Add team");
this.nameInput = (testId) => page.locator(`label[data-tid='${testId}'] > span > input`);
this.teamDescription = page.locator("[data-tid='Team description']");
this.previewButton = page.getByText("Preview");
this.editTeamButton = page.getByRole("button", { name: "Edit Team" });
this.teamCardKebab = page.locator("[data-tid='Team card kebab']");
this.editTeamButton = page.getByRole("button", { name: "Edit" });
this.showUsersButton = page.getByText("Show users");
this.addUserModalButton = page.locator("[data-tid='Add user modal']");
this.deleteUserButton = (userName) => page.locator(`[data-tid="Delete user ${userName}"]`);
this.deleteTeamButton = (teamName) => page.locator(`[data-tid="Delete team ${teamName}"]`);
this.deleteTeamButton = page.getByRole("button", { name: "Delete" });
}

async gotoTeamsPage(): Promise<void> {
Expand Down
7 changes: 6 additions & 1 deletion src/Components/Teams/TeamCard/TeamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const TeamCard: FC<ITeamCardProps> = ({ team, isDeleting, onOpenDelete, o
className={cn("team-card")}
>
<Flexbox gap={5}>
<Kebab className={cn("team-card-kebab")} size="large">
<Kebab
data-tid="Team card kebab"
className={cn("team-card-kebab")}
size="large"
>
<MenuItem icon={<EditIcon />} onClick={openModal}>
Edit
</MenuItem>
Expand All @@ -100,6 +104,7 @@ export const TeamCard: FC<ITeamCardProps> = ({ team, isDeleting, onOpenDelete, o
onClick={handleConfirm}
use={"primary"}
width={100}
data-tid={`Delete team ${name}`}
>
Confirm
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/themes/useThemeFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useThemeFeature = () => {
const resultTheme = isSystemTheme ? browserTheme : localValue;

document.body.dataset.theme = resultTheme;
}, [localValue]);
}, [localValue, isBrowserDarkThemeEnabled]);

return useFeatureFlag<EThemesNames>({ ...ThemeFlag, defaultValue: localValue });
};

0 comments on commit 615e8e4

Please sign in to comment.