feat: add tests for special column All (#3769)
* feat: add tests for special column All
This commit is contained in:
parent
2f5c765b4d
commit
182f70729d
@ -0,0 +1,72 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure columns are reordered as per order', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', [
|
||||
'Edit columns',
|
||||
'Re-order / remove columns...',
|
||||
]);
|
||||
cy.waitForDialogPanel();
|
||||
|
||||
cy.dragAndDrop('div[column="Shrt_Desc"]', 'div[column="NDB_No"]');
|
||||
cy.dragAndDrop('div[column="Energ_Kcal"]', 'div[column="Water"]');
|
||||
|
||||
cy.confirmDialogPanel();
|
||||
|
||||
cy.assertNotificationContainingText('Reorder columns');
|
||||
|
||||
cy.assertGridEquals([
|
||||
['Shrt_Desc', 'NDB_No', 'Energ_Kcal', 'Water'],
|
||||
['BUTTER,WITH SALT', '01001', '717', '15.87'],
|
||||
['BUTTER,WHIPPED,WITH SALT', '01002', '717', '15.87'],
|
||||
]);
|
||||
});
|
||||
it('Ensure columns are removed using remove column', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', [
|
||||
'Edit columns',
|
||||
'Re-order / remove columns...',
|
||||
]);
|
||||
cy.waitForDialogPanel();
|
||||
|
||||
cy.dragAndDrop('div[column="Shrt_Desc"]', 'div[bind="trashContainer"]');
|
||||
cy.dragAndDrop('div[column="Water"]', 'div[bind="trashContainer"]');
|
||||
|
||||
cy.confirmDialogPanel();
|
||||
|
||||
cy.assertNotificationContainingText('Reorder columns');
|
||||
|
||||
cy.assertGridEquals([
|
||||
['NDB_No', 'Energ_Kcal'],
|
||||
['01001', '717'],
|
||||
['01002', '717'],
|
||||
]);
|
||||
});
|
||||
it('Ensure columns are blanked down', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit columns', 'Blank down']);
|
||||
|
||||
cy.assertGridEquals([
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '', ''],
|
||||
]);
|
||||
});
|
||||
it('Ensure columns are filled down', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit columns', 'Blank down']);
|
||||
|
||||
cy.assertGridEquals([
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '', ''],
|
||||
]);
|
||||
|
||||
cy.columnActionClick('All', ['Edit columns', 'Fill down']);
|
||||
|
||||
cy.assertGridEquals([
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
||||
]);
|
||||
});
|
||||
});
|
@ -0,0 +1,87 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure all rows are starred', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit rows', 'Star rows']);
|
||||
cy.assertNotificationContainingText('Star 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-on'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-on'
|
||||
);
|
||||
});
|
||||
it('Ensure all rows are unstarred', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit rows', 'Star rows']);
|
||||
cy.assertNotificationContainingText('Star 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-on'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-on'
|
||||
);
|
||||
cy.columnActionClick('All', ['Edit rows', 'Unstar rows']);
|
||||
cy.assertNotificationContainingText('Unstar 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-off'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(1) a').should(
|
||||
'have.class',
|
||||
'data-table-star-off'
|
||||
);
|
||||
});
|
||||
it('Ensure all rows are flagged', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit rows', 'Flag rows']);
|
||||
cy.assertNotificationContainingText('Flag 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-on'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-on'
|
||||
);
|
||||
});
|
||||
it('Ensure all rows are unflagged', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit rows', 'Flag rows']);
|
||||
cy.assertNotificationContainingText('Flag 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-on'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-on'
|
||||
);
|
||||
cy.columnActionClick('All', ['Edit rows', 'Unflag rows']);
|
||||
cy.assertNotificationContainingText('Unflag 2 rows');
|
||||
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-off'
|
||||
);
|
||||
cy.get('.data-table tr:nth-child(2) td:nth-child(2) a').should(
|
||||
'have.class',
|
||||
'data-table-flag-off'
|
||||
);
|
||||
});
|
||||
it('Ensure it removes matching rows', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['Edit rows', 'Remove matching rows']);
|
||||
cy.assertNotificationContainingText('Remove 2 rows');
|
||||
|
||||
cy.assertGridEquals([['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal']]);
|
||||
});
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
describe(__filename, function () {
|
||||
it('Ensure flag is visible and toggle on/off', function () {
|
||||
it('Ensure star is visible and toggle on/off', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.get('.data-table tr:nth-child(1) td:nth-child(1) a')
|
||||
.should('have.class', 'data-table-star-off')
|
||||
|
@ -0,0 +1,31 @@
|
||||
describe(__filename, function () {
|
||||
it('it collapses all columns', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['View', 'Collapse all columns']);
|
||||
|
||||
cy.get('.odd td:nth-child(4)').should('to.contain', '');
|
||||
cy.get('.odd td:nth-child(5)').should('to.contain', '');
|
||||
cy.get('.odd td:nth-child(6)').should('to.contain', '');
|
||||
cy.get('.odd td:nth-child(7)').should('to.contain', '');
|
||||
|
||||
cy.get('.even td:nth-child(4)').should('to.contain', '');
|
||||
cy.get('.even td:nth-child(5)').should('to.contain', '');
|
||||
cy.get('.even td:nth-child(6)').should('to.contain', '');
|
||||
cy.get('.even td:nth-child(7)').should('to.contain', '');
|
||||
});
|
||||
it('it expands all columns', function () {
|
||||
cy.loadAndVisitProject('food.mini');
|
||||
cy.columnActionClick('All', ['View', 'Collapse all columns']);
|
||||
|
||||
cy.get('.odd td:nth-child(4)').should('to.contain', '');
|
||||
cy.get('.even td:nth-child(7)').should('to.contain', '');
|
||||
|
||||
cy.columnActionClick('All', ['View', 'Expand all columns']);
|
||||
|
||||
cy.assertGridEquals([
|
||||
['NDB_No', 'Shrt_Desc', 'Water', 'Energ_Kcal'],
|
||||
['01001', 'BUTTER,WITH SALT', '15.87', '717'],
|
||||
['01002', 'BUTTER,WHIPPED,WITH SALT', '15.87', '717'],
|
||||
]);
|
||||
});
|
||||
});
|
@ -19,7 +19,7 @@ describe(__filename, function () {
|
||||
cy.waitForDialogPanel();
|
||||
|
||||
cy.get('input[column="NDB_No"]').check();
|
||||
cy.dragAndDrop('div[column="NDB_No', 'div[column="Shrt_Desc"]');
|
||||
cy.dragAndDrop('div[column="NDB_No"]', 'div[column="Shrt_Desc"]');
|
||||
|
||||
cy.confirmDialogPanel();
|
||||
|
||||
@ -46,7 +46,7 @@ describe(__filename, function () {
|
||||
cy.columnActionClick('Shrt_Desc', ['Edit column', 'Join columns...']);
|
||||
cy.waitForDialogPanel();
|
||||
|
||||
cy.dragAndDrop('div[column="NDB_No', 'div[column="Shrt_Desc"]');
|
||||
cy.dragAndDrop('div[column="NDB_No"]', 'div[column="Shrt_Desc"]');
|
||||
cy.get('input[column="NDB_No"]').check();
|
||||
cy.get('input[bind="field_separatorInput"]').type(':-:');
|
||||
|
||||
|
@ -322,7 +322,9 @@ Cypress.Commands.add(
|
||||
Cypress.Commands.add('dragAndDrop', (sourceSelector, targetSelector) => {
|
||||
cy.get(sourceSelector).trigger('mousedown', { which: 1 });
|
||||
|
||||
cy.get(targetSelector).trigger('mousemove').trigger('mouseup');
|
||||
cy.get(targetSelector)
|
||||
.trigger('mousemove')
|
||||
.trigger('mouseup', { force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
|
Loading…
Reference in New Issue
Block a user