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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 6 15:53:55 UTC 2020


 cypress_test/integration_tests/mobile/calc/number_format_spec.js                |   29 ---
 cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js |   15 -
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js              |    8 -
 cypress_test/integration_tests/mobile/writer/shape_properties_spec.js           |   24 ---
 cypress_test/integration_tests/mobile/writer/table_properties_spec.js           |   80 ----------
 cypress_test/package.json                                                       |    1 
 cypress_test/plugins/blacklists.js                                              |   47 +++++
 cypress_test/plugins/index.js                                                   |   34 ++++
 8 files changed, 86 insertions(+), 152 deletions(-)

New commits:
commit 5149305dbaae3b3b0178439f74e57718cdb1edaf
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jun 5 16:42:23 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Jun 6 17:53:37 2020 +0200

    cypress: better way of filter out tests based on core version.
    
    We use cypress-select-tests to filter out tests before
    the tests are started. One advantage is that these tests
    are showed as skipped in the log and also beforeAll() is
    not called for these test cases which can speed things up.
    
    Also we can avoid to add too much noise to the test code.
    When we are working with more branches, we can just add
    blacklists separately for all branches.
    
    Change-Id: Ie7808614e42a19a0820f372720cc391511e165f5
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95585
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/integration_tests/mobile/calc/number_format_spec.js b/cypress_test/integration_tests/mobile/calc/number_format_spec.js
index bda3bd847..1b2336068 100644
--- a/cypress_test/integration_tests/mobile/calc/number_format_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/number_format_spec.js
@@ -49,11 +49,8 @@ describe('Apply number formatting.', function() {
 	it('Select percent format from list.', function() {
 		selectFormatting('Percent');
 
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() !== 'master')
-			cy.get('#NumberFormatPercentimg')
-				.should('have.class', 'selected');
+		cy.get('#NumberFormatPercentimg')
+			.should('have.class', 'selected');
 
 		// Decimal and leading zeros are changed.
 		cy.get('#decimalplaces input')
@@ -72,11 +69,6 @@ describe('Apply number formatting.', function() {
 	});
 
 	it('Push percent button.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		// Change to percent
 		cy.get('#NumberFormatPercent')
 			.click();
@@ -106,11 +98,8 @@ describe('Apply number formatting.', function() {
 	it('Select currency format from list.', function() {
 		selectFormatting('Currency');
 
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() !== 'master')
-			cy.get('#NumberFormatCurrencyimg')
-				.should('have.class', 'selected');
+		cy.get('#NumberFormatCurrencyimg')
+			.should('have.class', 'selected');
 
 		// Decimal and leading zeros are changed.
 		cy.get('#decimalplaces input')
@@ -129,11 +118,6 @@ describe('Apply number formatting.', function() {
 	});
 
 	it('Push currency button.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		// Change to currency
 		cy.get('#NumberFormatCurrency')
 			.click();
@@ -161,11 +145,6 @@ describe('Apply number formatting.', function() {
 	});
 
 	it('Push number button.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		// Change to currency first
 		cy.get('#NumberFormatCurrency')
 			.click();
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 c6d1be104..5f897285d 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
@@ -113,11 +113,6 @@ describe('Apply paragraph properties.', function() {
 	});
 
 	it('Apply default bulleting.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		cy.get('#DefaultBullet')
 			.click();
 
@@ -128,11 +123,6 @@ describe('Apply paragraph properties.', function() {
 	});
 
 	it('Apply default numbering.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		cy.get('#DefaultNumbering')
 			.click();
 
@@ -143,11 +133,6 @@ describe('Apply paragraph properties.', function() {
 	});
 
 	it('Apply background color.', function() {
-		// TODO: Why this item is missing with core/master
-		// In desktop LO, sidebar contains this item.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		// Change background color
 		cy.get('#BackgroundColor')
 			.click();
diff --git a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
index bf60bcb7d..3267c1796 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -64,10 +64,6 @@ describe('Insert objects via insertion wizard.', function() {
 	});
 
 	it('Insert default table.', function() {
-		// TODO: Select all does not work with core/master
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		mobileHelper.openInsertionWizard();
 
 		// Open Table submenu
@@ -97,10 +93,6 @@ describe('Insert objects via insertion wizard.', function() {
 	});
 
 	it('Insert custom table.', function() {
-		// TODO: Select all does not work with core/master
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		mobileHelper.openInsertionWizard();
 
 		// Open Table submenu
diff --git a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js
index deeaa76a7..33ee95f7f 100644
--- a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js
@@ -115,10 +115,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it.skip('Change size with keep ratio enabled.', function() {
-		// TODO: Entering a value inside the spinbutton has no effect on the shape.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openPosSizePanel();
 
 		// Enable keep ratio
@@ -194,10 +190,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it('Change line color', function() {
-		// TODO: Layout of the line properties panel is completely broken.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openLinePropertyPanel();
 
 		cy.get('#XLineColor')
@@ -213,10 +205,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it.skip('Change line style', function() {
-		// TODO: Layout of the line properties panel is completely broken.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openLinePropertyPanel();
 
 		cy.get('#linestyle')
@@ -232,10 +220,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it('Change line width', function() {
-		// TODO: Layout of the line properties panel is completely broken.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openLinePropertyPanel();
 
 		cy.get('#linewidth .spinfield')
@@ -261,10 +245,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it('Change line transparency', function() {
-		// TODO: Layout of the line properties panel is completely broken.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openLinePropertyPanel();
 
 		cy.get('#linetransparency .spinfield')
@@ -282,10 +262,6 @@ describe('Change shape properties via mobile wizard.', function() {
 	});
 
 	it('Arrow style items are hidden.', function() {
-		// TODO: Layout of the line properties panel is completely broken.
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		openLinePropertyPanel();
 
 		cy.get('#linestyle')
diff --git a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js
index 14b2bd73d..e7e0f4acd 100644
--- a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js
@@ -44,11 +44,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	}
 
 	it('Insert row before.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -73,11 +68,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Insert row after.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -102,11 +92,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Insert column before.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -131,11 +116,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Insert column after.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -160,11 +140,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Delete row.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -189,11 +164,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Delete column.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -219,11 +189,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Delete table.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -248,11 +213,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Merge cells.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		moveCursorToFirstCell();
@@ -276,11 +236,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Change row height.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -304,11 +259,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Change column width.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_properties.odt');
 
 		openTablePanel();
@@ -332,11 +282,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Set minimal row height.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
@@ -357,11 +302,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Set optimal row height.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
@@ -391,11 +331,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Distribute rows.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
@@ -425,11 +360,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Set minimal column width.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
@@ -448,11 +378,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Set optimal column width.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
@@ -473,11 +398,6 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	it('Distribute columns.', function() {
-		// TODO: Select all does not work with core/master
-		// Table panel layout is also broken
-		if (helper.getLOVersion() === 'master')
-			return;
-
 		before('table_with_text.odt');
 
 		moveCursorToFirstCell();
diff --git a/cypress_test/package.json b/cypress_test/package.json
index ed53b645b..55b4d799d 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -6,6 +6,7 @@
   "dependencies": {
     "cypress": "4.5.0",
     "cypress-failed-log": "2.6.2",
+    "cypress-select-tests": "1.5.7",
     "eslint": "6.8.0",
     "eslint-plugin-cypress-rules": "file:eslint_plugin",
     "get-port-cli": "2.0.0",
diff --git a/cypress_test/plugins/blacklists.js b/cypress_test/plugins/blacklists.js
new file mode 100644
index 000000000..ebb392752
--- /dev/null
+++ b/cypress_test/plugins/blacklists.js
@@ -0,0 +1,47 @@
+var testBlackLists = {
+	'master': [
+		['mobile/writer/table_properties_spec.js',
+			[]
+		],
+		['mobile/writer/shape_properties_spec.js',
+			[
+				'Change size with keep ratio enabled.',
+				'Change line color',
+				'Change line style',
+				'Change line width',
+				'Change line transparency',
+				'Arrow style items are hidden.'
+			]
+		],
+		['mobile/writer/apply_paragraph_properties_spec.js',
+			[
+				'Apply default bulleting.',
+				'Apply default numbering.',
+				'Apply background color.'
+			]
+		],
+		['mobile/writer/insert_object_spec.js',
+			[
+				'Insert default table.',
+				'Insert custom table.'
+			]
+		],
+		['mobile/writer/apply_font_spec.js',
+			[
+				'Insert default table.',
+				'Insert custom table.'
+			]
+		],
+		['mobile/calc/number_format_spec.js',
+			[
+				'Select percent format from list.',
+				'Push percent button.',
+				'Select currency format from list.',
+				'Push currency button.',
+				'Push number button.'
+			]
+		],
+	]
+};
+
+module.exports.testBlackLists = testBlackLists;
diff --git a/cypress_test/plugins/index.js b/cypress_test/plugins/index.js
index 859088da4..78ea17d25 100644
--- a/cypress_test/plugins/index.js
+++ b/cypress_test/plugins/index.js
@@ -2,6 +2,8 @@
 
 var process = require('process');
 var tasks = require('./tasks');
+var blacklists = require('./blacklists');
+var selectTests = require('cypress-select-tests');
 
 function plugin(on, config) {
 	on('task', {
@@ -17,7 +19,39 @@ function plugin(on, config) {
 		}
 	});
 
+	on('file:preprocessor', selectTests(config, pickTests));
+
 	return config;
 }
 
+function getLOVersion(config) {
+	var versionString = config.env.LO_CORE_VERSION;
+	if (versionString.includes('Collabora')) {
+		if (versionString.includes(' 6.2.')) {
+			return 'cp-6-2';
+		} else if (versionString.includes(' 6.4.')) {
+			return 'cp-6-4';
+		}
+	}
+	return 'master';
+}
+
+function pickTests(filename, foundTests, config) {
+
+	var coreVersion = getLOVersion(config);
+	var testsToRun = foundTests;
+	if (!(coreVersion in blacklists.testBlackLists))
+		return testsToRun;
+
+	var blackList = blacklists.testBlackLists[coreVersion];
+	for (var i = 0; i < blackList.length; i++) {
+		if (filename.endsWith(blackList[i][0])) {
+			if (blackList[i][1].length === 0) // skip the whole test suite
+				return [];
+			testsToRun = testsToRun.filter(fullTestName => !blackList[i][1].includes(fullTestName[1]));
+		}
+	}
+	return testsToRun;
+}
+
 module.exports = plugin;


More information about the Libreoffice-commits mailing list