Open alexsch01 opened 7 months ago
Same issue on cypress@13.9.0
I confirmed this is happening and reproducible given the example. There's this call, where we call into jquery with the selection and the 'scope', where it's failing within jquery in that call. https://github.com/cypress-io/cypress/blob/remove-json-lint/packages/driver/src/cy/commands/querying/querying.ts#L198
I have a hunch that maybe we're not finding all the shadow dom to pass through the scope here? We're using a pretty old version of jquery here also that may not be helping.
I am also struggling with not being able to access Salesforce Lightning elements from my Cypress tests. I can interact with the elements within the Cypress test runner but any method and configuration I've tried, I get "timeout" because the element is not found. Is there any hope that this will be addressed soon?
@jennifer-shehane I just confirmed this still happens with Cypress 13.13.1
@jennifer-shehane @kathleennaughton
This actually gets around the issue
// Do the login to salesforce above the fix
cy.then(() => {
const doc = top.document.querySelectorAll(`iframe[id="Your project: 'Test Project'"]`)[0].contentDocument
doc.querySelector = document.querySelector.bind(doc)
doc.querySelectorAll = document.querySelectorAll.bind(doc)
})
cy.get('[title="Controller"]').click()
More fixes - https://github.com/cypress-io/cypress/issues/29294#issuecomment-2358509846
^ I also notice that includeShadowDom: true
can be removed from cypress.config.js and it still works!
@jennifer-shehane @kathleennaughton
Can confirm that the above fix actually works on a real Salesforce page
I will try this in the next couple of days. I have project commitments I want to get completed before I get to this.
Regards, Kathleen
From: Alex Schwartz @.> Sent: Monday, September 16, 2024 12:02 PM To: cypress-io/cypress @.> Cc: Kathleen Naughton @.>; Mention @.> Subject: Re: [cypress-io/cypress] Unable to access Salesforce Lightning elements even with {includeShadowDom: true} (Issue #29294)
@jennifer-shehanehttps://github.com/jennifer-shehane @kathleennaughtonhttps://github.com/kathleennaughton
Can confirm that the above fix actually works on a real Salesforce page
— Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/29294#issuecomment-2353567803, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BI5MBTEBN3UX2AKQOUY2KH3ZW4MKJAVCNFSM6AAAAABF7CGR22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTGU3DOOBQGM. You are receiving this because you were mentioned.Message ID: @.***>
Please remove topic: shadow dom - this isn't really that
fixSalesforce() {
// Workaround for Salesforce breaking "cy.get" with most lightning elements
cy.document().then(doc => {
doc.querySelector = document.querySelector.bind(doc)
doc.querySelectorAll = document.querySelectorAll.bind(doc)
doc.getElementById = document.getElementById.bind(doc)
doc.getElementsByClassName = document.getElementsByClassName.bind(doc)
doc.getElementsByName = document.getElementsByName.bind(doc)
doc.getElementsByTagName = document.getElementsByTagName.bind(doc)
doc.getElementsByTagNameNS = document.getElementsByTagNameNS.bind(doc)
doc.getRootNode = document.getRootNode.bind(doc)
})
}
UPDATE
See https://github.com/cypress-io/cypress/issues/29294#issuecomment-2341558523 for workaround
Current behavior
Test code to reproduce
Cypress Version
13.7.0
Node version
v18.13.0
Operating System
Windows 10.0.19045.4170
Other
Repo for Cypress test: https://github.com/alexsch01/cypress-repro-salesforce