libreoffice-online/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js
Neil Guertin dfa13bfe62 Replace beforeAll with setupAndLoadDocument
Replace beforeAll in most tests with new helper function
Tests that need to close or reopen test files cannot use
the new function and will be updated later

Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: I372280e55993123fc26f83cb2e6e6e78665a6846
2024-04-25 07:37:56 +02:00

65 lines
2 KiB
JavaScript

/* global describe it cy beforeEach require expect*/
var helper = require('../../common/helper');
var mobileHelper = require('../../common/mobile_helper');
var impressHelper = require('../../common/impress_helper');
describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Spell checking menu.', function() {
beforeEach(function() {
helper.setupAndLoadDocument('impress/spellchecking.odp');
// Click on edit button
mobileHelper.enableEditingMobile();
});
function openContextMenu() {
// Click on the center of the slide to step into text edit mode
cy.cGet('#document-container')
.then(function(items) {
expect(items).to.have.length(1);
var XPos = (items[0].getBoundingClientRect().left + items[0].getBoundingClientRect().right) / 2;
var YPos = (items[0].getBoundingClientRect().top + items[0].getBoundingClientRect().bottom) / 2;
cy.cGet('body').dblclick(XPos, YPos);
});
helper.typeIntoDocument('{leftArrow}');
helper.textSelectionShouldNotExist();
// Open context menu
cy.cGet('g path.leaflet-interactive')
.then(function(shape) {
expect(shape.length).to.be.equal(2);
var XPos = (shape[0].getBoundingClientRect().left + shape[0].getBoundingClientRect().right) / 2;
var YPos = (shape[0].getBoundingClientRect().top + shape[0].getBoundingClientRect().bottom) / 2;
mobileHelper.longPressOnDocument(XPos, YPos);
});
cy.cGet('#mobile-wizard-content').should('be.visible');
}
it('Apply suggestion.', function() {
helper.setDummyClipboardForCopy();
openContextMenu();
cy.cGet('body').contains('.context-menu-link', 'hello').click();
impressHelper.selectTextOfShape();
helper.copy();
helper.expectTextForClipboard('hello');
});
it('Ignore all.', function() {
openContextMenu();
cy.cGet('body').contains('.context-menu-link', 'Ignore All').click();
openContextMenu();
// We don't get the spell check context menu any more
cy.cGet('body').contains('.context-menu-link', 'Paste').should('be.visible');
});
});