Skip to content

Commit 5e72c80

Browse files
Merge pull request #533 from upex-galaxy/GX3-132-tools-qa-interactions-dragabble
Merge GX3-132 into QA
2 parents 26307b1 + 17f98fc commit 5e72c80

File tree

4 files changed

+217
-2
lines changed

4 files changed

+217
-2
lines changed

.github/workflows/CI-Suite.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
with:
5656
browser: electron
5757
command: | #EDITAR AQUÍ EL ARCHIVO SUITE A EJECUTAR:
58-
yarn file cypress/e2e/Tests/Elements/GX3-449-Buttons.cy.js
58+
yarn file cypress/e2e/Tests/Interactions/GX3-132-Draggable.cy.js
5959
6060
- name: ✅Import Test Results to Xray
6161
if: always()
@@ -65,7 +65,7 @@ jobs:
6565
password: ${{secrets.XRAY_CLIENT_SECRET}}
6666
testFormat: 'junit' #OPCIONES PARA CAMBIAR: 'junit' (para xml) o 'cucumber' (para json)
6767
testPaths: 'reports/test-results.xml' #OPCIONES: '/test-results.xml' o 'cucumber-report.json'
68-
testExecKey: 'GX3-463' #EDITAR AQUÍ EL TEST EXECUTION A IMPORTAR LAS PRUEBAS.
68+
testExecKey: 'GX3-134' #EDITAR AQUÍ EL TEST EXECUTION A IMPORTAR LAS PRUEBAS.
6969
projectKey: 'GX3' #EDITAR EN CASO DE TRABAJAR CON OTRO PROYECTO.
7070

