Skip to content

Commit 7b70fec

Browse files
committed
cypress: use helper to get dropdowns in notebookbar
- do not use id which is not stable, use uno command class Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I873e32b91524e5f9d8ac0c9eae6e4f0a2259a075
1 parent ce8dfe8 commit 7b70fec

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

cypress_test/integration_tests/common/desktop_helper.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ function getNbIcon(unoCommand, tabName) {
548548
return cy.cGet((tabName ? '#' + tabName + '-container' : '') + '.notebookbar .uno' + unoCommand + ' > button:visible');
549549
}
550550

551+
/// get icon arrow for given uno command from notebookbar to open the dropdown
552+
function getNbIconArrow(unoCommand, tabName) {
553+
return cy.cGet((tabName ? '#' + tabName + '-container' : '') + '.notebookbar .uno' + unoCommand + ' > .arrowbackground:visible');
554+
}
555+
551556
/// get gropdown element for menu with given id
552557
function getDropdown(dropdownId) {
553558
return cy.cGet('[id^="' + dropdownId + '"].modalpopup');
@@ -587,5 +592,6 @@ module.exports.assertVisiblePage = assertVisiblePage;
587592
module.exports.closeNavigatorSidebar = closeNavigatorSidebar;
588593
module.exports.sidebarToggle = sidebarToggle;
589594
module.exports.getCompactIcon = getCompactIcon;
590-
module.exports.getNbIcon = getNbIcon;
595+
module.exports.getNbIcon = getNbIcon;
596+
module.exports.getNbIconArrow = getNbIconArrow;
591597
module.exports.getDropdown = getDropdown;

cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
88
var newFilePath;
99

1010
beforeEach(function() {
11+
cy.viewport(1920,1080);
1112
newFilePath = helper.setupAndLoadDocument('writer/top_toolbar.odt');
1213
desktopHelper.switchUIToNotebookbar();
13-
cy.viewport(1920,1080);
1414

1515
if (Cypress.env('INTEGRATION') === 'nextcloud') {
1616
desktopHelper.showSidebar();
@@ -26,7 +26,7 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
2626

2727
it('Apply highlight color.', function() {
2828
helper.setDummyClipboardForCopy();
29-
desktopHelper.actionOnSelector('backColor', (selector) => { cy.cGet(selector).click(); });
29+
desktopHelper.getNbIconArrow('CharBackColor', 'Home').click();
3030
desktopHelper.selectColorFromPalette('FFB66C');
3131
writerHelper.selectAllTextOfDoc();
3232
helper.copy();
@@ -36,20 +36,18 @@ describe(['tagdesktop'], 'Top toolbar tests.', function() {
3636

3737
it('Apply transparent highlight color.', function() {
3838
helper.setDummyClipboardForCopy();
39-
desktopHelper.actionOnSelector('backColor',
40-
(selector) => { cy.cGet(selector.replace('.unoarrow', '') + ' .unobutton').click(); });
39+
desktopHelper.getNbIcon('CharBackColor', 'Home').first().click();
4140
writerHelper.selectAllTextOfDoc();
4241
helper.copy();
4342
cy.cGet('#copy-paste-container p font span')
4443
.should('have.attr', 'style', 'background: transparent');
45-
desktopHelper.actionOnSelector('backColor',
46-
(selector) => { cy.cGet(selector.replace('.unoarrow', '') + ' .selected-color')
47-
.should('have.attr', 'style', 'background-color: transparent; border-color: var(--color-border);') });
44+
desktopHelper.getNbIcon('CharBackColor').find('.selected-color')
45+
.should('have.attr', 'style', 'background-color: transparent; border-color: var(--color-border);');
4846
});
4947

5048
it('Apply font color.', function() {
5149
helper.setDummyClipboardForCopy();
52-
desktopHelper.actionOnSelector('fontColor', (selector) => { cy.cGet(selector).click(); });
50+
desktopHelper.getNbIconArrow('FontColor', 'Home').click();
5351
desktopHelper.selectColorFromPalette('3FAF46');
5452
writerHelper.selectAllTextOfDoc();
5553
helper.copy();

0 commit comments

Comments
 (0)