Update cypress tests.

Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Change-Id: I1c60f89d6ab68e4a61861d77383010dd7f22480a
This commit is contained in:
Gökay Şatır 2023-08-10 15:45:29 +03:00 committed by Gökay ŞATIR
parent a3d9abcc20
commit 7d084e40cb
9 changed files with 67 additions and 65 deletions

View file

@ -2490,7 +2490,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
else
console.warn('_unoToolButton: no id provided');
L.DomUtil.addClass(div, 'uno' + id);
L.DomUtil.addClass(div, data.command.replace(':', '').replace('.', ''));
if (isRealUnoCommand)
id = builder._makeIdUnique(id);

View file

@ -67,12 +67,13 @@ function _makeW2MenuFocusable(id, control, menu) {
}
function _menubuttonControl (parentContainer, data, builder) {
if (!data.command) {
console.warn('Menu control without uno command: ' + data.id);
return;
}
var ids = data.id.split(':');
var menuId = data.command.replace('.uno:', '');
var menuId = null;
if (ids.length > 1)
menuId = ids[1];
data.id = ids[0];
// import menu
if (data.menu) {

View file

@ -61,11 +61,13 @@ var NotebookbarAccessibilityDefinitions = function() {
var defs = {};
for (i = 0; i < tabs.length; i++) {
defs[tabs[i].id] = tabs[i];
defs[tabs[i].id].focusBack = tabs[i].accessibility.focusBack;
defs[tabs[i].id].combination = tabs[i].accessibility.combination;
defs[tabs[i].id].contentList = [];
this.getContentListRecursive(defs[tabs[i].id].rawContentList, defs[tabs[i].id].contentList);
if (tabs[i].accessibility && tabs[i].accessibility.focusBack) {
defs[tabs[i].id] = tabs[i];
defs[tabs[i].id].focusBack = tabs[i].accessibility.focusBack;
defs[tabs[i].id].combination = tabs[i].accessibility.combination;
defs[tabs[i].id].contentList = [];
this.getContentListRecursive(defs[tabs[i].id].rawContentList, defs[tabs[i].id].contentList);
}
}
return defs;

View file

@ -201,12 +201,13 @@ function insertImage(docType) {
if (mode === 'notebookbar')
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
if (docType === 'calc' && mode === 'notebookbar')
if (docType === 'calc' && mode === 'notebookbar') {
cy.cGet('#Insert-tab-label').click();
actionOnSelector('insertGraphic', (selector) => {
cy.cGet(selector).click();
});
cy.cGet('#Insert-container .unoInsertGraphic').click();
}
else {
cy.cGet('#Home-container .unoInsertGraphic').click();
}
cy.cGet('#insertgraphic[type=file]').attachFile('/desktop/writer/image_to_insert.png');
cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g').should('exist');

View file

@ -1,7 +1,6 @@
/* global cy require*/
var helper = require('./helper');
var desktopHelper = require('./desktop_helper');
// A special text selection method for Writer. It selects
// all text of the document, but it also removes previous
@ -32,9 +31,12 @@ function selectAllTextOfDoc() {
}
function openFileProperties() {
desktopHelper.actionOnSelector('fileTab', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#File-tab-label').then(function(element) {
if (!element.hasClass('selected'))
element.click();
desktopHelper.actionOnSelector('documentProperties', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#File-container .unoSetDocumentProperties').click();
});
}
module.exports.selectAllTextOfDoc = selectAllTextOfDoc;

View file

@ -46,7 +46,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Insert Row Before', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#InsertRowsBefore');
selectOptionNotebookbar('[id$=InsertRowsBefore]');
cy.cGet('.leaflet-marker-icon.table-row-resize-marker').should('have.length', 4);
retriggerNewSvgForTableInTheCenter();
cy.cGet('.leaflet-pane.leaflet-overlay-pane g.Page g').should('have.class', 'com.sun.star.drawing.TableShape');
@ -68,7 +68,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Insert Row After', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#InsertRowsAfter');
selectOptionNotebookbar('[id$=InsertRowsAfter]');
cy.cGet('.leaflet-marker-icon.table-row-resize-marker').should('have.length', 4);
retriggerNewSvgForTableInTheCenter();
@ -92,7 +92,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Insert column before.', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#InsertColumnsBefore');
selectOptionNotebookbar('[id$=InsertColumnsBefore]');
cy.cGet('.leaflet-marker-icon.table-column-resize-marker')
.should('have.length', 3);
@ -118,7 +118,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Insert column after.', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#InsertColumnsAfter');
selectOptionNotebookbar('[id$=InsertColumnsAfter]');
cy.cGet('.leaflet-marker-icon.table-column-resize-marker')
.should('have.length', 3);
@ -144,7 +144,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Delete row.', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#DeleteRows');
selectOptionNotebookbar('[id$=DeleteRows]');
cy.cGet('.leaflet-marker-icon.table-row-resize-marker')
.should('have.length', 2);
@ -167,12 +167,12 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Delete Column.', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('#InsertColumnsBefore');
selectOptionNotebookbar('[id$=InsertColumnsBefore]');
cy.cGet('.leaflet-marker-icon.table-column-resize-marker')
.should('have.length', 3);
selectOptionNotebookbar('#DeleteColumns');
selectOptionNotebookbar('[id$=DeleteColumns]');
cy.cGet('.leaflet-marker-icon.table-column-resize-marker')
.should('have.length', 2);
@ -198,7 +198,7 @@ describe(['tagdesktop'], 'Table operations', function() {
it('Delete Table', function() {
desktopHelper.switchUIToNotebookbar();
selectFullTable();
selectOptionNotebookbar('.cell.notebookbar #DeleteTable');
selectOptionNotebookbar('.cell.notebookbar [id$=DeleteTable]');
retriggerNewSvgForTableInTheCenter();
@ -216,9 +216,9 @@ describe(['tagdesktop'], 'Table operations', function() {
cy.cGet('.leaflet-marker-icon.table-row-resize-marker')
.should('have.length', 3);
selectOptionNotebookbar('#EntireRow');
selectOptionNotebookbar('[id$=EntireRow]');
cy.wait(1000);
selectOptionNotebookbar('#MergeCells');
selectOptionNotebookbar('[id$=MergeCells]');
retriggerNewSvgForTableInTheCenter();
@ -245,9 +245,9 @@ describe(['tagdesktop'], 'Table operations', function() {
cy.cGet('.leaflet-marker-icon.table-row-resize-marker')
.should('have.length', 3);
selectOptionNotebookbar('#EntireColumn');
selectOptionNotebookbar('[id$=EntireColumn]');
cy.wait(1000);
selectOptionNotebookbar('#MergeCells');
selectOptionNotebookbar('[id$=MergeCells]');
retriggerNewSvgForTableInTheCenter();

View file

@ -12,7 +12,7 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
cy.viewport(1400, 600);
testFileName = helper.beforeAll(origTestFileName, 'writer');
desktopHelper.switchUIToNotebookbar();
cy.cGet('#optionscontainer div[id^="SidebarDeck.PropertyDeck"]').click(); // Hide sidebar.
cy.cGet('#optionscontainer div[id$="SidebarDeck.PropertyDeck"]').click(); // Hide sidebar.
selectZoomLevel('50');
});
@ -21,14 +21,14 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
});
it('Insert', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text0');
});
it('Modify', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text0');
@ -41,7 +41,7 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
});
it('Reply', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text');
@ -53,7 +53,7 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
});
it('Remove', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('.cool-annotation-content > div').should('contain','some text');
@ -70,7 +70,7 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() {
beforeEach(function() {
helper.beforeAll(testFileName, 'writer');
desktopHelper.switchUIToNotebookbar();
cy.cGet('#optionscontainer div[id^="SidebarDeck.PropertyDeck"]').click(); // Hide sidebar.
cy.cGet('#optionscontainer div[id$="SidebarDeck.PropertyDeck"]').click(); // Hide sidebar.
});
afterEach(function() {
@ -78,14 +78,14 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() {
});
it('Insert', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text0');
});
it('Modify', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text0');
@ -99,7 +99,7 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() {
});
it('Reply', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some text');
@ -112,7 +112,7 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() {
});
it('Remove', function() {
insertMultipleComment('writer', 1, false, '[id=InsertAnnotation1]');
insertMultipleComment('writer', 1, false, '[id=insert-insert-annotation]');
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('.cool-annotation-content > div').should('contain','some text');

View file

@ -10,7 +10,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'File Property Tests', func
beforeEach(function() {
testFileName = helper.beforeAll(origTestFileName, 'writer');
desktopHelper.switchUIToCompact();
desktopHelper.switchUIToNotebookbar();
});
afterEach(function() {
@ -19,7 +19,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'File Property Tests', func
it('Add File Description.', function() {
writerHelper.openFileProperties();
cy.cGet('#description-tab-label').click();
cy.cGet('#tabcontrol #2').click();
helper.waitUntilIdle('#title.ui-edit');
cy.cGet('#title.ui-edit').type('New Title');
// sometimes it doesn't finish typing
@ -38,7 +38,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'File Property Tests', func
cy.cGet('#ok.ui-pushbutton').click();
writerHelper.openFileProperties();
cy.cGet('#description-tab-label').click();
cy.cGet('#tabcontrol #2').click();
cy.cGet('#title.ui-edit').should('have.value', 'New Title');
cy.cGet('#comments.ui-textarea').should('have.value', 'New');

View file

@ -157,27 +157,27 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
});
it('Toggle numbered list.', function() {
desktopHelper.actionOnSelector('numberedList', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoDefaultNumbering').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container ol').should('exist');
});
it('Toggle bulleted list.', function() {
desktopHelper.actionOnSelector('bulletList', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoDefaultBullet').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container ul').should('exist');
});
it('Increase/Decrease Indent.', function() {
//Increase indent
desktopHelper.actionOnSelector('incrementIndent', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoIncrementIndent').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container p')
.should('have.attr', 'style')
.should('contain', 'margin-left: 0.49in');
//Decrease indent
desktopHelper.actionOnSelector('decrementIndent', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoDecrementIndent').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container p')
.should('have.attr', 'style')
@ -188,7 +188,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.wait(500);
desktopHelper.actionOnSelector('insertTable', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoInsertTable').click();
cy.cGet('.inserttable-grid > .row > .col').eq(3).click();
helper.typeIntoDocument('{ctrl}a');
cy.cGet('#copy-paste-container table').should('exist');
@ -200,7 +200,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
it('Insert image.', function() {
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
desktopHelper.actionOnSelector('insertGraphic', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unoInsertGraphic').click();
cy.cGet('#insertgraphic[type=file]').attachFile('/desktop/writer/image_to_insert.png');
cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g.Graphic').should('exist');
});
@ -209,7 +209,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
helper.expectTextForClipboard('text text1');
cy.cGet('#Insert-tab-label').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
desktopHelper.actionOnSelector('hyperLink', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Insert-container .hyperlinkdialog').click();
cy.cGet('#hyperlink-link-box').should('exist');
cy.cGet('#hyperlink-text-box').type('link');
cy.cGet('#hyperlink-link-box').type('www.something.com');
@ -223,7 +223,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
cy.cGet('#Insert-tab-label').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
desktopHelper.actionOnSelector('insertShape', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Insert-container .unoBasicShapes').click();
cy.cGet('.col.w2ui-icon.basicshapes_octagon').click();
cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g').should('exist');
@ -238,7 +238,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
it('Insert/delete chart.', function() {
cy.cGet('#Insert-tab-label').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
desktopHelper.actionOnSelector('insertChart', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Insert-container .unoInsertObjectChart').click();
cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g').should('exist');
//delete
@ -249,7 +249,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
it('Save.', { defaultCommandTimeout: 60000 }, function() {
cy.cGet('.cell.notebookbar > .unoBold > button').click();
desktopHelper.actionOnSelector('save', (selector) => { cy.cGet(selector).click(); });
cy.cGet('.notebookbar-shortcuts-bar .unoSave').click();
helper.reload(testFileName, 'writer', true);
cy.wait(2000);
writerHelper.selectAllTextOfDoc();
@ -265,7 +265,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
});
cy.cGet('#File-tab-label').click();
desktopHelper.actionOnSelector('print', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#File-container .unoPrint').click();
helper.getCoolFrameWindow()
.then(function(win) {
cy.wrap(win).its('open').should('be.called');
@ -278,17 +278,13 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
cy.cGet('#copy-paste-container p i').should('exist');
//Undo
desktopHelper.actionOnSelector('undo', (selector) => {
cy.cGet(selector).should('not.have.class', 'disabled').click();
});
cy.cGet('#Home-container .unoUndo').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container p i').should('not.exist');
//Redo
desktopHelper.actionOnSelector('redo', (selector) => {
cy.cGet(selector).should('not.have.class', 'disabled').click();
});
cy.cGet('#Home-container .unoRedo').click();
writerHelper.selectAllTextOfDoc();
cy.cGet('#copy-paste-container p i').should('exist');
@ -325,10 +321,10 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
cy.cGet('#View-tab-label').click();
cy.cGet('#sidebar-dock-wrapper').should('be.visible');
// Hide.
cy.cGet('[id="SidebarDeck.PropertyDeck"]').click();
cy.cGet('[id$="SidebarDeck.PropertyDeck"]').click();
cy.cGet('#sidebar-dock-wrapper').should('not.be.visible');
// Show.
cy.cGet('[id="SidebarDeck.PropertyDeck"]').click();
cy.cGet('[id$="SidebarDeck.PropertyDeck"]').click();
cy.cGet('#sidebar-dock-wrapper').should('be.visible');
});
@ -336,7 +332,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.wait(500);
desktopHelper.actionOnSelector('insertSymbol', (selector) => { cy.cGet(selector).click(); });
cy.cGet('#Home-container .unospan-CharmapControl').click();
cy.cGet('.jsdialog-container.ui-dialog.ui-widget-content.lokdialog_container').should('be.visible');
cy.cGet('.ui-dialog-title').should('have.text', 'Special Characters');
helper.clickOnIdle('#favchar1');
@ -433,7 +429,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
writerHelper.selectAllTextOfDoc();
cy.cGet('#Insert-tab-label').click();
cy.cGet('#toolbar-up .w2ui-scroll-right').click();
cy.cGet('#FontworkGalleryFloater').click();
cy.cGet('#Insert-container .unoFontworkGalleryFloater').click();
cy.cGet('#ok').click();
cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive').should('exist');