[Bug] - shadowClick is not working for me
YorkCorreaLaRosa opened this issue · 6 comments
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:
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
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
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 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
But, the result is the same.. =(
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.
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
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
@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.
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 thatsubject
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