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

Split hooks and open hooks in ide from reporter #7821

Merged
merged 31 commits into from
Jul 7, 2020
Merged

Conversation

panzarino
Copy link
Contributor

@panzarino panzarino commented Jun 25, 2020

User facing changelog

  • Splits apart different hooks with the same name
  • Adds the ability to open a hook in your IDE

Additional details

Required a decently sized rewrite to the way that the reporter runnables store handles hooks

How has the user experience changed?

Before:

ezgif-6-0d2ecabdd439

After:

ezgif-6-a70bd14c3c95

PR Tasks

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 25, 2020

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jun 25, 2020



Test summary

7877 0 130 0


Run details

Project cypress
Status Passed
Commit f636507
Started Jul 7, 2020 2:15 PM
Ended Jul 7, 2020 2:27 PM
Duration 11:22 💡
OS Linux Debian - 10.1
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

@panzarino panzarino mentioned this pull request Jun 26, 2020
5 tasks
@panzarino panzarino changed the title Open individual hooks in ide from reporter Split hooks and open hooks in ide from reporter Jun 26, 2020
@panzarino panzarino marked this pull request as ready for review July 2, 2020 01:08
@panzarino
Copy link
Contributor Author

Marking ready for review, but still need to add e2e tests and decide the best way to handle a hook inside of a hook (which will fix the issue in the driver tests), for example: beforeEach(() => { beforeEach(() => {}) })

Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

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

The styling looks good to me. The Open in IDE button works and takes me where I would expect in the code.

I don't see before and after hooks being numbered. They are split correctly though. Any reason for this? I would probably expand the reporter tests to include some before and after hooks to also test this, looks like it's only testing beforeEach and afterEach now.

Screen Shot 2020-07-02 at 10 36 50 AM

@panzarino
Copy link
Contributor Author

@jennifer-shehane Not intentional, small bug. Should be fixed now.

@jennifer-shehane jennifer-shehane dismissed their stale review July 6, 2020 04:39

Great! The after/before hooks are now properly numbered. Going to dismiss my review for a more thorough review from @chrisbrieding

@jennifer-shehane jennifer-shehane removed their request for review July 6, 2020 04:39
Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

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

Look good - nice work!

@jennifer-shehane jennifer-shehane merged commit 7d468d4 into develop Jul 7, 2020
Comment on lines +134 to +154
const condenseHooks = (runnable, getHookId) => {
const hooks = _.compact(_.concat(
runnable._beforeAll,
runnable._beforeEach,
runnable._afterAll,
runnable._afterEach,
))

return _.map(hooks, (hook) => {
if (!hook.hookId) {
hook.hookId = getHookId()
}

if (!hook.hookName) {
hook.hookName = getHookName(hook)
}

return wrap(hook)
})
}

Copy link
Member

@brian-mann brian-mann Jul 11, 2020

Choose a reason for hiding this comment

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

lodash fp ftw...

const condenseHooks = (runnable, getHookId) => {
  return _
  .chain([
    runnable._beforeAll,
    runnable._beforeEach,
    runnable._afterAll,
    runnable._afterEach
  ])
  .compact()
  .tap((hook) => {
    if (!hook.hookId) {
      hook.hookId = getHookId()
    }

    if (!hook.hookName) {
      hook.hookName = getHookName(hook)
    }
  })
  .map(wrap)
  .value()
}

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.

Open hooks in IDE from reporter [TR-42] Split Hooks [TR-5]
4 participants