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

How to call the function inside of a component? #428

Open
vikasm98 opened this issue May 17, 2023 · 1 comment
Open

How to call the function inside of a component? #428

vikasm98 opened this issue May 17, 2023 · 1 comment

Comments

@vikasm98
Copy link

I am getting the component when I use

cy.getReact('BasicTray').then((comp) => {
      cy.log('comp', comp)
})

and in the logs I can see the following output as shown in the image
Screenshot 2023-05-17 at 8 48 26 PM

but I am not able to get the function exists inside of that component.
I use this code to get the function of that component
cy.getReact('BasicTray').invoke('toggleMic')

I am getting this fllowing error
Screenshot 2023-05-17 at 8 52 24 PM

i am also getting the same error when i want to get the variable inside of that component
is there a way to get the function and call the function inside cypress end to end testing?

@FDiskas
Copy link

FDiskas commented Oct 9, 2023

This is similar you would ask - how users by visiting a website could invoke some random react component function visible on the page.

Looks like you need to take a look at unit tests instead of e2e.
E2E tests should test users' flow and interactions.

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

No branches or pull requests

2 participants