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

Support --tag argument #5164

Merged
merged 32 commits into from
Dec 5, 2019
Merged

Support --tag argument #5164

merged 32 commits into from
Dec 5, 2019

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Sep 19, 2019

TODO

  • Bump json-schema endpoints to 2.2.0 for postRunRequest and postRunResponse
  • How should we handle cypress run --tag nightly and then running cypress run --tag staging in parallel, where the run will become a single run. I think that it should attribute both staging and nightly to the single run. We would be posting tags: ["nightly"] in one POST and then tags: ["staging"] in the 2nd POST. https://github.com/cypress-io/cypress-services/issues/1812

User facing changelog

Cypress now accepts a --tag argument to be used to distinguish separate runs. Any tags assigned will be shown on the run in the Cypress Dashboard.

Additional details

  • Accepting tag as singular, but always passing it as an Array to the cypress-api as tags
  • I tested this through staging with the Dashboard and confirmed it does display the tag in the Dashboard, so it is passed along correctly (tested with 1 and multiple tags)

How has the user experience changed?

Options are alphabetized + Tag option added to --help

Screen Shot 2019-11-13 at 1 59 44 PM

Error when passing space delimited --spec

Screen Shot 2019-11-13 at 1 58 51 PM

Error when passing space delimited --tag

Screen Shot 2019-11-26 at 3 10 47 PM

Tag added to beginning of recording run stdout

Displays as false by default.

1 tag:

Screen Shot 2019-11-26 at 3 04 49 PM

2 tags:

Screen Shot 2019-11-26 at 3 11 49 PM

Dashboard displays the tags in the Runs list (only implementation right now)

Screen Shot 2019-11-26 at 3 15 29 PM

PR Tasks

@cypress
Copy link

cypress bot commented Sep 19, 2019



Test summary

3551 0 45 0


Run details

Project cypress
Status Passed
Commit 15a8aa9
Started Dec 4, 2019 7:33 PM
Ended Dec 4, 2019 7:36 PM
Duration 03:40 💡
OS Linux Debian - 9.8
Browser Multiple

View run in Cypress Dashboard ➡️


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

@jennifer-shehane jennifer-shehane requested review from brian-mann and a team September 19, 2019 21:03
@jennifer-shehane jennifer-shehane changed the title [WIP] Support --tag argument Support --tag argument Sep 19, 2019
# Conflicts:
#	cli/__snapshots__/cli_spec.js
#	cli/lib/cli.js
# Conflicts:
#	cli/__snapshots__/cli_spec.js
#	cli/lib/cli.js
#	cli/lib/exec/run.js
#	packages/server/lib/modes/run.js
#	packages/server/lib/util/args.js
@jennifer-shehane jennifer-shehane changed the title Support --tag argument [WIP] Support --tag argument Oct 25, 2019
# Conflicts:
#	packages/server/lib/modes/run.js
@jennifer-shehane
Copy link
Member Author

jennifer-shehane commented Nov 13, 2019

Need to make an update based on this comment https://github.com/cypress-io/cypress-services/pull/1566#discussion_r339094829 to change sending tag to tags to the cypress-api

We are calling it tag to the user in the Test Runner (as this matches the same convention as the spec flag. But it appears when we communicate to the API later, it is changed to specs, so I am fine with us using tags here since I believe we've already normalized it into an array.

/pull/5164/files#diff-f558bdd26d5a0b4043bae0b9dc251e9fR291

@jennifer-shehane
Copy link
Member Author

I tested this in staging and it is working, so the failed tests are likely just some weird snapshot diffs that need reconciling.

@jennifer-shehane jennifer-shehane changed the title [WIP] Support --tag argument Support --tag argument Nov 27, 2019
context "--tag", ->
it "converts to array", ->
options = @setup("--run-project", "foo", "--tag", "nightly,production,build")
expect(options.tag[0]).to.eq("nightly")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use single assertion here for complete message on error

expect(options.tag).to.deep.equal(['nightly', 'production', 'build'])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@bahmutov bahmutov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed, ran tests, added more tests, tested against staging - all seems 👍

@jennifer-shehane jennifer-shehane merged commit 692a3c0 into develop Dec 5, 2019
avallete pushed a commit to avallete/cypress that referenced this pull request Dec 10, 2019
* Alphabetize cli options for my own sanity

* begin added tag flag

* Fix some minor grammar in cli help output + be more specific for specs description

* update snapshot based on alphabetization change

* update snapshot to include --tag in help output

* update logic for pulling out space delimited args to look through --tag and --spec flags dynamically

* Support and pass along tag flag to run and record

- show err if passed without record flag
- sanitize args into comma separated string
- display tag in record errors

* fix some tests/snapshots where 'tag' was missing

* Actually try passing in tag through tests to ensure it prints.

* Merge branch 'develop' into issue-2561-tags

# Conflicts:
#	cli/__snapshots__/cli_spec.js
#	cli/lib/cli.js
#	cli/lib/exec/run.js
#	packages/server/lib/modes/run.js
#	packages/server/lib/util/args.js

* Send 'tags' as an array to backend API

* Update json-schemas to query against 2.2.0 of postRun

- this will require a bump to json-schemas repo

* update test to reflect tags array

* update snapshot to display nightly tag

* rearrange args to alphabetical order in specs

* Add tags to runResponses / remove tag from incorrect instance post

* Fix failing specs / snapshots

* Update error messages + snapshots

* Fix snapshot that no longer displays tag arg

* fix args unit test

* remove extra slash

* add a few more cli tests

* another test just in case

* a quick unit test for displayFlags utility


Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to add tag to run to display in 'Runs' list in Dashboard UI
3 participants