test: Add stickies tests (#5413)

* test: Add tests for stickies

* test: add sticky basic test

* test: add size dragging tests

* test: add delete sticky test

* test: add editing test

* test: update editing text

* test: add expansion tests

* test: add more tests

* test: clean up tests

* refactor: update dragging tests to make sense

* refactor: upate drag right test

* test: add shrink from right test

* test: refactor some more

* test: fix all tests

* test: clean up

* test: update number

* test: add z-index tests

* test: address comments

* test: fix mistake

* test: wait on save

* test: try button instead
This commit is contained in:
Mutasem Aldmour
2023-04-21 15:37:09 +02:00
committed by GitHub
parent dc2a7a307a
commit 649389edad
6 changed files with 299 additions and 7 deletions

View File

@@ -232,18 +232,19 @@ Cypress.Commands.add('paste', { prevSubject: true }, (selector, pastePayload) =>
});
});
Cypress.Commands.add('drag', (selector, pos) => {
Cypress.Commands.add('drag', (selector, pos, options) => {
const index = options?.index || 0;
const [xDiff, yDiff] = pos;
const element = cy.get(selector);
const element = cy.get(selector).eq(index);
element.should('exist');
const originalLocation = Cypress.$(selector)[0].getBoundingClientRect();
const originalLocation = Cypress.$(selector)[index].getBoundingClientRect();
element.trigger('mousedown');
element.trigger('mousemove', {
which: 1,
pageX: originalLocation.right + xDiff,
pageY: originalLocation.top + yDiff,
pageX: options?.abs? xDiff: originalLocation.right + xDiff,
pageY: options?.abs? yDiff: originalLocation.top + yDiff,
force: true,
});
element.trigger('mouseup', { force: true });