diff --git a/tests/cypress/integration/case_6_image_scale_fit.js b/tests/cypress/integration/case_6_image_scale_fit.js index 67a5aac6..ec872936 100644 --- a/tests/cypress/integration/case_6_image_scale_fit.js +++ b/tests/cypress/integration/case_6_image_scale_fit.js @@ -20,6 +20,8 @@ context('Check if the image is scaled and then fitted', () => { const posX = 10 const posY = 10 const color = 'gray' + let scaleBefore = 0 + let scaleAfter = 0 before(() => { cy.visit('auth/login') @@ -32,17 +34,24 @@ context('Check if the image is scaled and then fitted', () => { describe(`Testing "${labelName}"`, () => { it('Scale image', () => { cy.get('#cvat_canvas_background') - .should('have.attr', 'style').and('contain', 'scale(1.05)') + .should('have.attr', 'style') + .then($styles => { + scaleBefore = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]) + }) cy.get('.cvat-canvas-container') - .trigger('wheel', {deltaY: 5}) + .trigger('wheel', {deltaY: 5}) cy.get('#cvat_canvas_background') - .should('have.attr', 'style').and('contain', 'scale(0.875)') + .should('have.attr', 'style') + .then($styles => { + scaleAfter = Number($styles.match(/scale\((\d\.\d+)\)/m)[1]) + cy.expect(scaleBefore).to.be.greaterThan(scaleAfter) + }) }) it('Fit image', () => { cy.get('#cvat_canvas_content') - .dblclick() + .dblclick() cy.get('#cvat_canvas_background') - .should('have.attr', 'style').and('contain', 'scale(1.05)') + .should('have.attr', 'style').and('contain', scaleBefore) }) }) })