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

Disabled TableColumnDateText tests on WebKit due to date formatting differences #1940

Closed
jattasNI opened this issue Mar 15, 2024 · 7 comments · Fixed by #1959
Closed

Disabled TableColumnDateText tests on WebKit due to date formatting differences #1940

jattasNI opened this issue Mar 15, 2024 · 7 comments · Fixed by #1959
Assignees

Comments

@jattasNI
Copy link
Contributor

jattasNI commented Mar 15, 2024

🧹 Tech Debt

Several TableColumnDateText tests have been disabled on WebKit due to errors like this:

Expected 'Dec 10, 2012 at 10:35:05 PM' to be 'Dec 10, 2012, 10:35:05 PM'.

We need to either fix and re-enable the tests or file an issue upstream (e.g. to webkit) and mark this blocked.

Search for this bug ID in source for a complete list of such tests.

@jattasNI jattasNI added tech debt triage New issue that needs to be reviewed labels Mar 15, 2024
rajsite added a commit that referenced this issue Mar 18, 2024
# Pull Request

## 🤨 Rationale

One of the tasks in #1747 is to run nimble-components tests in WebKit
and see if there are any new failures. There are several.

We also wanted to start tracking specific issues for each root cause
rather than catch all issues like #1074 and #1075.

## 👩‍💻 Implementation

Marked each failing test with one of these specific issues:
- #1936
- #1938 TODO: ALSO FILE AZDO BUG
- #1939 
- #1940 
- #1942 
- #1943

Also re-enabled a couple of table header tests in Firefox which are now
passing.

## 🧪 Testing

Ran tests in Playwright webkit browser, Firefox, and Safari and and all
the enabled tests now pass.

## ✅ Checklist

<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.

---------

Co-authored-by: Milan Raj <[email protected]>
@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Mar 19, 2024
@mollykreis
Copy link
Contributor

@jattasNI, it's interesting that these tests are failing for you. When I run npm run test-webkit locally with all the #SkipWebkit tags removed, I don't see any test failures for the date-text column. How did you run the tests when you saw the failures? Did you run them locally? If so, I'm assuming that was on a mac?

@jattasNI
Copy link
Contributor Author

jattasNI commented Mar 22, 2024

@mollykreis My system setup is:
macOS 14.3
Safari Version 17.3 (19617.2.4.11.8)
Playwright webkit browser
I previously had my system locale set to "en-CA" and thought that might have been the cause of the difference, but changing it to "en-US" made no difference. The tests fail in both Safari and Playwright locally because of the "at" vs "," difference.

It appears to be a behavior difference in the Intl.DateTimeFormat in WebKit, but only on macOS?

@mollykreis
Copy link
Contributor

mollykreis commented Mar 22, 2024

That's interesting. They pass on my machine (Windows 10), and I just verified that they pass on the GitHub pipeline.

Any thoughts on the best way to resolve the issue? Should I close it since it passes on the pipeline?

@rajsite
Copy link
Member

rajsite commented Mar 22, 2024

For other formatting differences we have been capturing it in pageObjects. II can't find the example anymore but that would be nice to do to enable devs across platform

@jattasNI
Copy link
Contributor Author

Yeah, ideally we'll find a way to enable the tests so they pass on Windows dev machines, macOS dev machines, and Linux agents. I'd find it annoying if they were permanently disabled or failing on the OS I use for dev.

I don't recall the browser-specific page object example Milan mentioned. It'd be cool to abstract away like that, but I'm not sure how it'd work since our page objects usually have methods like getRenderedText(). Would we instead expose methods like containsRenderedText(segments: string[]) and call it like containsRenderedText(['Dec 10, 2012', '10:35:05 PM'])? That slightly weakens the assert we're making but maybe it's good enough.

Another alternative would be to create one test that's permanently disabled (via tags like SkipWebkit) on certain configurations and a corresponding test that's permanently enabled on the inverse configuration. But that might require new tags like SkipMacOS/SkipWindows and new commands for running them. I could see that getting complex.

@mollykreis mollykreis self-assigned this Mar 25, 2024
@rajsite
Copy link
Member

rajsite commented Mar 25, 2024

I don't recall the browser-specific page object example Milan mentioned.

This formatting normalizer used by duration and date columns was what I had in mind. It handles both a difference in chrome (not mentioned in the comments) and a difference across languages inside the page object:

// When text is localized to different languages, the space character
// can get changed to a different unicode variant. This regular expression
// matches both known unicode variants so we can change them back to a
// regular space to perform consistent checks for testing purposes.
private readonly spaceUnicodeCharsRegEx = /\u202f|\u00a0/g;

@rajsite
Copy link
Member

rajsite commented Mar 25, 2024

The important detail being having the page object hide browser-specific details, not having different page objects per browser or something.

@jattasNI jattasNI moved this from Backlog to In progress in Nimble Design System Priorities Mar 27, 2024
mollykreis added a commit that referenced this issue Mar 28, 2024
# Pull Request

## 🤨 Rationale

Resolves #1940 

## 👩‍💻 Implementation

Added a page object function to get the expected cell text for a given
value/locale combination. The function internally uses
`Intl.DateTimeFormat` to determine the expected text, so that it will
always return the correct value for a given browser. With this change,
the tests still test all the column, cell, and group row formatting code
without actually testing the nuances of the string returned from
`Intl.DateTimeFormat`.

## 🧪 Testing

Ran the tests for the date-text column in WebKit on my machine (Windows
10) and on the pipeline to verify they pass on both.

## ✅ Checklist

<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->

- [ ] I have updated the project documentation to reflect my changes or
determined no changes are needed.
@m-akinc m-akinc moved this from In progress to Done in Nimble Design System Priorities Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants