-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: test-recording instructions in Component Test mode #21422
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Failures
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 |
packages/app/cypress/e2e/runs.cy.ts
Outdated
@@ -1,6 +1,35 @@ | |||
import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json' | |||
import type { SinonStub } from 'sinon' | |||
|
|||
function scaffoldTestingTypeAndVisitRunsPage (testingType: 'e2e' | 'component') { | |||
if (testingType === 'component') { | |||
cy.scaffoldProject('component-tests') |
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 use the cypress-in-cypress
project? It has both testing types configured so we wouldn't have to create another system test project.
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.
Nice, I implemented this. It helped me clean up that helper function, turned out there was some old code that wasn't doing much, and it was just coincidental that the project IDs didn't have runs. Since cypress-in-cypress has runs, it surfaced the problem. The issue turned out to be cloudProjectBySlug
vs cloudProjectsBySlugs
which took a little time to figure out, but now the whole test passes and is more reliable, and we dropped the extra project.
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.
will merge when CI goes green
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.
Few minor comments, not blocking
@@ -58,7 +59,9 @@ const firstRecordKey = computed(() => { | |||
: '<record-key>' | |||
}) | |||
const recordCommand = computed(() => { | |||
return `cypress run --record --key ${firstRecordKey.value}` | |||
const componentFlagOrSpace = props.gql.currentTestingType === 'component' ? ' --component ' : ' ' |
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.
You could do a ['arg1', 'arg2'].join(' ')
here if you wanted to to remove the space addition.
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.
Code and percy snapshots look good 👍
* 10.0-release: (22 commits) fix: migrate multiples projects when in global mode (#21458) test: fix flaky cy-in-cy selector validity test (#21360) chore: remove unused codeGenGlobs (#21438) fix: use correct path for scaffolding spec on CT (#21411) fix: remove breaking options from testing type on migration (#21437) fix: test-recording instructions in Component Test mode (#21422) feat: distinguish app vs launchpad utm_source when using utm params (#21424) chore: update stubbed cloud types (#21451) chore: change to yarn registry fix(sessions): refactor flows, fix grouping bugs and align validation fail text (#21379) chore(sessions): more driver tests (#21378) chore: rename domain_fn to origin_fn (#21413) chore: release 9.6.1 (#21404) fix: ensure that proxy logs are updated after the xhr has actually completed (#21373) chore: Re-organize tests in assertions_spec.js (#21283) chore: Distribute tests to desktop-gui containers. Make `desktop-gui` tests faster! (#21305) chore(sessions): add additional tests (#21338) fix: Allow submit button to be outside of the form for implicit submission (#21279) fix(launcher): support Firefox as a snap (#21328) chore(sessions): break out sessions manager code and add unit tests (#21268) ...
User facing changelog
In component testing mode, when no runs have been recorded to the dashboard, the command to copy will now include the
--component
flag, so that we run in component testing mode.Additionally, the project root has been removed from the terminal prompt in all situations (per Brian's comment in this ticket). Terminal prompts now begin with
$
always, instead ofsome-project: $
.How has the user experience changed?
Before - a command is shown in component testing mode, but this command would run cypress in the default e2e mode, thus not record component tests:
After - correct command is shown for component testing (it includes the
--component
flag:How to test manually
Set up a project with no tests recorded in the dashboard and visit the runs page in the app, it should invite you to record your first run, and recommend the correct command for your testing type.
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?