cypress-dragndrop-kit 1.0.3 → 1.0.5

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 +47 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,8 +3,55 @@
3
3
  A lightweight, Cypress-native plugin that simplifies drag‑and‑drop and movement interactions in end-to-end tests. Perfect for testing sortable lists, draggable elements, and custom UI components.
4
4
 
5
5
 
6
+ <br/>
7
+
8
+
6
9
  ## 🚀 Installation
7
10
 
8
11
  ```bash
9
12
  npm install --save-dev cypress-dragndrop-kit
10
13
  ```
14
+ <br/>
15
+
16
+ ## 🛠 Usage
17
+
18
+ In order to start using the package, all you need to do is import it within you `./cypress/support/e2e.ts` file:
19
+
20
+ ```typescript
21
+ // Location: cypress/support/e2e.ts
22
+ import 'cypress-dragndrop-kit';
23
+ ```
24
+ <br/>
25
+
26
+ ### ✨ Available commands
27
+
28
+ - `dragTo(targetElementLocator)`: Custom child command for dragging and dropping a chained element to a specified element location
29
+ - `dragAndDrop(sourceElementLocator, targetElementLocator)`: Custom command for dragging and dropping from one element location to another
30
+
31
+ <br/>
32
+
33
+ ### ⚙️ Examples
34
+
35
+ ```typescript
36
+ // Usage of "dragTo(target)"
37
+ it('should be able to drag and drop an item by using "dragTo()"', () => {
38
+ cy.get('[data-id="3"]').dragTo('[data-id="47"]');
39
+
40
+ cy.get('[data-id="47"]').should('have.attr', 'data-index', 46);
41
+ cy.get('[data-id="3"]').should('have.attr', 'data-index', 47);
42
+ })
43
+
44
+ // Usage of "dragAndDrop(source, target)"
45
+ it('should be able to drag and drop an item by using "dragAndDrop()"', () => {
46
+ cy.dragAndDrop('[data-id="47"]', '[data-id="3"]');
47
+
48
+ cy.get('[data-id="47"]').should('have.attr', 'data-index', 3);
49
+ cy.get('[data-id="3"]').should('have.attr', 'data-index', 4);
50
+ })
51
+ ```
52
+
53
+ <br/>
54
+
55
+ ## 🤝 Contributing
56
+
57
+ 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.5",
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",