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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 12:44:14 UTC 2020


 cypress_test/data/mobile/calc/cell_appearance.ods                  |binary
 cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js |  286 ++++++++++
 2 files changed, 286 insertions(+)

New commits:
commit 227b9812b8f20d6de8145eda4c11391f6de4a053
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Apr 20 11:55:03 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Apr 20 14:43:56 2020 +0200

    cypress: mobile: add tests for calc cell appearance options.
    
    Change-Id: I452c07a01f903edfffaeb63042418534ed0ae039
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92564
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/data/mobile/calc/cell_appearance.ods b/cypress_test/data/mobile/calc/cell_appearance.ods
new file mode 100644
index 000000000..f454b1971
Binary files /dev/null and b/cypress_test/data/mobile/calc/cell_appearance.ods differ
diff --git a/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js
new file mode 100644
index 000000000..5ddb947df
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js
@@ -0,0 +1,286 @@
+/* global describe it cy beforeEach require afterEach expect*/
+
+var helper = require('../../common/helper');
+var mobileHelper = require('../../common/mobile_helper');
+var calcHelper = require('./calc_helper');
+
+describe('Change cell appearance.', function() {
+	beforeEach(function() {
+		mobileHelper.beforeAllMobile('cell_appearance.ods', 'calc');
+
+		// Click on edit button
+		mobileHelper.enableEditingMobile();
+	});
+
+	afterEach(function() {
+		helper.afterAll('cell_appearance.ods');
+	});
+
+	function openAppearencePanel() {
+		mobileHelper.openMobileWizard();
+
+		cy.get('#ScCellAppearancePropertyPanel')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Background Color')
+			.should('be.visible');
+	}
+
+	function openAppearencePanelOnFirtsCell() {
+		calcHelper.clickOnFirstCell();
+
+		openAppearencePanel();
+	}
+
+	function openAppearencePanelOnAllCells() {
+		calcHelper.selectAllMobile();
+
+		openAppearencePanel();
+	}
+
+	it('Apply backgound color', function() {
+		openAppearencePanelOnFirtsCell();
+
+		// Select a new color
+		cy.get('#BackgroundColor')
+			.click();
+
+		cy.get('#color-picker-1-basic-color-2')
+			.click();
+
+		cy.get('#mobile-wizard-back')
+			.click();
+
+		// Check that the color is shown as selected
+		cy.get('#BackgroundColor .color-sample-selected')
+			.should('have.attr', 'style', 'background-color: rgb(255, 0, 0);');
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'bgcolor', '#FF0000');
+	});
+
+	it('Apply left border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-2')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-left: 1px solid #000000');
+	});
+
+	it('Remove cell border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		// First add left border
+		cy.get('#border-2')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-left: 1px solid #000000');
+
+		// Then remove it
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-1')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('not.have.attr', 'style');
+	});
+
+	it('Apply right border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-3')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-right: 1px solid #000000');
+	});
+
+	it('Apply left and right border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-4')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-left: 1px solid #000000; border-right: 1px solid #000000');
+	});
+
+	it('Apply top border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-5')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-top: 1px solid #000000');
+	});
+
+	it('Apply bottom border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-6')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-bottom: 1px solid #000000');
+	});
+
+	it('Apply top and bottom border', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-7')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000');
+	});
+
+	it('Apply border for all sides', function() {
+		openAppearencePanelOnFirtsCell();
+
+		cy.get('#border-8')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+	});
+
+	it('Apply horizontal borders for multiple cells', function() {
+		openAppearencePanelOnAllCells();
+
+		cy.get('#border-9')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.then(function(cells) {
+				for (var i = 0; i < cells.length; i++) {
+					expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000');
+				}
+			});
+	});
+
+	it('Apply horizontal inner borders and vertical outer borders', function() {
+		openAppearencePanelOnAllCells();
+
+		cy.get('#border-10')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.then(function(cells) {
+				for (var i = 0; i < cells.length; i++) {
+					if (i == 0)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000');
+					else if (i == 1)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000');
+					else if (i == 2)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000');
+					else
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000');
+				}
+			});
+	});
+
+	it('Apply vertical inner borders and horizontal outer borders', function() {
+		openAppearencePanelOnAllCells();
+
+		cy.get('#border-11')
+			.click();
+
+		// TODO
+		cy.wait(200);
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.then(function(cells) {
+				for (var i = 0; i < cells.length; i++) {
+					if (i == 0)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else if (i == 1)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else if (i == 2)
+						expect(cells[i]).to.have.attr('style', 'border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else
+						expect(cells[i]).to.have.attr('style', 'border-left: 1px solid #000000; border-right: 1px solid #000000');
+				}
+			});
+	});
+
+	it('Apply all inner and outer borders', function() {
+		openAppearencePanelOnAllCells();
+
+		cy.get('#border-12')
+			.click();
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.then(function(cells) {
+				for (var i = 0; i < cells.length; i++) {
+					if (i == 0)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else if (i == 1)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else if (i == 2)
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+					else
+						expect(cells[i]).to.have.attr('style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000');
+				}
+			});
+	});
+
+	it('Apply border color', function() {
+		openAppearencePanelOnFirtsCell();
+
+		// Apply left border first
+		cy.get('#border-2')
+			.click();
+
+		// Then apply border color
+		cy.get('#FrameLineColor')
+			.click();
+
+		cy.get('#color-picker-2-basic-color-3')
+			.click();
+
+		cy.get('#mobile-wizard-back')
+			.click();
+
+		// Check that the color is shown as selected
+		cy.get('#FrameLineColor .color-sample-selected')
+			.should('have.attr', 'style', 'background-color: rgb(255, 153, 0);');
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'style', 'border-left: 1px solid #ff9900');
+	});
+});


More information about the Libreoffice-commits mailing list