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

Hovering on the video doesn't play the video. Clicking on the video opens a new tab #14757

Closed
sinthujan24 opened this issue Jan 27, 2021 · 16 comments
Labels
stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period topic: cy.click 🖱 type: bug

Comments

@sinthujan24
Copy link

sinthujan24 commented Jan 27, 2021

Current behavior

  1. Hovering on a video tile doesn't play the video as expected
  2. Clicking on the video opens a new tab (Expected to open the video player on the same screen)

Desired behavior

  1. Hovering on a video should play the video
  2. Clicking on the video should open up the video player and video should play

Test code to reproduce

  1. Hovering on a video should play the video
const urls = [`https://cat-press.com/cat-movies/firework`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      // Scroll to feed
      cy.get('.cy-grid').scrollIntoView()
      // Should hover over to the video at index 1
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('mouseover')
     
    })
  })
  1. Clicking on the video opens a new tab (Expected to open the video player on the same screen)
const urls = [`https://cat-press.com/cat-movies/firework`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      // Scroll to feed
      cy.get('.cy-grid').scrollIntoView()
      // Should hover over to the video at index 1
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('click')
     
    })
  })

image

Versions

Mac: Catalina 10.15.7
Chrome: Version 87.0.4280.141 (Official Build) (x86_64)
Cypress: Version 6.1.0 (6.1.0.531243)

@bahmutov
Copy link
Contributor

  1. Cypress does not have a native hover yet Support for Native Browser Events #311, try using https://github.com/dmtrKovalenko/cypress-real-events
  2. figure out why and how the app determines how to open the window. Some points in https://glebbahmutov.com/blog/cypress-tips-and-tricks/#deal-with-target_blank and https://glebbahmutov.com/blog/cypress-tips-and-tricks/#deal-with-windowopen but it could also be due to the iframe app, try using experimentalSourceRewriting: true https://on.cypress.io/experimental

@sinthujan24
Copy link
Author

@bahmutov 2. Manually it doesn't open a second tab. It remains on the same page.

@bahmutov
Copy link
Contributor

bahmutov commented Jan 27, 2021 via email

@sinthujan24
Copy link
Author

Try the experimental source rewriting. It probably has to do with the app being inside the iframe

Sent from my iPhone
On Jan 27, 2021, at 13:43, sinthujan24 @.***> wrote:  @bahmutov 2. Manually it doesn't open a second tab. It remains on the same page. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

@bahmutov I tried it. it still opens a new tab.

@sinthujan24
Copy link
Author

I kindly ask you to reopen this issue:

  1. it's not a request to support multi tabs. Rather, cypress behaves differently than manual user interactions. Here, the tab is opened unexpectedly

@bahmutov
Copy link
Contributor

So I created reproduction in https://github.com/cypress-io/cypress-test-tiny/tree/opens-new-tab

In the normal browser I see a click event handler attached to those video cards

Screen Shot 2021-01-27 at 2 16 04 PM

In Cypress the same element does not have an event handler.

Screen Shot 2021-01-27 at 2 16 48 PM

The site has bunch of errors while loading. If you can eliminate everything from the page to find out how the event listener is attached in the browser and why it is not attached inside Cypress, I would be happy to reopen the issue. But without this investigation by someone who understands the implementation of those video cards, I don't think it is productive to investigate.

@sinthujan24
Copy link
Author

@bahmutov I'm seeing element has an event handler and it's click. Image attached

image

@bahmutov
Copy link
Contributor

bahmutov commented Jan 27, 2021 via email

@sinthujan24
Copy link
Author

Very weird

Sent from my iPhone
On Jan 27, 2021, at 15:37, sinthujan24 @.***> wrote:  @bahmutov I'm seeing element has an event handler and it's click. Image attached — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Yes. And Unfortunately, hover and clicking on the video tile to open the player are the most critical part of our testing. That's why I've been struggling for a solution for last couple of days. Please reopen this issue if the above evidences earns an investigation on cypress side at the least

@bahmutov
Copy link
Contributor

bahmutov commented Jan 27, 2021 via email

@sinthujan24
Copy link
Author

@bahmutov The code snippets mentioned in #14757 (comment) are the minimal reproducible steps.

Did you want me to commit this to https://github.com/cypress-io/cypress-test-tiny/tree/opens-new-tab

@bahmutov
Copy link
Contributor

bahmutov commented Jan 27, 2021 via email

@sinthujan24
Copy link
Author

@bahmutov Please use the below example
Click Issue

const urls = [`https://fireworktv.com/embed/demo`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('click')
    })
  })

Hover issue:

const urls = [`https://fireworktv.com/embed/demo`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('mouseover')
    })
  })

@bahmutov
Copy link
Contributor

I have updated the reproducible example in https://github.com/cypress-io/cypress-test-tiny/tree/opens-new-tab

There is a click on the video player that is handled by Preact which I cannot figure out where it is going, since this is minified production code. Everyone is welcome to trace it and figure out why the behavior during testing is different.

@bahmutov bahmutov reopened this Jan 27, 2021
@sinthujan24
Copy link
Author

Current behavior

  1. Hovering on a video tile doesn't play the video as expected
  2. Clicking on the video opens a new tab (Expected to open the video player on the same screen)

Desired behavior

  1. Hovering on a video should play the video
  2. Clicking on the video should open up the video player and video should play

Test code to reproduce

  1. Hovering on a video should play the video
const urls = [`https://cat-press.com/cat-movies/firework`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      // Scroll to feed
      cy.get('.cy-grid').scrollIntoView()
      // Should hover over to the video at index 1
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('mouseover')
     
    })
  })
  1. Clicking on the video opens a new tab (Expected to open the video player on the same screen)
const urls = [`https://cat-press.com/cat-movies/firework`]
  urls.forEach((url) => {
    it(`Should load the videos and autoplay one: ${url}`, () => {
      cy.visit(url)
      // Scroll to feed
      cy.get('.cy-grid').scrollIntoView()
      // Should hover over to the video at index 1
      cy.get(`.cy-thumbnail-link`).eq(1).trigger('click')
     
    })
  })

image

Versions

Mac: Catalina 10.15.7
Chrome: Version 87.0.4280.141 (Official Build) (x86_64)
Cypress: Version 6.1.0 (6.1.0.531243)

  1. The first issue is fixed by specifiying an explicit timeout after hover operation.
// Click on first thumbnail
      cy.get(`.cy-thumbnail-link`)
        .eq(1)
        .trigger("mouseover")
        //.trigger("mouseenter")
      cy.wait(3000)

@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 cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period topic: cy.click 🖱 type: bug
Projects
None yet
Development

No branches or pull requests

4 participants