Skip to content

Conversation

@olekszczepanowski
Copy link
Member

@olekszczepanowski olekszczepanowski commented Jul 24, 2025

bez logowania

  • tworzenie, edycja, usuwanie i udostępnianie planów
  • pobieranie planów w różnych formatach
  • feedback form

Important

Add end-to-end tests for course planning features using Playwright, including plan creation, editing, deletion, sharing, and feedback form validation.

  • Testing:
    • Adds end-to-end tests in tests/tests.spec.ts for creating, editing, deleting, and sharing plans.
    • Tests downloading plans as .png and .ics files.
    • Tests feedback form validation for email, title, and description.
  • Configuration:
    • Adds Playwright configuration in playwright.config.ts.
    • Updates .gitignore to include Playwright-related files.
    • Adds @playwright/test to devDependencies in package.json.
  • Components:
    • Adds data-testid attributes to buttons in page.client.tsx, plan-display-link.tsx, and plan-item.tsx for testability.
    • Updates validation messages in schemas.ts for feedback form.

This description was created by Ellipsis for f5fa3e9. You can customize this summary. It will automatically update as commits are pushed.

@olekszczepanowski olekszczepanowski marked this pull request as ready for review July 25, 2025 13:37
Copy link
Member

@Rei-x Rei-x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spoko teściki napisane, sporo rzeczy zostało przetestowane, jedyne czego mi brakuje to jakiejś miłości do organizacji tych testów, wszystko jest w jednym pliku i nie ma żadnych describe ani nic 😭

dodatkowo raczej nie powinno się używać testId oraz locatorów - sugeruje to, że masz mało dostępny kodzik


await chosenFaculty.click();

const registrationButton = page.locator('button[name="registration"]');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raczej nie powinno się używać locatora, jak jest taka opcja to użyj getByRole (i popraw kod, żeby dało się go użyć)

@@ -0,0 +1,22 @@
import type { Page } from "@playwright/test";

export const selectFacultyAndRegistration = async (page: Page) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

żeby zrobić reużywalny kodzik w playwrighcie popularny jest POM (Page Object Model) - zachęcam do poczytania sobie:3

test("should show empty plans page without logging in on first visit", async ({
page,
}) => {
await page.goto(BASE_URL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mogłeś to sobie w opcje playwrighta wrzucić, wtedy mógłbyś tu tylko dać:

Suggested change
await page.goto(BASE_URL);
await page.goto("/");

https://playwright.dev/docs/api/class-testoptions#test-options-base-url

page,
}) => {
await page.goto(`${BASE_URL}/plans`);
await page.getByTestId("add-new-plan-button").click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oj, używanie testId to powinna być ostateczność, raczej wypadałoby przerobić ten kod albo test, żeby najlepiej używać getByRole

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mogłeś ten plik podzielić na parę różnych zamiast robić jeden duży o nazwie "tests" 😭

import { BASE_URL, INVALID_EMAIL, VALID_EMAIL } from "./utils/const";
import { selectFacultyAndRegistration } from "./utils/helpers";

test("should show empty plans page without logging in on first visit", async ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brakuje mi jakichś test.describe tutaj, wszystko jest wrzucone do jednego worka i nie wiadomo co do czego jest

page,
}) => {
await page.route(
"**/departments/*/registrations/*/courses",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

da się też w ogóle msw w playwrightcie używać jakbyś był ciekawy: https://github.com/mswjs/playwright

await expect(firstSelectedCourse).toBeVisible();

await page.getByText(/skopiuj/i).click();
await page.waitForTimeout(2000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no raczej coś takiego to powinna być ostateczność, lepiej używaj jakichś expect.poll albo zwiększ timeout na domyślnym czekaniu playwrighta

await page.goto(BASE_URL);
await page.getByText(/błąd/i).click();

const emailInput = page.locator('input[name="email"]');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tutaj raczej po labelu lepiej się dostać

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants