cypress: make mobile toolbar tests more reliable

- wait for enabled state
- then click internal button

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I7663deb668de2e98b007fbace60386a4a7157058
This commit is contained in:
Szymon Kłos 2024-04-01 09:33:38 +02:00 committed by Gökay ŞATIR
parent db86e87c30
commit ad5826e4c3
2 changed files with 24 additions and 18 deletions

View file

@ -162,7 +162,9 @@ function openInsertionWizard() {
cy.log('>> openInsertionWizard - start');
cy.cGet('#toolbar-up #insertion_mobile_wizard')
.should('not.have.class', 'disabled')
.should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #insertion_mobile_wizard button')
.click();
cy.cGet('#mobile-wizard-content')
@ -179,6 +181,8 @@ function openCommentWizard() {
cy.cGet('#toolbar-up #comment_wizard')
.should('not.have.class', 'disabled')
cy.cGet('#toolbar-up #comment_wizard button')
.click();
//cy.cGet('#toolbar-up #comment_wizard')

View file

@ -17,7 +17,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function()
it('State of mobile wizard toolbar item.', function() {
// Mobile wizard toolbar button is disabled by default
cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'disabled');
cy.cGet('#toolbar-up #mobile_wizard').should('have.attr', 'disabled');
// Click on edit button
mobileHelper.enableEditingMobile();
// Button should be enabled now
@ -26,63 +26,64 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function()
it('State of insertion mobile wizard toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.cGet('#toolbar-up #insertion_mobile_wizard').should('have.class', 'disabled');
cy.cGet('#toolbar-up #insertion_mobile_wizard').should('have.attr', 'disabled');
// Click on edit button
mobileHelper.enableEditingMobile();
// Button should be enabled now
cy.cGet('#toolbar-up #insertion_mobile_wizard').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #insertion_mobile_wizard').should('not.have.attr', 'disabled');
});
it('State of comment wizard toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled');
// Click on edit button
mobileHelper.enableEditingMobile();
// Button should be enabled now
cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled');
});
it('State of undo toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.cGet('#toolbar-up #undo').should('have.class', 'disabled');
cy.cGet('#toolbar-up #undo').should('have.attr', 'disabled');
// Click on edit button
mobileHelper.enableEditingMobile();
// Button should be still disabled
cy.cGet('#toolbar-up #undo').should('have.class', 'disabled');
cy.cGet('#toolbar-up #undo').should('have.attr', 'disabled');
// Type something in the document
helper.typeIntoDocument('x');
// Button should become enabled
cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #undo').should('not.have.attr', 'disabled');
});
it('State of redo toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.cGet('#toolbar-up #redo').should('have.class', 'disabled');
cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled');
// Click on edit button
mobileHelper.enableEditingMobile();
// Button should be still disabled
cy.cGet('#toolbar-up #redo').should('have.class', 'disabled');
cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled');
// Type something in the document
helper.typeIntoDocument('x');
// Button should be still disabled
cy.cGet('#toolbar-up #redo').should('have.class', 'disabled');
cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled');
// Do an undo
cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #undo').should('not.have.attr', 'disabled');
cy.cGet('#toolbar-up #undo').click();
// Button should become enabled
cy.cGet('#toolbar-up #redo').should('not.have.class', 'disabled');
cy.cGet('#toolbar-up #redo').should('not.have.attr', 'disabled');
});
it('Open and close mobile wizard by toolbar item.', function() {
// Click on edit button
mobileHelper.enableEditingMobile();
// Click on mobile wizard toolbar item
cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'disabled').click();
cy.cGet('#toolbar-up #mobile_wizard').should('not.have.attr', 'disabled');
cy.cGet('#toolbar-up #mobile_wizard button').click();
// Mobile wizard is opened and it has any content
cy.cGet('#mobile-wizard-content').should('not.be.empty');
// Toolbar button is checked
//cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'checked');
cy.cGet('#toolbar-up #mobile_wizard').click();
cy.cGet('#toolbar-up #mobile_wizard button').click();
// Mobile wizard is closed
cy.cGet('#mobile-wizard').should('not.be.visible');
//cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'checked');
@ -100,12 +101,13 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function()
// Click on edit button
mobileHelper.enableEditingMobile();
// Click on mobile wizard toolbar item
cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled').click();
cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled');
cy.cGet('#toolbar-up #comment_wizard button').click();
// Mobile wizard is opened and it has any content
cy.cGet('#mobile-wizard-content').should('not.be.empty');
// Toolbar button is checked
//cy.cGet('#toolbar-up #comment_wizard').should('have.class', 'checked');
cy.cGet('#toolbar-up #comment_wizard').click();
cy.cGet('#toolbar-up #comment_wizard button').click();
// Mobile wizard is closed
cy.cGet('#mobile-wizard').should('not.be.visible');
//cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'checked');