From 10a1ea84b7fe7ba91d6ba38be6f3340e7f780c98 Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Thu, 10 Aug 2023 09:49:10 +0100 Subject: [PATCH] added test to check action buttons within viewport --- tests/e2e/specs/mutation.cy.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/e2e/specs/mutation.cy.js b/tests/e2e/specs/mutation.cy.js index 3b573455e..4979c30d3 100644 --- a/tests/e2e/specs/mutation.cy.js +++ b/tests/e2e/specs/mutation.cy.js @@ -199,4 +199,19 @@ describe('Mutations component', () => { .get('@errTooltip') .should('not.have.css', 'display', 'none') }) + it.only('should display action buttons within viewport', () => { + mockMutations() + openMutationsForm('checkpoint') + cy.get('.v-card-actions').eq(0).then(($el) => { + console.log('element', $el[0]) + const rect = $el[0].getBoundingClientRect() // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect + const isInViewport = ( + rect.top >= -2 && + rect.left >= 0 && + rect.bottom <= Cypress.$(cy.state('window')).height() && + rect.right <= Cypress.$(cy.state('window')).width() + ) + expect(isInViewport).to.be.true + }) + }) })