diff --git a/cypress_test/data/desktop/draw/pdf_page_up_down.pdf b/cypress_test/data/desktop/draw/pdf_page_up_down.pdf new file mode 100644 index 000000000..364f114e9 Binary files /dev/null and b/cypress_test/data/desktop/draw/pdf_page_up_down.pdf differ diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index c7f47e0c2..d7954f3f2 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -319,8 +319,8 @@ function checkIfDocIsLoaded() { // Wait for the sidebar to open. if (Cypress.env('INTEGRATION') !== 'nextcloud') { doIfOnDesktop(function() { - cy.get('#sidebar-dock-wrapper') - .should('be.visible'); + if (Cypress.env('pdf-view') !== true) + cy.get('#sidebar-panel').should('be.visible'); // Check that the document does not take the whole window width. cy.window() @@ -328,7 +328,8 @@ function checkIfDocIsLoaded() { cy.get('#document-container') .should(function(doc) { expect(doc).to.have.lengthOf(1); - expect(doc[0].getBoundingClientRect().right).to.be.lessThan(win.innerWidth * 0.95); + if (Cypress.env('pdf-view') !== true) + expect(doc[0].getBoundingClientRect().right).to.be.lessThan(win.innerWidth * 0.95); }); }); diff --git a/cypress_test/integration_tests/desktop/draw/pdf_page_up_down_spec.js b/cypress_test/integration_tests/desktop/draw/pdf_page_up_down_spec.js new file mode 100644 index 000000000..c4c162e93 --- /dev/null +++ b/cypress_test/integration_tests/desktop/draw/pdf_page_up_down_spec.js @@ -0,0 +1,23 @@ +/* global describe it cy require afterEach beforeEach */ + +var helper = require('../../common/helper'); + +describe('PDF View Tests', function() { + var testFileName = 'pdf_page_up_down.pdf'; + + beforeEach(function() { + helper.beforeAll(testFileName, 'draw'); + }); + + afterEach(function() { + helper.afterAll(testFileName, this.currentTest.state); + }); + + it('PDF page down', { env: { 'pdf-view': true } }, function() { + cy.get('#map').type('{pagedown}'); + cy.get('#preview-frame-part-1').should('have.attr', 'style', 'border: 2px solid darkgrey;'); + + cy.get('#map').type('{pageup}'); + cy.get('#preview-frame-part-0').should('have.attr', 'style', 'border: 2px solid darkgrey;'); + }); +});