Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Due to time zone issues, the e2e test cannot be passed #641

Closed
x1uc opened this issue Jan 3, 2025 · 4 comments · Fixed by #643 or #645
Closed

Due to time zone issues, the e2e test cannot be passed #641

x1uc opened this issue Jan 3, 2025 · 4 comments · Fixed by #643 or #645

Comments

@x1uc
Copy link
Contributor

x1uc commented Jan 3, 2025

Description

When I select a custom expiration time and choose "A day", it returns "A-1 day".
Some of the end-to-end tests set a custom expiration and then check its value.
For example:

// file-info.spec.ts:119~124
await expect(
  page
    .locator("section")
    .filter({ has: page.getByRole("heading", { name: "Expires" }) })
    .locator(".value")
).toHaveText(/2029-09-03 \(\d+ days\)/);

This is causing issues with passing some end-to-end tests.

Possible Reason

I believe this may be related to timezone issues. I am located in the UTC+8 timezone. I noticed that the formatDate function, which is intended to return an ISO date, might be the cause:

// expiration-picker.html: 36
function formatDate(date) {
  return date.toISOString().split("T")[0];
}

Screenshots

output
image

Environment

  • WSL2 + Ubuntu 22.04

However, I don't believe this is an environment issue, as the code I didn't modify also triggers errors on the CircleCI platform.
image

@mtlynch
Copy link
Owner

mtlynch commented Jan 4, 2025

Thanks for reporting this! Can you try #644 to see if it fixes it?

@mtlynch mtlynch reopened this Jan 4, 2025
@x1uc
Copy link
Contributor Author

x1uc commented Jan 4, 2025

It worked. It reduced the number of errors from 6 to 4. I looked at the code, and this piece of code is used twice, but you only modified one of the calls. If you modify the other part as well(handlers/view.go:182), it should pass the e2e test.
handlers/view.go:182
image

@mtlynch
Copy link
Owner

mtlynch commented Jan 4, 2025

If you modify the other part as well(handlers/view.go:182), it should pass the e2e test. handlers/view.go:182

Oh, good catch!

Can you submit a PR that confirms your hypothesis?

@x1uc
Copy link
Contributor Author

x1uc commented Jan 4, 2025

Of course!
Here is the PR link: #645
I am a beginner.Please remind me if there are any mistakes.

@mtlynch mtlynch closed this as completed in 8be4eea Jan 4, 2025
DmitroProciv pushed a commit to DmitroProciv/picoshare that referenced this issue Jan 4, 2025
Resolves mtlynch/picoshare#641

Related PR: mtlynch/picoshare#644

The above PR has largely addressed the corresponding issue, but there is
one missing part. This PR completes the missing part.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants