Drag and Drop not working on Salesforce lightning component page #28089
Unanswered
PranjalRsystems
asked this question in
Component Testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using cypress to automate a scenario on salesforce sandbox. In this I have to drag and drop an element into an iframe(lightning page). I am using the drag and drop plugin by cypress which is properly installed and have added into command.js file too.
Code is successfully running and I am able to drag the element with below code and can see that element is also sticked with the mouse pointer. But the problem is that its not getting dropped at the desired location.
// Get the iframe
cy.get("[name='surfaceFrame']").then(($iframe) => {
const doc = $iframe.contents();
// Get the target element
let element = doc.find("[data-aura-rendered-by='530:0']");
cy.get("[title^='Actions']").drag(element)
});
Test Scenario

Cypress_drag_drop_issue.mp4
Whole JS file
import { LoginPage } from "./pages/login_page"
import 'cypress-iframe';
import '@4tw/cypress-drag-drop';
const loginpage = new LoginPage
describe('My Test', () => {
beforeEach(() => {
cy.origin('https://imblaze--rsint.sandbox.lightning.force.com', () => {
cy.visit('https://test.salesforce.com');
});
});
it('POM', function(){
// Cypress.on('uncaught:exception', (err, runnable) => {
// console.log(err);
// return false;
// })
//cy.visit('/lightning/page/home')
loginpage.enterUsername('[email protected]')
loginpage.enterPassword('Welcome@2021')
loginpage.clickLogin()
// Get the iframe
cy.get("[name='surfaceFrame']").then(($iframe) => {
const doc = $iframe.contents();
// Get the target element
let element = doc.find("[data-aura-rendered-by='530:0']");
cy.get("[title^='Actions']").drag(element)
});
//})
})
})
Beta Was this translation helpful? Give feedback.
All reactions