PDF View: Added Cypress test for page up & down functionality.
Signed-off-by: Gökay ŞATIR <gokaysatir@gmail.com> Change-Id: Icc6f752e1cb406fb7c90e6d32520be531515d6eb
This commit is contained in:
parent
11fe7717c6
commit
39ee64ab50
3 changed files with 27 additions and 3 deletions
BIN
cypress_test/data/desktop/draw/pdf_page_up_down.pdf
Normal file
BIN
cypress_test/data/desktop/draw/pdf_page_up_down.pdf
Normal file
Binary file not shown.
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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;');
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue