https://cypress.io logo
I am getting props is undefined while using the cy...
# i-need-help
p
I am getting props is undefined while using the cy.screenshot() command right after the cy.origin() Any guess?

https://cdn.discordapp.com/attachments/1101069677318381669/1101069677490356295/Screenshot_2023-04-27_at_09.10.59.png

s
Please share you code what you are trying to do?
What exactly you want cypress to do?
p
@silly-river-29906 the sample code is here
Copy code
Javascript
    cy.origin('https://www.bbc.co.uk/', () => {
      cy.visit('/')
    })

    cy.origin('http://www.columbia.edu/~fdc/', () => {
      cy.visit('/sample.html')
    })
    
    cy.screenshot()
I am expecting Cypress should not to throw any error and it has to capture the screenshot.
s
why are you using origin() two times?
p
otherwise the https to http switching won't work see the details here https://github.com/cypress-io/cypress/issues/26586
@many-airline-45402 any clue about this issue?
m
@plain-potato-68806 I don't know what you are trying to achieve. You need to explain why you want to have two different domains in one test.
p
its for an E2E tests and I need to hit a different domain. Now the actual issue is not about the URL navigation. With two cy.origin() command, the screenshots are not working
m
I was trying to understand why you don't just use two separate tests:
Copy code
it('bbc', () => {
    cy.visit('https://www.bbc.co.uk/')
  })
  it('columbia', () => {
    cy.visit('http://www.columbia.edu/~fdc/sample.html')
    cy.screenshot()
  })
Perhaps you could explain why that wouldn't work for you?
p
Unfortunately, that doesn't solve my issue. Because for the E2E tests, I need to navigate to both url as these systems are connected each other and it has to be in the same
it
block. Moreover, I am using the cucumber-preprocessor and not the describe or it block 🙂
Moreover, the https to http doesn't work the way you mentioned and it will work only with cy.origin
m
So what site are you trying to take a screenshot of? Does
Copy code
cy.origin('https://www.bbc.co.uk/', () => {
      cy.visit('/')
    })

    cy.origin('http://www.columbia.edu/~fdc/', () => {
      cy.visit('/sample.html')
      cy.screenshot()
    })
work for you?
p
I am looking for the flexibility to take the screenshot later in the test flow while interacting with various web elements on both sites
btw - @many-airline-45402 it's working when I use the cy.screenshot() command inside the cy.origin block. However, it doesn't solve my actual problem 😦
m
Sorry that I don't have the experience to help you further. Good luck!
p
No issues, thanks for trying Mike
@many-airline-45402 for your information - its now solved by the cypress team by passing
cy.screenshot({ capture: 'viewport' })
like this
2 Views