Skip to content

Commit

Permalink
πŸš‘
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Feb 25, 2024
1 parent 2ee7d08 commit 41164f0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/app/components/Lines/FlyingLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { ILocation } from "@tzr/location-index";
import { css } from "@linaria/core";

type Props = { location: ILocation; t: number };
export const FlyingLabel = () => (
<Container>
export const FlyingLabel = (props: React.ComponentProps<typeof Container>) => (
<Container {...props}>
<span />
<span />
<span />
Expand Down
2 changes: 1 addition & 1 deletion packages/app/components/Lines/Lines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Lines = () => {
id={`location-item-${location.key}`}
onClick={() => selectLocation(location)}
>
<FlyingLabel />
<FlyingLabel data-test-id="flying-date" />

{blocks[i].map(({ day, awake, office }, i) => (
<React.Fragment key={i}>
Expand Down
32 changes: 21 additions & 11 deletions packages/e2e/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,34 @@ test("Should be able to move slider", async ({ page }) => {
await page.getByLabel("date picker").fill("2024-02-01");
await page.getByLabel("date picker").press("Enter");

await expect(page.getByText("February 1 at 12:00 PM")).toBeVisible();
const flyingDateLocator = page.locator(`[data-test-id="flying-date"]`);

{
const date = await flyingDateLocator.textContent();
expect(date).toBe("February 1 at 12:00β€―PM");
}

await expect(page.getByLabel("avatar in the pose day")).toBeVisible();

//
const sliderLocator = page.getByLabel("date slider");
// slide 300px left
{
const sliderLocator = page.getByLabel("date slider");

await expect(sliderLocator).toBeVisible();
await expect(sliderLocator).toBeVisible();

const bb0 = (await sliderLocator.boundingBox())!;
const p0 = { x: bb0.x + bb0.width / 2, y: bb0.y + bb0.height / 2 };
const bb0 = (await sliderLocator.boundingBox())!;
const p0 = { x: bb0.x + bb0.width / 2, y: bb0.y + bb0.height / 2 };

await page.mouse.move(p0.x, p0.y);
await page.mouse.down();
await page.mouse.move(p0.x + 300, p0.y);
await page.mouse.up();
await page.mouse.move(p0.x, p0.y);
await page.mouse.down();
await page.mouse.move(p0.x + 300, p0.y);
await page.mouse.up();
}

await expect(page.getByText("February 2 at 5:30 AM")).toBeVisible();
{
const date = await flyingDateLocator.textContent();
expect(date).toBe("February 2 at 5:30β€―AM");

Check failure on line 93 in packages/e2e/tests/app.spec.ts

View workflow job for this annotation

GitHub Actions / e2e / e2e (1/1, chromium)

[chromium] β€Ί app.spec.ts:60:5 β€Ί Should be able to move slider

1) [chromium] β€Ί app.spec.ts:60:5 β€Ί Should be able to move slider ───────────────────────────────── Error: expect(received).toBe(expected) // Object.is equality Expected: "February 2 at 5:30β€―AM" Received: "February 2 at 5:00β€―AM" 91 | { 92 | const date = await flyingDateLocator.textContent(); > 93 | expect(date).toBe("February 2 at 5:30β€―AM"); | ^ 94 | } 95 | 96 | await expect(page.getByLabel("avatar in the pose night")).toBeVisible(); at /home/runner/work/timezone-rocks/timezone-rocks/packages/e2e/tests/app.spec.ts:93:18
}

await expect(page.getByLabel("avatar in the pose night")).toBeVisible();
});

1 comment on commit 41164f0

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.