7171
- name: 🔔Slack Notification of Done
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { draggable } from '@pages/Interactions/GX3-132-Draggable.page';
2+
import { faker } from '@faker-js/faker';
3+
4+
describe('US GX3-132 | ToolsQA | Interactions | Dragabble', () => {
5+
const randomX = faker.datatype.number({ min: 0, max: 450 });
6+
const randomY = faker.datatype.number({ min: 0, max: 450 });
7+
beforeEach('', () => {
8+
cy.visit('/dragabble');
9+
cy.url().should('contain', 'dragabble');
10+
});
11+
it('132 | TC1: Validar que se muestren las pestañas “Simple”, “Axis Restricted”, “Container Restricted”, “Cursor Style”', () => {
12+
draggable.get.simpleTab().should('be.visible');
13+
draggable.get.axisRestrictedTab().should('be.visible');
14+
draggable.get.containerRestrictedTab().should('be.visible');
15+
draggable.get.cursorStyleTab().should('be.visible');
16+
draggable.get.simpleTabVisible().should('be.visible');
17+
});
18+
19+
it('132 | TC2: Validar que "Drag me" se puede arrastrar de forma aleatoria en cualquier dirección de la pestaña “Simple”', () => {
20+
draggable.get.simpleTab().click();
21+
draggable.moveRandom(randomX, randomY);
22+
draggable.get.buttonDragBox().should('have.css', 'left', `${randomX}px`);
23+
draggable.get.buttonDragBox().should('have.css', 'top', `${randomY}px`);
24+
});
25+
it('132 | TC3: Validar que "Only X" y "Only Y" se pueden mover aleatoriamente en el eje correspondiente según su nombre X o Y de la pestaña “Axis Restricted”', () => {
26+
draggable.get.axisRestrictedTab().click();
27+
draggable.moveRandomX(randomX, 0);
28+
draggable.get.buttonOnlyX().should('have.css', 'left', `${randomX}px`);
29+
draggable.get.buttonOnlyX().should('have.css', 'top', `${0}px`);
30+
draggable.moveRandomY(0, randomY);
31+
draggable.get.buttonOnlyY().should('have.css', 'top', `${randomY}px`);
32+
draggable.get.buttonOnlyY().should('have.css', 'left', `${0}px`);
33+
});
34+
it('132 | TC4: Validar que “I`m contained within the box” y “Im contained within my parent” se pueden mover aleatoriamente solo dentro del área de acción delimitada de la pestaña “Container Restricted”', () => {
35+
const ramdomBoxX = faker.datatype.number({ min: 0, max: 280 });
36+
const ramdomBoxY = faker.datatype.number({ min: 0, max: 106 });
37+
const ramdomParentX = faker.datatype.number({ min: 0, max: 13 });
38+
const ramdomParentY = faker.datatype.number({ min: 0, max: 86 });
39+
40+
draggable.get.containerRestrictedTab().click();
41+
draggable.moveRandomDelimitedBox(ramdomBoxX, ramdomBoxY);
42+
draggable.get.textContainedBox().should('have.css', 'left', `${ramdomBoxX}px`);
43+
draggable.get.textContainedBox().should('have.css', 'top', `${ramdomBoxY}px`);
44+
45+
draggable.moveRandomDelimitedParent(ramdomParentX, ramdomParentY);
46+
draggable.get.textContainedParent().should('have.css', 'left', `${ramdomParentX}px`);
47+
draggable.get.textContainedParent().should('have.css', 'top', `${ramdomParentY}px`);
48+
});
49+
it('132 | TC5: Validar que el cursor permanece en el centro del cuadro "I will always stick to the center” de la pestaña Cursor Style”', () => {
50+
draggable.get.cursorStyleTab().click();
51+
const ramdomCenterX = faker.datatype.number({ min: 450, max: 1400 });
52+
const ramdomCenterY = faker.datatype.number({ min: 450, max: 1000 });
53+
cy.log(ramdomCenterX, ramdomCenterY);
54+
draggable.get
55+
.cursorCenter()
56+
.trigger('mousedown', { which: 1 })
57+
.trigger('mousemove', { which: 1, pageX: ramdomCenterX, pageY: ramdomCenterY });
58+
draggable.get.body().should('have.css', 'cursor', 'move');
59+
});
60+
it('132 | TC6: Validar que el cursor permanece en la parte superior del cuadro "My cursor is at top left” de la pestaña Cursor Style”', () => {
61+
draggable.get.cursorStyleTab().click();
62+
const ramdomCenterX = faker.datatype.number({ min: 450, max: 1400 });
63+
const ramdomCenterY = faker.datatype.number({ min: 450, max: 1000 });
64+
cy.log(ramdomCenterX, ramdomCenterY);
65+
draggable.get
66+
.cursorTopLeft()
67+
.trigger('mousedown', { which: 1 })
68+
.trigger('mousemove', { which: 1, pageX: ramdomCenterX, pageY: ramdomCenterY });
69+
draggable.get.body().should('have.css', 'cursor', 'crosshair');
70+
});
71+
it('132 | TC7: Validar que el cursor permanece en en la parte inferior central del cuadro "My cursor is at bottom” de la pestaña Cursor Style”', () => {
72+
draggable.get.cursorStyleTab().click();
73+
const ramdomCenterX = faker.datatype.number({ min: 450, max: 1400 });
74+
const ramdomCenterY = faker.datatype.number({ min: 450, max: 1000 });
75+
cy.log(ramdomCenterX, ramdomCenterY);
76+
draggable.get
77+
.cursorBottom()
78+
.trigger('mousedown', { which: 1 })
79+
.trigger('mousemove', { which: 1, pageX: ramdomCenterX, pageY: ramdomCenterY });
80+
draggable.get.body().should('have.css', 'cursor', 'auto');
81+
});
82+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class Dragabble {
2+
get = {
3+
simpleTab: () => cy.get('#draggableExample-tab-simple'),
4+
axisRestrictedTab: () => cy.get('#draggableExample-tab-axisRestriction'),
5+
containerRestrictedTab: () => cy.get('#draggableExample-tab-containerRestriction'),
6+
cursorStyleTab: () => cy.get('#draggableExample-tab-cursorStyle'),
7+
simpleTabVisible: () => cy.get('.nav-item.active'),
8+
buttonDragBox: () => cy.get('#dragBox'),
9+
buttonOnlyX: () => cy.get('#restrictedX'),
10+
buttonOnlyY: () => cy.get('#restrictedY'),
11+
textContainedBox: () => cy.get('div.draggable.ui-widget-content.ui-draggable.ui-draggable-handle'),
12+
textContainedParent: () => cy.get('span.ui-widget-header.ui-draggable.ui-draggable-handle'),
13+
cursorCenter: () => cy.get('#cursorCenter'),
14+
cursorTopLeft: () => cy.get('#cursorTopLeft'),
15+
cursorBottom: () => cy.get('#cursorBottom'),
16+
body: () => cy.get('body')
17+
};
18+
19+
moveRandom(deltaX, deltaY) {
20+
this.get.buttonDragBox().move({ deltaX, deltaY, force: true });
21+
}
22+
moveRandomX(deltaX, deltaY) {
23+
this.get.buttonOnlyX().move({ deltaX, deltaY, force: true });
24+
}
25+
moveRandomY(deltaX, deltaY) {
26+
this.get.buttonOnlyY().move({ deltaX, deltaY, force: true });
27+
}
28+
29+
moveRandomDelimitedBox(deltaX, deltaY) {
30+
this.get.textContainedBox().move({ deltaX, deltaY, force: true });
31+
}
32+
moveRandomDelimitedParent(deltaX, deltaY) {
33+
this.get.textContainedParent().move({ deltaX, deltaY, force: true });
34+
}
35+
}
36+
export const draggable = new Dragabble();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# ✅ToolsQA | Interactions | Dragabble
2+
3+
[GX3-132](https://upexgalaxy30.atlassian.net/browse/GX3-132) Created: 31/10/23 Updated: 13/11/23
4+
5+
**Challenge:**
6+
7+
QA Deberá realizar pruebas e2e con el uso de POM (Page Object Model)
8+
QA Deberá de usar la dependencia de [drag-and-drop](https://www.npmjs.com/package/@4tw/cypress-drag-drop) y deberá de usar coordenadas aleatorias.
9+
10+
**Scope del challenge:**
11+
Aprender a obtener elementos;
12+
Aprender a mover elementos dentro del DOM;
13+
Pulir nuestro uso de POM;
14+
Aprender a usar scripts de números aleatorios;
15+
16+
- As a QA learner,
17+
- I want to test:
18+
- **drag an area works as expected in different case scenarios.**
19+
- So that I can improve my testing skills for this scenario.
20+
21+
```
22+
BUSINESS RULES SPEC
23+
24+
25+
For the component:
26+
27+
Tabs “Simple”, “Axis Restricted”, “Container Restricted”, “Cursor Style” must be shown.
28+
29+
Expected:
30+
31+
Tab “Simple” is displayed by default.
32+
33+
Only one tab is displayed at once.
34+
35+
For the “Simple” tab:
36+
37+
“Drag me” dashed area must be displayed.
38+
39+
Expected behavior:
40+
41+
“Drag me” area can be dragged as desired in any direction.
42+
43+
For the “Axis Restricted” tab:
44+
45+
“Only X” dashed area must be displayed.
46+
47+
Expected behavior of the “Only X” area:
48+
49+
“Only X” area only can be dragged on the X axis.
50+
51+
“Only Y” dashed area must be displayed.
52+
53+
Expected behavior of the “Only Y” area:
54+
55+
“Only Y” area only can be dragged on the Y axis.
56+
57+
For the “Container Restricted” tab:
58+
59+
Bordered box with the text “I'm contained within the box” in a bordered area of action must be displayed.
60+
61+
Expected behavior of “I'm contained within the box” box:
62+
63+
the box can't be dragged out of the delimited area of action.
64+
65+
Bordered box with the text “I'm contained within my parent” must be displayed.
66+
67+
Expected behavior of “I'm contained within my parent” text:
68+
69+
the text can't be dragged out of the delimited area of action.
70+
71+
For the “Cursor Style” tab:
72+
73+
A cursor icon will appear on boxes when hovering over.
74+
75+
“I will always stick to the center” dashed box must be displayed.
76+
77+
Expected behavior:
78+
79+
IF: “I will always stick to the center” box is dragged
80+
THEN: the cursor must stick to the center of the box.
81+
82+
“My cursor is at top left” dashed box must be displayed.
83+
84+
Expected behavior:
85+
86+
IF: “My cursor is at top left” box is dragged
87+
THEN: the cursor must stick to the outside top left of the box.
88+
AND: the cursor icon changes to a “+”.
89+
90+
“My cursor is at bottom” dashed box must be displayed.
91+
92+
Expected behavior:
93+
94+
IF: “My cursor is at bottom” box is dragged
95+
THEN: the cursor must stick to the bottom center of the box.
96+
AND: the cursor hovering icon changes back to the default cursor icon.
97+
```

0 commit comments

Comments
 (0)