diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 7cbf172d4..59d8b18eb 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -659,7 +659,18 @@ function typeText(selector, text, delayMs=0) { } } -function imageShouldBeFullWhiteOrNot(selector, fullWhite = true) { +// Check wether an img DOM element has only white colored pixels or not. +// Parameters: +// selector - a CSS selector to query the img DOM element. +// fullWhite - this specifies what we expect here, that the image is full white +// or on the contrary. +function imageShouldNotBeFullWhiteOrNot(selector, fullWhite = true) { + cy.log('Check whether an image is full white or not - start.'); + cy.log('Param - selector: ' + selector); + cy.log('Param - fullWhite: ' + fullWhite); + + expect(selector).to.have.string('img'); + cy.get(selector) .should(function(images) { var img = images[0]; @@ -686,6 +697,18 @@ function imageShouldBeFullWhiteOrNot(selector, fullWhite = true) { else expect(allIsWhite).to.be.false; }); + + cy.log('Check whether an image is full white or not - end.'); +} + +// Check wether an img DOM element consist of only white pixels. +function imageShouldBeFullWhite(selector) { + imageShouldNotBeFullWhiteOrNot(selector, true); +} + +// Check wether an img DOM element has any non-white pixels. +function imageShouldNotBeFullWhite(selector) { + imageShouldNotBeFullWhiteOrNot(selector, false); } function canvasShouldBeFullWhiteOrNot(selector, fullWhite = true) { @@ -998,7 +1021,8 @@ module.exports.doIfNotInImpress = doIfNotInImpress; module.exports.doIfNotInWriter = doIfNotInWriter; module.exports.beforeAll = beforeAll; module.exports.typeText = typeText; -module.exports.imageShouldBeFullWhiteOrNot = imageShouldBeFullWhiteOrNot; +module.exports.imageShouldBeFullWhite = imageShouldBeFullWhite; +module.exports.imageShouldNotBeFullWhite = imageShouldNotBeFullWhite; module.exports.canvasShouldBeFullWhiteOrNot = canvasShouldBeFullWhiteOrNot; module.exports.clickOnIdle = clickOnIdle; module.exports.inputOnIdle = inputOnIdle; diff --git a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js index 25ddab011..d9c0b3e12 100644 --- a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js +++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js @@ -374,12 +374,12 @@ describe('Trigger hamburger menu options.', function() { impressHelper.removeShapeSelection(); var preiew = '.preview-frame:nth-of-type(2) img'; - helper.imageShouldBeFullWhiteOrNot(preiew, false); + helper.imageShouldNotBeFullWhite(preiew); // Disable automatic spell checking mobileHelper.selectHamburgerMenuItem(['Automatic Spell Checking']); - helper.imageShouldBeFullWhiteOrNot(preiew, true); + helper.imageShouldBeFullWhite(preiew); }); it('Fullscreen presentation.', function() { diff --git a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js index fc05dd507..1386dad73 100644 --- a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js +++ b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js @@ -22,7 +22,10 @@ describe('Changing slide properties.', function() { function previewShouldBeFullWhite(fullWhite = true, slideNumber = 1) { var selector = '.preview-frame:nth-of-type(' + (slideNumber + 1).toString() + ') img'; - helper.imageShouldBeFullWhiteOrNot(selector, fullWhite); + if (fullWhite) + helper.imageShouldBeFullWhite(selector); + else + helper.imageShouldNotBeFullWhite(selector); } function switchToMasterView() {