cypress-dragndrop-kit 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,3 +8,41 @@ A lightweight, Cypress-native plugin that simplifies drag‑and‑drop and movem
8
8
  ```bash
9
9
  npm install --save-dev cypress-dragndrop-kit
10
10
  ```
11
+
12
+ ## 🛠 Usage
13
+
14
+ In order to start using the package, all you need to do is import it within you `./cypress/support/e2e.ts` file:
15
+
16
+ ```typescript
17
+ // Location: cypress/support/e2e.ts
18
+ import 'cypress-dragndrop-kit';
19
+ ```
20
+
21
+ ### ✨ Available commands
22
+
23
+ - `dragTo(targetElementLocator)`: Custom child command for dragging and dropping a chained element to a specified element location
24
+ - `dragAndDrop(sourceElementLocator, targetElementLocator)`: Custom command for dragging and dropping from one element location to another
25
+
26
+ ### ⚙️ Examples
27
+
28
+ ```typescript
29
+ // Usage of "dragTo(target)"
30
+ it('should be able to drag and drop an item by using "dragTo()"', () => {
31
+ cy.get('[data-id="3"]').dragTo('[data-id="47"]');
32
+
33
+ cy.get('[data-id="47"]').should('have.attr', 'data-index', 46);
34
+ cy.get('[data-id="3"]').should('have.attr', 'data-index', 47);
35
+ })
36
+
37
+ // Usage of "dragAndDrop(source, target)"
38
+ it('should be able to drag and drop an item by using "dragAndDrop()"', () => {
39
+ cy.dragAndDrop('[data-id="47"]', '[data-id="3"]');
40
+
41
+ cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
42
+ cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
43
+ })
44
+ ```
45
+
46
+ ## 🤝 Contributing
47
+
48
+ Contributions are welcome! If you have ideas, bugs, or feature requests—feel free to open an issue or submit a pull request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-dragndrop-kit",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Custom command meant for interacting with draggable elements in the UI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types.d.ts",