【发布时间】:2021-06-23 21:41:24
【问题描述】:
我目前正在使用“Drag File Here”组件与 Salesforce 合作,似乎如果我使用“Drag and Drop”NPM 依赖项,它将不会出现任何错误,但屏幕永远不会弹出。
注意:删除文件后,我们应该会看到一个弹出窗口,其中包含用于存储该文件的所有文件选项。
如果我使用“触发操作”执行此操作,我将收到以下错误消息:
我的代码如下:
describe("Checklist - Drag and Drop Functionality", function () {
beforeEach(() => {
cy.login();
});
it("Drag and Drop Files", () => {
cy.viewOpportunityRecord();
cy.wait(10000);
// Click to view More Tabs inside of the opportunity
cy.get('button[title="More Tabs"]', { delay: 1000, force: true }).click({multiple: true, force: true});
cy.get("span.slds-truncate")
.contains("Checklist (beta)")
.dblclick({ multiple: true });
cy.wait(10000)
const filePath = 'html-cheat-sheet.csv'
cy.xpath('//*[@id="tab-18"]/slot/flexipage-component2/slot/flexipage-aura-wrapper/div/section[1]/h2/div[2]/button[3]').click({force: true})
cy.wait(10000)
cy.xpath('/html/body/div[4]/div[1]/section/div[1]/div[2]/div[2]/div[1]/div/div/div/div/div/one-record-home-flexipage2/forcegenerated-adg-rollup_component___force-generated__flexipage_-record-page___-opportunity_-record_-page___-opportunity___-v-i-e-w/forcegenerated-flexipage_opportunity_record_page_opportunity__view_js/record_flexipage-record-page-decorator/div[1]/records-record-layout-event-broker/slot/slot/flexipage-record-home-with-subheader-template-desktop2/div/div[3]/div[1]/slot/slot/flexipage-component2[1]/slot/flexipage-tabset2/div/lightning-tabset/div/slot/slot/slot/flexipage-tab2[16]/slot/flexipage-component2/slot/flexipage-aura-wrapper/div/div[1]/div[1]/ul/li[1]/section/div[2]/div[2]/div[4]').trigger('drop', {filePath})
})
})
另外,要运行拖动文件,我认为我可以这样做:
const fileLocated = cy.xpath('/html/body/div[4]/div[1]/section/div[1]/div[2]/div[2]/div[1]/div/div/div/div/div/one-record-home-flexipage2/forcegenerated-adg-rollup_component___force-generated__flexipage_-record-page___-opportunity_-record_-page___-opportunity___-v-i-e-w/forcegenerated-flexipage_opportunity_record_page_opportunity__view_js/record_flexipage-record-page-decorator/div[1]/records-record-layout-event-broker/slot/slot/flexipage-record-home-with-subheader-template-desktop2/div/div[3]/div[1]/slot/slot/flexipage-component2[1]/slot/flexipage-tabset2/div/lightning-tabset/div/slot/slot/slot/flexipage-tab2[16]/slot/flexipage-component2/slot/flexipage-aura-wrapper/div/div[1]/div[1]/ul/li[1]/section/div[2]/div[2]/div[4]')
cy.xpath('//*[@id="tab-18"]/slot/flexipage-component2/slot/flexipage-aura-wrapper/div/section[1]/h2/div[2]/button[3]').click({force: true})
cy.wait(10000)
cy.xpath('//*[@id="fileTable"]').xpath('//*[@id="fileTable"]/tbody/tr[1]/td[1]/div/button').contains('12 Month Payment History').drag(fileLocated, { force: true})
主要问题是我遇到了以下问题:
CypressError
Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
The command that returned the promise was:
> cy.wrap()
有人知道如何解决这个问题吗?
【问题讨论】:
标签: javascript drag-and-drop automated-tests cypress salesforce-lightning