Cypress Drag and drop test

落爺英雄遲暮 提交于 2021-01-29 07:09:05

问题


I would like to test the sortable table with Cypress.io

I follow their page instruction: https://docs.cypress.io/api/commands/trigger.html#Mouse-Events

and it doesn't work...

First: it doesn't move the element

Second: when I see the step by step test on the left side, mouse down and mouse move are located in the same position...

my test

cy.get('.resource-filter-table')
        .trigger('mousedown', {witch:1, pageX:188, pageY:196})
        .trigger('mousemove', {witch:1, pageX:188, pageY:261})
        .trigger('mouseup')

my html

<table class="table table-borderless resource-filter-table">
    <thead>
    <th scope="col"><input type="checkbox" checked=True class="resourceFilterElementAll" onchange="checkAllResources(this)"></th>
    <th scope="col">Line</th>
    </thead>
    <tbody>
    {% for linija in user_lines %}
    <tr>
        <th><input type="checkbox" checked=True class="resourceFilterElement" onchange="filterOfResources()" id="{{linija.pk}}"></th>
        <th class="filter-list-element">{{ linija.line_name}} <i class="filter-list-icon material-icons">drag_handle</i></th>
    </tr>
    {% endfor %}
    </tbody>
</table>

来源:https://stackoverflow.com/questions/54326250/cypress-drag-and-drop-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!