Skip to content

Commit 69bdd0c

Browse files
committed
cypress: fix crop test to be more obvious
Signed-off-by: Szymon Kłos <[email protected]> Change-Id: I541c5fe8103c69662995d0f5bf41b4f135b952ae
1 parent 356c795 commit 69bdd0c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

cypress_test/integration_tests/common/helper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ function getSubFolder(filePath) {
11901190
function assertImageSize(expectedWidth, expectedHeight) {
11911191
cy.log('>> assertImageSize - start');
11921192

1193-
cy.cGet('#canvas-container > svg')
1193+
cy.cGet('#canvas-container > svg', {timeout: 1000})
11941194
.then(function (element) {
11951195
expect(element).to.have.length(1);
11961196
const actualWidth = parseInt(element[0].style.width.replace('px', ''));
@@ -1200,6 +1200,9 @@ function assertImageSize(expectedWidth, expectedHeight) {
12001200
expect(actualHeight).to.be.closeTo(expectedHeight, 10);
12011201
});
12021202

1203+
// wait for above async result
1204+
cy.wait(3000);
1205+
12031206
cy.log('<< assertImageSize - end');
12041207
}
12051208

cypress_test/integration_tests/desktop/calc/image_operation_spec.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,31 @@ describe(['tagdesktop'], 'Image Operation Tests', function() {
2121
});
2222

2323
it('Crop Image', function() {
24+
const moveY = 50;
25+
2426
desktopHelper.insertImage('calc');
2527

2628
helper.assertImageSize(248, 63);
2729

28-
cy.cGet('#test-div-shape-handle-4').should('exist');
30+
// use bottom handle
31+
cy.cGet('#test-div-shape-handle-6').should('exist');
2932
cy.cGet('.unoCrop').should('be.visible').click();
3033

31-
cy.cGet('#test-div-shape-handle-4').then(($handle) => {
34+
cy.cGet('#test-div-shape-handle-6').then(($handle) => {
3235
const rect = $handle[0].getBoundingClientRect();
3336
const startX = rect.left + rect.width / 2;
3437
const startY = rect.top + rect.height / 2;
35-
const moveX = 50;
3638

3739
cy.cGet('body').realMouseDown({ x: startX, y: startY });
3840

39-
cy.cGet('body').realMouseMove(startX + moveX, startY);
41+
cy.cGet('body').realMouseMove(startX, startY - moveY);
4042

41-
cy.cGet('body').realMouseUp({ x: startX + moveX, y: startY });
43+
cy.cGet('body').realMouseUp({ x: startX, y: startY - moveY });
44+
cy.cGet('body').realMouseUp();
4245
});
4346

4447
cy.wait(1000);
45-
helper.assertImageSize(298, 63);
48+
helper.assertImageSize(248, 63 - moveY);
4649
});
4750

4851
it.skip('Resize image when keep ratio option enabled and disabled', function() {

0 commit comments

Comments
 (0)