Added UX Tests for column / Edit cells / Common transforms (#3683)

* added tests for common-transforms

* Update Replace-Smart-quotes-with-ascii.spec.js

* changed spec name

convert the column to the number and then test the conversion to text

* Used cy.castColumnTo() to cast to-number before testing to-text

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
S-Harshit 2021-03-04 18:21:03 +05:30 committed by GitHub
parent b519232749
commit 9760380150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,37 @@
describe(__filename, function () {
it('Ensures Smart quotes are replaced by ascii', function () {
const fixture = [
['Smartquotes', 'ascii', 'noquote'],
['“0a”', "'0b'", '0c'],
['1a', "'1b'", '1c'],
];
cy.loadAndVisitProject(fixture);
cy.columnActionClick('Smartquotes', [
'Edit cells',
'Common transforms',
'Replace Smart quotes with ascii',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column Smartquotes'
);
cy.assertCellEquals(0, 'Smartquotes', '"0a"');
cy.assertCellEquals(1, 'Smartquotes', "'1a'");
cy.columnActionClick('ascii', [
'Edit cells',
'Common transforms',
'Replace Smart quotes with ascii',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 0 cells in column ascii'
);
cy.assertCellEquals(0, 'ascii', "'0b'");
cy.assertCellEquals(1, 'ascii', "'1b'");
});
});

View File

@ -0,0 +1,18 @@
describe(__filename, function () {
it('Ensures value in cells changes to empty string', function () {
cy.loadAndVisitProject('food.mini');
cy.columnActionClick('Shrt_Desc', [
'Edit cells',
'Common transforms',
'To empty string',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column Shrt_Desc: ""'
);
cy.assertCellEquals(0, 'Shrt_Desc', '');
cy.assertCellEquals(1, 'Shrt_Desc', '');
});
});

View File

@ -0,0 +1,18 @@
describe(__filename, function () {
it('Ensure values in cells are converted to lowercase', function () {
cy.loadAndVisitProject('food.mini');
cy.columnActionClick('Shrt_Desc', [
'Edit cells',
'Common transforms',
'To lowercase',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column Shrt_Desc: value.toLowercase()'
);
cy.assertCellEquals(0, 'Shrt_Desc', 'butter,with salt');
cy.assertCellEquals(1, 'Shrt_Desc', 'butter,whipped,with salt');
});
});

View File

@ -0,0 +1,18 @@
describe(__filename, function () {
it('Ensure values in cells are converted to null ', function () {
cy.loadAndVisitProject('food.mini');
cy.columnActionClick('Shrt_Desc', [
'Edit cells',
'Common transforms',
'To null',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column Shrt_Desc: null'
);
cy.assertCellEquals(0, 'Shrt_Desc', null);
cy.assertCellEquals(1, 'Shrt_Desc', null);
});
});

View File

@ -0,0 +1,21 @@
describe(__filename, function () {
it('Ensure number is converted to text', function () {
cy.loadAndVisitProject('food.mini');
cy.castColumnTo('NDB_No', 'number');
cy.columnActionClick('NDB_No', [
'Edit cells',
'Common transforms',
'To text',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column NDB_No: value.toString()'
);
cy.assertCellEquals(0, 'NDB_No', '1001');
cy.assertCellEquals(1, 'NDB_No', '1002');
});
});

View File

@ -0,0 +1,18 @@
describe(__filename, function () {
it('Ensure text conversion to titlecase', function () {
cy.loadAndVisitProject('food.mini');
cy.columnActionClick('Shrt_Desc', [
'Edit cells',
'Common transforms',
'To titlecase',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 2 cells in column Shrt_Desc: value.toTitlecase() '
);
cy.assertCellEquals(0, 'Shrt_Desc', 'Butter,with Salt');
cy.assertCellEquals(1, 'Shrt_Desc', 'Butter,whipped,with Salt');
});
});

View File

@ -0,0 +1,18 @@
describe(__filename, function () {
it('Ensure text conversion to Uppercase', function () {
cy.loadAndVisitProject('food.mini');
cy.columnActionClick('Shrt_Desc', [
'Edit cells',
'Common transforms',
'To uppercase',
]);
// Check notification and cell content
cy.assertNotificationContainingText(
'Text transform on 0 cells in column Shrt_Desc: value.toUppercase()'
);
cy.assertCellEquals(0, 'Shrt_Desc', 'BUTTER,WITH SALT');
cy.assertCellEquals(1, 'Shrt_Desc', 'BUTTER,WHIPPED,WITH SALT');
});
});