[Libreoffice-commits] online.git: cypress_test/integration_tests

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 1 12:09:18 UTC 2020


 cypress_test/integration_tests/common/mobile_helper.js                          |   18 ++++++++++
 cypress_test/integration_tests/mobile/calc/apply_font_spec.js                   |    6 ---
 cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js               |   12 +-----
 cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js              |   12 +-----
 cypress_test/integration_tests/mobile/impress/apply_font_spec.js                |   18 +---------
 cypress_test/integration_tests/mobile/impress/slide_properties_spec.js          |   18 +---------
 cypress_test/integration_tests/mobile/writer/apply_font_spec.js                 |   18 +---------
 cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js |    9 -----
 cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js             |    6 +--
 9 files changed, 33 insertions(+), 84 deletions(-)

New commits:
commit d261a52fa2c3e1c08aea391b5819452da8e18f93
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jun 1 12:20:25 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Jun 1 14:09:00 2020 +0200

    cypress: extract selectFromColorPalette() method.
    
    Change-Id: I9b9eb135bbd9f9720d01a2ae4f703f374d5660ed
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95272
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js
index d60400d83..779c7fb29 100644
--- a/cypress_test/integration_tests/common/mobile_helper.js
+++ b/cypress_test/integration_tests/common/mobile_helper.js
@@ -226,6 +226,23 @@ function closeInsertionWizard() {
 	cy.log('Closing insertion wizard - end.');
 }
 
+function selectFromColorPalette(paletteNum, groupNum, colorNum) {
+	cy.log('Selecting a color from the color palette - start.');
+
+	cy.get('#color-picker-' + paletteNum.toString() + '-basic-color-' + groupNum.toString())
+		.click();
+
+	if (colorNum !== undefined) {
+		cy.get('#color-picker-' + paletteNum.toString() + '-tint-' + colorNum.toString())
+			.click();
+	}
+
+	cy.get('#mobile-wizard-back')
+		.click();
+
+	cy.log('Selecting a color from the color palette - end.');
+}
+
 module.exports.enableEditingMobile = enableEditingMobile;
 module.exports.beforeAllMobile = beforeAllMobile;
 module.exports.longPressOnDocument = longPressOnDocument;
@@ -236,3 +253,4 @@ module.exports.closeMobileWizard = closeMobileWizard;
 module.exports.executeCopyFromContextMenu = executeCopyFromContextMenu;
 module.exports.openInsertionWizard = openInsertionWizard;
 module.exports.closeInsertionWizard = closeInsertionWizard;
+module.exports.selectFromColorPalette = selectFromColorPalette;
diff --git a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js
index 4d1294ada..ac5f30545 100644
--- a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js
@@ -162,11 +162,7 @@ describe('Apply font changes.', function() {
 		cy.get('#Color')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5);
 
 		calcHelper.selectAllMobile();
 
diff --git a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js
index 16f980097..7005e18d5 100644
--- a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js
@@ -96,11 +96,7 @@ describe('Interact with bottom toolbar.', function() {
 		cy.get('.w2ui-tb-image.w2ui-icon.textcolor')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5);
 
 		calcHelper.selectAllMobile();
 
@@ -114,11 +110,7 @@ describe('Interact with bottom toolbar.', function() {
 		cy.get('.w2ui-tb-image.w2ui-icon.backcolor')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5);
 
 		calcHelper.selectAllMobile();
 
diff --git a/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js
index 59d5edab0..afd69f444 100644
--- a/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js
@@ -48,11 +48,7 @@ describe('Change cell appearance.', function() {
 		cy.get('#BackgroundColor')
 			.click();
 
-		cy.get('#color-picker-1-basic-color-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(1, 2);
 
 		// Check that the color is shown as selected
 		cy.get('#BackgroundColor .color-sample-selected')
@@ -275,11 +271,7 @@ describe('Change cell appearance.', function() {
 		cy.get('#FrameLineColor')
 			.click();
 
-		cy.get('#color-picker-2-basic-color-3')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(2, 3);
 
 		// Check that the color is shown as selected
 		cy.get('#FrameLineColor .color-sample-selected')
diff --git a/cypress_test/integration_tests/mobile/impress/apply_font_spec.js b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
index f7a83c464..804e13df3 100644
--- a/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js
@@ -199,14 +199,7 @@ describe('Apply font on text shape.', function() {
 		cy.get('#Color')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#color-picker-0-tint-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5, 2);
 
 		triggerNewSVG();
 
@@ -220,14 +213,7 @@ describe('Apply font on text shape.', function() {
 		cy.get('#CharBackColor')
 			.click();
 
-		cy.get('#color-picker-1-basic-color-2')
-			.click();
-
-		cy.get('#color-picker-1-tint-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(1, 2, 2);
 
 		triggerNewSVG();
 
diff --git a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
index ffab7b1b4..5a869a821 100644
--- a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
@@ -78,11 +78,7 @@ describe('Changing slide properties.', function() {
 		cy.get('#fillattr')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5);
 
 		cy.get('#fillattr .color-sample-selected')
 			.should('have.attr', 'style', 'background-color: rgb(0, 255, 0);');
@@ -122,20 +118,12 @@ describe('Changing slide properties.', function() {
 		cy.get('#fillattr2')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 2);
 
 		cy.get('#fillattr3')
 			.click();
 
-		cy.get('#color-picker-1-basic-color-4')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(1, 4);
 
 		cy.get('#fillattr2 .color-sample-selected')
 			.should('have.attr', 'style', 'background-color: rgb(255, 0, 0);');
diff --git a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js
index 00f16ce7c..66f08c90a 100644
--- a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js
@@ -181,14 +181,7 @@ describe('Apply font changes.', function() {
 		cy.get('#FontColor')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-5')
-			.click();
-
-		cy.get('#color-picker-0-tint-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 5, 2);
 
 		writerHelper.selectAllMobile();
 
@@ -201,14 +194,7 @@ describe('Apply font changes.', function() {
 		cy.get('#BackColor')
 			.click();
 
-		cy.get('#color-picker-1-basic-color-5')
-			.click();
-
-		cy.get('#color-picker-1-tint-4')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(1, 5, 4);
 
 		writerHelper.selectAllMobile();
 
diff --git a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
index 5354bb11e..cad5333ae 100644
--- a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
@@ -152,14 +152,7 @@ describe('Apply paragraph properties.', function() {
 		cy.get('#BackgroundColor')
 			.click();
 
-		cy.get('#color-picker-2-basic-color-5')
-			.click();
-
-		cy.get('#color-picker-2-tint-2')
-			.click();
-
-		cy.get('#mobile-wizard-back')
-			.click();
+		mobileHelper.selectFromColorPalette(2, 5, 2);
 
 		writerHelper.selectAllMobile();
 
diff --git a/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
index 14b57ba65..771ca3e4b 100644
--- a/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
@@ -88,8 +88,7 @@ describe('Pushing bottom toolbar items.', function() {
 		cy.get('#tb_editbar_item_fontcolor')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-7')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 7);
 
 		cy.get('.w2ui-tb-image.w2ui-icon.textcolor')
 			.should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(0, 0, 255) 0px -6px inset;');
@@ -104,8 +103,7 @@ describe('Pushing bottom toolbar items.', function() {
 		cy.get('#tb_editbar_item_backcolor')
 			.click();
 
-		cy.get('#color-picker-0-basic-color-9')
-			.click();
+		mobileHelper.selectFromColorPalette(0, 9);
 
 		cy.get('.w2ui-tb-image.w2ui-icon.backcolor')
 			.should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(255, 0, 255) 0px -6px inset;');


More information about the Libreoffice-commits mailing list