Update Cypress test for case 6. (#2284)

* Update Cypress test for case 6.

Dynamically retrieving values for calculating the correctness of scale.

* Apply comments.

Co-authored-by: Kruchinin <dmitryx.kruchinin@intel.com>
main
Dmitry Kruchinin 5 years ago committed by GitHub
parent 2d23911d33
commit d957d6a9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
})
})
})

Loading…
Cancel
Save