137 lines
4.7 KiB
JavaScript
137 lines
4.7 KiB
JavaScript
/* global describe it cy beforeEach require afterEach expect */
|
|
|
|
var helper = require('../../common/helper');
|
|
|
|
describe.skip(['tagmultiuser'], 'Multiuser sheet operations', function() {
|
|
var origTestFileName = 'sheet_operations.ods';
|
|
var testFileName;
|
|
|
|
beforeEach(function() {
|
|
testFileName = helper.beforeAll(origTestFileName, 'calc', undefined, true);
|
|
});
|
|
|
|
afterEach(function() {
|
|
helper.afterAll(testFileName, this.currentTest.state);
|
|
});
|
|
|
|
function testInsertDelete(frameId1, frameId2) {
|
|
// We have one sheet by default
|
|
//assert for user-1/2
|
|
cy.cSetActiveFrame(frameId1);
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 1);
|
|
cy.cGet('#spreadsheet-tab0').should('have.text', 'Sheet1');
|
|
|
|
//assert for user-1/2
|
|
cy.cSetActiveFrame(frameId2);
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 1);
|
|
cy.cGet('#spreadsheet-tab0').should('have.text', 'Sheet1');
|
|
|
|
// Add one more sheet
|
|
cy.cSetActiveFrame(frameId1);
|
|
cy.cGet('#tb_spreadsheet-toolbar_item_insertsheet').click();
|
|
|
|
//assert for user-1/2
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 2);
|
|
cy.cGet('#spreadsheet-tab1').should('have.text', 'Sheet2');
|
|
|
|
//assert for user-1/2
|
|
cy.cSetActiveFrame(frameId2);
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 2);
|
|
cy.cGet('#spreadsheet-tab1').should('have.text', 'Sheet2');
|
|
cy.wait(2000);
|
|
|
|
//user-1/2 removes it
|
|
cy.cGet('#spreadsheet-tab0').rightclick();
|
|
cy.cGet('body').contains('.context-menu-link', 'Delete Sheet...').click();
|
|
cy.cGet('#delete-sheet-modal-response').click();
|
|
|
|
//assert for user-1/2
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 1);
|
|
cy.cGet('#spreadsheet-tab0').should('have.text', 'Sheet2');
|
|
|
|
//assert for user-1/2
|
|
cy.cSetActiveFrame(frameId1);
|
|
cy.cGet('.spreadsheet-tab').should('have.length', 1);
|
|
cy.cGet('#spreadsheet-tab0').should('have.text', 'Sheet2');
|
|
}
|
|
it('user-1 insert and user-2 delete sheet.', function() {
|
|
testInsertDelete('#iframe1', '#iframe2');
|
|
});
|
|
|
|
it('user-2 insert and user-1 delete sheet', function() {
|
|
testInsertDelete('#iframe2', '#iframe1');
|
|
});
|
|
|
|
});
|
|
|
|
describe(['tagmultiuser'], 'Check overlays after tab switching/operations', function() {
|
|
const origTestFileName = 'cell_cursor_overlay.ods';
|
|
let testFileName;
|
|
|
|
beforeEach(function() {
|
|
testFileName = helper.beforeAll(origTestFileName, 'calc', undefined, true);
|
|
});
|
|
|
|
afterEach(function() {
|
|
helper.afterAll(testFileName, this.currentTest.state);
|
|
});
|
|
|
|
it('Check cell cursor overlay bounds after switching tab', function () {
|
|
cy.cSetActiveFrame('#iframe1');
|
|
cy.cGet('#spreadsheet-tab1').click();
|
|
cy.cGet('input#addressInput').should('have.prop', 'value', 'A14');
|
|
|
|
let cellA14Bounds = new helper.Bounds();
|
|
helper.getOverlayItemBounds('#test-div-overlay-cell-cursor-border-0', cellA14Bounds);
|
|
|
|
cy.cSetActiveFrame('#iframe2');
|
|
// Check that cell cursor have the same bounds in both views
|
|
cy.cGet('#spreadsheet-tab1').click();
|
|
cy.cGet('input#addressInput').should('have.prop', 'value', 'A14');
|
|
helper.overlayItemHasBounds('#test-div-overlay-cell-cursor-border-0', cellA14Bounds);
|
|
});
|
|
|
|
it('Check cell view cursor overlay bounds after switching tab', function () {
|
|
cy.cSetActiveFrame('#iframe1');
|
|
cy.cGet('#spreadsheet-tab1').click();
|
|
|
|
let cellA14Bounds = new helper.Bounds();
|
|
helper.getOverlayItemBounds('#test-div-overlay-cell-cursor-border-0', cellA14Bounds);
|
|
|
|
cy.cSetActiveFrame('#iframe2');
|
|
cy.cGet('#spreadsheet-tab1').click();
|
|
|
|
// check that cell cursor and cell view cursor from first view have the same bounds
|
|
// since we don't know if view 0 has been loaded in frame1 or in frame2 we look for an element
|
|
// starting with 'test-div-overlay-cell-view-cursor' and ending with 'border-0'.
|
|
cy.cframe()
|
|
.find('[id^="test-div-overlay-cell-view-cursor"][id$="border-0"]')
|
|
.then(elements => {
|
|
expect(elements.length).to.be.equals(1);
|
|
const id = elements[0].id;
|
|
// cy.log('id: ' + id);
|
|
helper.overlayItemHasBounds('#' + id, cellA14Bounds);
|
|
});
|
|
});
|
|
|
|
it('Check cell view cursor overlay bounds after inserting a new tab', function () {
|
|
cy.cSetActiveFrame('#iframe1');
|
|
cy.cGet('input#addressInput').should('have.prop', 'value', 'D8');
|
|
|
|
cy.cSetActiveFrame('#iframe2');
|
|
helper.typeIntoInputField('input#addressInput', 'F6');
|
|
cy.cGet('input#addressInput').should('have.prop', 'value', 'F6');
|
|
|
|
cy.cSetActiveFrame('#iframe1');
|
|
cy.cGet('#tb_spreadsheet-toolbar_item_insertsheet').click();
|
|
|
|
// check that there is no cell view cursor;
|
|
// in fact in the other view the new sheet has never been selected
|
|
// since we don't know if view 0 has been loaded in frame1 or in frame2 we test for both.
|
|
cy.cGet('#test-div-overlay-cell-view-cursor-0-border-0').should('not.exist');
|
|
cy.cGet('#test-div-overlay-cell-view-cursor-1-border-0').should('not.exist');
|
|
});
|
|
|
|
});
|
|
|