Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing test mobile/calc/spellchecking_spec.js #8588

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 17 additions & 53 deletions cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
@@ -1,4 +1,4 @@
/* global describe it cy Cypress beforeEach require afterEach expect*/
/* global describe it cy beforeEach require afterEach expect*/

var helper = require('../../common/helper');
var calcHelper = require('../../common/calc_helper');
Expand All @@ -20,76 +20,40 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Calc spell checking menu.',
});

function openContextMenu() {
// Step into edit mode
calcHelper.dblClickOnFirstCell();

// Select text content
helper.typeIntoDocument('{ctrl}a');

// Open context menu
cy.cGet('.leaflet-selection-marker-start,.leaflet-selection-marker-end')
.then(function(markers) {
expect(markers.length).to.be.equal(2);
for (var i = 0; i < markers.length; i++) {
if (markers[i].classList.contains('leaflet-selection-marker-start')) {
cy.log('Found start marker at pos: ' + markers[i].getBoundingClientRect().right);
var XPos = markers[i].getBoundingClientRect().right + 10;
} else if (markers[i].classList.contains('leaflet-selection-marker-end')) {
cy.log('Found end marker at pos: ' + markers[i].getBoundingClientRect().top);
var YPos = markers[i].getBoundingClientRect().top - 10;
}
}

// Remove selection
cy.cGet('#tb_actionbar_item_acceptformula').then($ele =>{
cy.wait(1000);
if (Cypress.dom.isVisible($ele)) {
cy.wrap($ele).click();
}
});

cy.cGet('.cursor-overlay .blinking-cursor')
.should('not.exist');

// Step into edit mode again
calcHelper.dblClickOnFirstCell();

// Click and then long press on first cell
cy.cGet('#map')
.then(function(items) {
expect(items).to.have.lengthOf(1);
var XPos = items[0].getBoundingClientRect().left + 10;
var YPos = items[0].getBoundingClientRect().top + 10;
cy.cGet('body').click(XPos, YPos);
mobileHelper.longPressOnDocument(XPos, YPos);
});

cy.cGet('#mobile-wizard-content')
.should('be.visible');
cy.cGet('#mobile-wizard-content').should('be.visible');
}

it('Apply suggestion.', function() {
openContextMenu();

cy.cGet('body').contains('.context-menu-link', 'hello')
.click();
cy.cGet('body').contains('.context-menu-link', 'hello').click();

calcHelper.selectEntireSheet();
cy.cGet('#copy-paste-container table td').should('contain.text', 'hello');

cy.cGet('#copy-paste-container table td')
.should('contain.text', 'hello');
// We don't get the spell check context menu any more
openContextMenu();
cy.cGet('body').contains('.context-menu-link', 'Paste').should('be.visible');
});

it('Ignore all.', function() {
openContextMenu();

cy.cGet('body').contains('.context-menu-link', 'Ignore All').click();

// Click outside of the cell
cy.cGet('.leaflet-marker-icon')
.then(function(items) {
expect(items).to.have.length(2);
var XPos = items[0].getBoundingClientRect().right;
var YPos = items[0].getBoundingClientRect().bottom + 10;
cy.cGet('body').click(XPos, YPos);
});

openContextMenu();
calcHelper.selectEntireSheet();
cy.cGet('#copy-paste-container table td').should('contain.text', 'helljo');

// We don't get the spell check context menu any more
openContextMenu();
cy.cGet('body').contains('.context-menu-link', 'Paste').should('be.visible');
});
});