-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
chore: fix tests that fail on windows #21055
Conversation
Thanks for taking the time to open a PR!
|
|
||
// windows returns a leading carriage return, remove it | ||
const [, ...stdout] = split | ||
let output: string[] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More reliable way to pass shell command output.
const split = result.stdout | ||
.split('\r\n') // windows uses CRLF for carriage returns | ||
.filter((str) => !str.includes('git log')) // windows stdout contains [cmd,output]. So we remove the code containing the executed command, `git log` | ||
const stdout = normalize(result.stdout).split('\r\n') // windows uses CRLF for carriage returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the problem, /
vs \
.
Def need to standardize how we handle this internally. At least w/ this PR we have more coverage and confidence across all OSes, for when we do try to standardize this (if we need to make changes, maybe we don't).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... maybe a guides/
would be good. Maybe a guide all about platform differences, not just paths?
In general, I think it should work like this:
- We should always use the native path if it is being displayed to the user. Unless it's displayed in a place where it may be shared cross-platform in a programmatic way (like
require(path)
,import path
, or in the URL bar) - We should always use the native path internally unless the library does not support it (like in
globby
, where\
acts as an escape character.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guides + trusted windows tests would be a good place to start. Shared utils/libs to handle the translation when necessary could help too.
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
const split = result.stdout | ||
.split('\r\n') // windows uses CRLF for carriage returns | ||
.filter((str) => !str.includes('git log')) // windows stdout contains [cmd,output]. So we remove the code containing the executed command, `git log` | ||
const stdout = normalize(result.stdout).split('\r\n') // windows uses CRLF for carriage returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... maybe a guides/
would be good. Maybe a guide all about platform differences, not just paths?
In general, I think it should work like this:
- We should always use the native path if it is being displayed to the user. Unless it's displayed in a place where it may be shared cross-platform in a programmatic way (like
require(path)
,import path
, or in the URL bar) - We should always use the native path internally unless the library does not support it (like in
globby
, where\
acts as an escape character.
What do you think?
// should update via GraphQL subscription, now the status is modified. | ||
cy.get('[data-cy-row="dom-container.spec.js"]') | ||
.contains('Modified') | ||
.get('[data-cy="git-status-modified"]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on the additional coverage 👍
Co-authored-by: Zach Bloomquist <git@chary.us>
…ress into lmiller1990/windows-fails
…ress into lmiller1990/windows-fails
circle.yml
Outdated
@@ -1189,6 +1189,8 @@ jobs: | |||
parallelism: 1 | |||
steps: | |||
- restore_cached_workspace | |||
- run: mkdir -p ~/.ssh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wish I knew why this was necessary (still looking). The problem seems to only be happening on my PRs
@@ -0,0 +1,85 @@ | |||
# Remaining Platform Agnostic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Writing Cross-Platform JavaScript" might be a clearer title, or something along those lines? Thanks for adding this, now we have something to point to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
@@ -67,7 +67,7 @@ | |||
:id="getIdIfDirectory(row)" | |||
:key="row.index" | |||
:data-cy="row.data.isLeaf ? 'spec-list-file' : 'spec-list-directory'" | |||
:data-cy-row="row.data.data?.relative" | |||
:data-cy-row="row.data.data?.baseName" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to note that using baseName here doesn't guarantee uniqueness like relative did. Doesn't seem like it impacts any current tests, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - I think it's probably fine for now, actually updating the paths is a bit of scope creep, and changing the paths dynamically for the assertion seems like more technical debt. This seems like a reasonable trade-off.
|
||
// TODO: Move this into packages/error post merge: https://github.com/cypress-io/cypress/pull/20072 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO worth persisting/doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix actually negates the rationale for the TODO (which is nice). This scenarios is now handled by this catch block:
which properly displays the appropriate error.
Co-authored-by: Zach Bloomquist <git@chary.us>
I have responded to the comments
|
…s-io/cypress into lmiller1990/windows-fails
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
…e-config * 10.0-release: chore: Move component-index generation to scaffold-config package (#21090) fix: label text should be clickable to toggle snapshot highlight (#21122) feat: add next preset to webpack-dev-server-fresh (#21069) chore: add dev-servers as deps to server to be included in the binary (#21142) fix: do not highlight preExtension if selected option is renameFolder (#21121) fix(unify): Remove 'Reconfigure' dropdown from Testing Type chooser (#21063) feat(unify): launchpad header breadcrumbs and reusable tooltip component (#20648) test: add windows-test-kitchensink job (#20847) fix: aut centering and height calculation (#21019) chore: fix tests that fail on windows (#21055) fix: running a new test after already having run tests (#21087) fix: ct project setup framework keys for next and nuxt (#21116) fix: remove MountReturn from scaffolded ct support file (#21119) fix: do not scaffold fixtures if folder exist (#21078) fix: revert "fix: types for Cypress.Commands.add (#20376)" (#21104) chore: Update Chrome (stable) to 100.0.4896.127 and Chrome (beta) to 101.0.4951.34 (#21083) fix: types for Cypress.Commands.add (#20376) (#20377)
User facing changelog
Fixes some flaky tests.
Additional details
/
vs\
on different OSscypress --browser chrome
which primarily manifested on windowsHow has the user experience changed?
Tests pass on windows.
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?