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

[Bug] - shadowClick is not working for me #35

Open
YorkCorreaLaRosa opened this issue Jan 13, 2020 · 6 comments
Open

[Bug] - shadowClick is not working for me #35

YorkCorreaLaRosa opened this issue Jan 13, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@YorkCorreaLaRosa
Copy link

First sorry for my bad englis, I am automating a web page but I have some problems with shadow root, so let's see them

Current behavior:

This is input user
user

This is input pass
pass

and finally the button
btn

Desired behavior:

Steps to reproduce: (app code and test code)

import 'cypress-shadow-dom';
///
describe('Mi Primera Prueba', function () {

it('Prueba Shadow Dom', function () {
    cy.visit('url')
    cy.shadowGet(':nth-child(2) > :nth-child(1) > .ng-untouched').shadowType("B26192");
    cy.shadowGet('.mt-1 > .ng-untouched').shadowType("Interbank2");
    cy.shadowGet('.mt-3 > .col-xs-12').shadowClick();
})

})

but this is the result, I don't know why he doesn't click on the button
result

P lease tell me what I'm doing wrong =( !!! Thank u very much

Versions

Cypress verson: 3.8.1
cypress-shadow-dom: 1.3.0

@YorkCorreaLaRosa YorkCorreaLaRosa added the bug Something isn't working label Jan 13, 2020
@DesignByOnyx
Copy link
Contributor

This is something that I've run into as well. I was waiting until someone else had the same issue before submitting a PR. Would you mind adding this code to your "cypress/support/commands.js" file and see if it solves your problem:

Cypress.Commands.overwrite('shadowClick', (originalFn, subject, options) => {
	Cypress.log({
		name: 'shadowClick',
	});

	subject.click();
});

@YorkCorreaLaRosa
Copy link
Author

This is something that I've run into as well. I was waiting until someone else had the same issue before submitting a PR. Would you mind adding this code to your "cypress/support/commands.js" file and see if it solves your problem:

Cypress.Commands.overwrite('shadowClick', (originalFn, subject, options) => {
	Cypress.log({
		name: 'shadowClick',
	});

	subject.click();
});

Hi, I did what you told me by putting the code like that

command

But, the result is the same.. =(

result

I do not know what else to do? I'm suddenly doing something wrong?
Sorry for my bad english. I hope you can help me.

@DesignByOnyx
Copy link
Contributor

DesignByOnyx commented Jan 15, 2020

Can you validate that the code I gave you is working? Can you put a console.log('ShadowClick', subject) in there and make sure that function is being called and that subject has a length. Also, what version of cypress-shadow-dom are you using? npm list cypress-shadow-dom

@atobatele
Copy link

atobatele commented Jan 24, 2020

This is something that I've run into as well. I was waiting until someone else had the same issue before submitting a PR. Would you mind adding this code to your "cypress/support/commands.js" file and see if it solves your problem:

Cypress.Commands.overwrite('shadowClick', (originalFn, subject, options) => {
	Cypress.log({
		name: 'shadowClick',
	});

	subject.click();
});

This is what fixed it for me. Thank you so much @DesignByOnyx

@zd6515843
Copy link

@York6666 I met the same issue as you, do you find any way to work later?
and i also tried the code from @DesignByOnyx part, but i did not see the overwrite shadowClick was called.

@zd6515843
Copy link

zd6515843 commented Mar 13, 2020

Can you validate that the code I gave you is working? Can you put a console.log('ShadowClick', subject) in there and make sure that function is being called and that subject has a length. Also, what version of cypress-shadow-dom are you using? npm list cypress-shadow-dom

@DesignByOnyx my version as below
-- cypress-shadow-dom@1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants