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

Replace cypress open, cypress run references with appropriate command #5019

Closed
flotwig opened this issue Aug 21, 2019 · 9 comments
Closed

Replace cypress open, cypress run references with appropriate command #5019

flotwig opened this issue Aug 21, 2019 · 9 comments
Labels
good first issue Good for newcomers pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory pkg/server This is due to an issue in the packages/server directory stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period type: user experience Improvements needed for UX

Comments

@flotwig
Copy link
Contributor

flotwig commented Aug 21, 2019

Current behavior:

Cypress recommends users to run cypress open or cypress run in different ways. For example:

<ol>
<li>
<span>Quit this app.</span>
</li>
<li>
<span>If using npm, run <code>npm install --save-dev cypress@{appStore.newVersion}</code></span>
<br/>
<span>If using yarn, run <code>yarn add cypress@{appStore.newVersion}</code></span>
</li>
<li>
<span>Run <a href='#' onClick={this._openCyOpenDoc}><code>node_modules/.bin/cypress open</code></a> to open the new version.</span>
</li>
</ol>

when "NOT_LOGGED_IN"
"""
You're not logged in.
Run `cypress open` to open the Desktop App and log in.
"""

<pre>
<code>cypress run --record --key {this.state.recordKey || '<record-key>'}</code>
</pre>

<p className='text-muted'>
To record, run this command:
</p>
<p>
<pre><code>cypress run --record --key {this.key.id}</code></pre>
</p>

when "RECORD_KEY_MISSING"
"""
You passed the --record flag but did not provide us your Record Key.
You can pass us your Record Key like this:
#{chalk.blue("cypress run --record --key <record_key>")}
You can also set the key as an environment variable with the name CYPRESS_RECORD_KEY.
https://on.cypress.io/how-do-i-record-runs
"""

when "PROJECT_ID_AND_KEY_BUT_MISSING_RECORD_OPTION"
"""
This project has been configured to record runs on our Dashboard.
It currently has the projectId: #{chalk.green(arg1)}
You also provided your Record Key, but you did not pass the --record flag.
This run will not be recorded.
If you meant to have this run recorded please additionally pass this flag.
#{chalk.blue("cypress run --record")}
If you don't want to record these runs, you can silence this warning:
#{chalk.yellow("cypress run --record false")}
https://on.cypress.io/recording-project-runs
"""

when "CYPRESS_CI_DEPRECATED"
"""
You are using the deprecated command: #{chalk.yellow("cypress ci <key>")}
Please switch and use: #{chalk.blue("cypress run --record --key <record_key>")}
https://on.cypress.io/cypress-ci-deprecated
"""
when "CYPRESS_CI_DEPRECATED_ENV_VAR"
"""
1. You are using the deprecated command: #{chalk.yellow("cypress ci")}
Please switch and use: #{chalk.blue("cypress run --record")}
2. You are also using the environment variable: #{chalk.yellow("CYPRESS_CI_KEY")}
Please rename this environment variable to: #{chalk.blue("CYPRESS_RECORD_KEY")}
https://on.cypress.io/cypress-ci-deprecated
"""

Desired behavior:

  • If the user has node_modules/.bin in their $PATH, recommend cypress [command]
  • If the user is using yarn, recommend yarn cypress [command] (this works?)
  • If the user has npx, recommend npx cypress [command]
  • Else, recommend ./node_modules/.bin/cypress [command]
@flotwig flotwig added the type: user experience Improvements needed for UX label Aug 21, 2019
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Aug 21, 2019
@jennifer-shehane jennifer-shehane added good first issue Good for newcomers pkg/server This is due to an issue in the packages/server directory pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory labels Jan 6, 2020
@sarthakkundra
Copy link

Hi. I would like to work on this issue. Can you please confirm if the commands mentioned in the desired behavior are correct? This will be my first open source contribution so I'd appreciate it if you can tell me if I'm doing anything wrong. Thanks.

@flotwig
Copy link
Contributor Author

flotwig commented Jun 10, 2020

@sarthakkundra the only unknown is if yarn cypress ... is the correct invocation for yarn users or not

@sainthkh
Copy link
Contributor

yarn cypress doesn't work when package.json doesn't have the "script" whose name is "cypress".

In yarn 2, there is a yarn dlx command. You can use it for this purpose. And the issue was debated over 2 years at here. And it is not backported and it seems that it will be.

@merceyz
Copy link

merceyz commented Jan 6, 2021

yarn cypress doesn't work when package.json doesn't have the "script" whose name is "cypress".

That's not true, it will execute the package with that binary name in the project, it wont however go download and install cypress globally to then invoke it

@Celinarabe
Copy link

Is this issue still open? If yes, I can work on it! :)

@sainthkh
Copy link
Contributor

@Celinarabe PRs are always welcome!

@devtayls
Copy link

devtayls commented Apr 17, 2021

Update:

  • Some of the files listed in the original issue have been replaced or are no longer extant
  • The commands listed in the source have been changed since the issue was posted

File Changes:

/update/update-banner.jsx is now ../update/update-instructions.

<UpgradeCommand packageManager='npm' command={`npm install --save-dev cypress@${updateStore.newVersion}`} />
<UpgradeCommand packageManager='yarn' command={`yarn upgrade cypress@${updateStore.newVersion}`} />

The text is now passed to the <UpgradeCommand command={} /> prop.
For npm: npm install --save-dev cypress@{some_version}
For yarn: yarn upgrade cypress@{some_version}

/lib/errors.coffee is now ../lib/errors.js

case 'RECORD_KEY_MISSING':
return stripIndent`\
You passed the --record flag but did not provide us your Record Key.
You can pass us your Record Key like this:
${chalk.blue('cypress run --record --key <record_key>')}
You can also set the key as an environment variable with the name CYPRESS_RECORD_KEY.
https://on.cypress.io/how-do-i-record-runs`

case 'PROJECT_ID_AND_KEY_BUT_MISSING_RECORD_OPTION':
return stripIndent`\
This project has been configured to record runs on our Dashboard.
It currently has the projectId: ${chalk.green(arg1)}
You also provided your Record Key, but you did not pass the --record flag.
This run will not be recorded.
If you meant to have this run recorded please additionally pass this flag.
${chalk.blue('cypress run --record')}
If you don't want to record these runs, you can silence this warning:
${chalk.yellow('cypress run --record false')}
https://on.cypress.io/recording-project-runs`

The command text remains the same here as in the OP issue.

Files without changes:

####cypress/packages/desktop-gui/src/settings/record-key.jsx

const recordCommand = `cypress run --record --key ${this.state.recordKey || '<record-key>'}`

For Further Discussion:

These commands might change in the future, therefore I think it might be wise to store the data in an abstracted format so we can avoid this issue arising again.

Secondly, would it make sense to incorporate some logic to check for the underlying conditions and then show the relevant command to the user? There is already a component in the @cypress/desktop-gui package, that is performing UI logic on the commands. That might be a good basis for the feature extension.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 17, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers pkg/desktop-gui This is due to an issue in the packages/desktop-gui directory pkg/server This is due to an issue in the packages/server directory stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period type: user experience Improvements needed for UX
Projects
None yet
Development

No branches or pull requests

8 participants