-
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(data-context): update runSpec mutation to support absolute spec path #26973
Conversation
5 flaky tests on run #47529 ↗︎
Details:
commands/net_stubbing.cy.ts • 2 flaky tests • 5x-driver-electron
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
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.
Looks good - testing it now, one question about how we get the path.
@@ -512,26 +512,27 @@ export class ProjectActions { | |||
|
|||
let targetTestingType: TestingType | |||
|
|||
// Get relative path from the specPath to determine which testing type from the specPattern | |||
const relativeSpecPath = this.ctx.path.normalize(specPath.substring(this.ctx.currentProject.length + 1, specPath.length)) |
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 think we can just use path.relative
here.
// eg...
path.relative("/a/b", "/a/b/c/d.js") //=> 'c/d.js'
So in this case it'd be:
path.relative(this.ctx.currentProject,specPath)
This way, you won't need to do the calculations to get the correct characters etc.
Quick test:
> curr
'/Users/lachlanmiller/code/work/cypress2/packages/launchpad'
> spec
'/Users/lachlanmiller/code/work/cypress2/packages/launchpad/src/setup/LaunchpadHeader.vue'
>
> path.relative(curr, spec)
'src/setup/LaunchpadHeader.vue'
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.
Ahhh, yes this was what I was trying to do. Still learning some of these node best practices. Thanks!
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.
Can we update the description of the GraphQL argument for the mutation to say that we're expecting an absolute path?
cypress/packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts
Lines 640 to 642 in 45f4b2f
specPath: nonNull(stringArg({ | |
description: 'Relative path of spec to run from Cypress project root - must match e2e or component specPattern', | |
})), |
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.
Looks good 👍🏻
Tested it out, works as expected 💯 |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Additional details
While working through the implementation on this issue I ran into a limitation with the current
runSpec
mutation that was implemented in this ticket. We need the mutation to work by passing in an absolutespecPath
. This PR adds support for thisSteps to test
Launch the app using
yarn dev
and open GraphQL. Run the following mutation using an absolutespecPath
:How has the user experience changed?
n/a
PR Tasks
cypress-documentation
?type definitions
?