-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Feature] Compatibility with shadow dom #74
Comments
Hi @stefanbrato Well, that's actually a nice one. |
Hello @abramenal , Here is a small snippet of the command added in support/commands.js:
Here is an example of the simple test we had for this upload feature:
And here is the exception we receive:
Regarding the snippet of the component code, we are working for a internal project closed source. We are working on a poc for this component and we will send it to you. Please let me know if I can help you with more information. |
@stefanbrato I see the case now. Prior to that I've created another package – https://github.com/abramenal/cypress-shadow-dom. After that, on top of shadow DOM package will make Feel this coming in a week or so.. will let u know. |
@stefanbrato realized that's not a quite easy one to do 😈 |
Hello @abramenal , indeed it seems it is a bit out of my league to do this modification, but we did find a workaround and I though it would be nice to share it, until the plugin is updated: uploadFile(filename, fixturePath = 'swaggers/'){
const button = this.uploadFileInput();
const fixture = fixturePath + filename;
const type = 'application/json';
button.then(subject =>
cy.window().then(win =>
cy.fixture(fixture, 'base64')
.then((json) => {
const el = subject[0];
const blob = new Blob([JSON.stringify(json, null, 2)], {type : 'application/json'});
const testFile = new win.File([blob], filename, { type });
const dataTransfer = new win.DataTransfer();
dataTransfer.items.add(testFile);
el.files = dataTransfer.files;
el.dispatchEvent(new CustomEvent('change'));
})));
} |
@stefanbrato that's a great finding! |
Implementation is done, need some time for proper testing – release for this improvement is coming. |
so now you can use the command for shadow dom components as well:
If you're using https://github.com/abramenal/cypress-shadow-dom
|
I am also working on reference solutions (aka recipes) to demonstrate what we can do with the plugin: #80 |
@stefanbrato |
I've added a separate recipe to demonstrate this specific case: |
Hello everyone, |
Hi @RuslanOmurbekov |
Hi @abramenal I guess i am using the latest versions. Should i downgrade versions? |
@RuslanOmurbekov nope, the thing is code snippet I gave is actual for cypress-file-upload v3. |
Yes, i am using v4 and i was using 'attachFile'. Actually i figured out , the format of the file wasn't correct. |
Current behavior:
Can this plug-in work with shadow dom as well ?
When I tried to use it with our application I got an exception the element is detached from dom.
It would be really nice if this plug-in can work with shadow-dom.
Desired behavior:
This plug-in works with shadow-dom. If it is working with shadow-dom if an example could be added to the read-me page would be really helpful.
Versions
The text was updated successfully, but these errors were encountered: