Skip to content

Commit

Permalink
Merge pull request #734 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: v3.8.5
  • Loading branch information
themightychris authored Nov 24, 2022
2 parents 67e714d + e0ca99c commit fa3c450
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 46 deletions.
291 changes: 290 additions & 1 deletion cypress/integration/cbl/admin/tasks-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('CBL / Admin / Tasks Manager', () => {

// load sample database before tests
before(() => {
// cy.resetDatabase();
cy.resetDatabase();
});

// authenticate as 'teacher' user
Expand Down Expand Up @@ -93,6 +93,7 @@ describe('CBL / Admin / Tasks Manager', () => {

cy.root()
.get('.x-form-field[name="Title"]')
.should('have.value', 'Created Test Task Title')
.click();

cy.focused()
Expand Down Expand Up @@ -165,6 +166,89 @@ describe('CBL / Admin / Tasks Manager', () => {
});
});

it('Verify buttons disabled when no selection', () => {

// open student demonstrations dashboard
cy.visit('/cbl/dashboards/tasks/manager');

// verify app loaded
cy.extGet('slate-tasks-manager')
.should('exist')
.contains('.slate-apptitle', 'Task Library');

// wait for data load
cy.wait('@tasksData');

// verify create button not disabled
cy.extGet('slate-tasks-manager-appheader button[action=create]')
.should('exist')
.should('not.have.class', 'x-btn-disabled')

// verify edit button disabled
cy.extGet('slate-tasks-manager-appheader button[action=edit]')
.should('exist')
.should('have.class', 'x-btn-disabled')

// verify delete button disabled
cy.extGet('slate-tasks-manager-appheader button[action=delete]')
.should('exist')
.should('have.class', 'x-btn-disabled')

// select the first grid cell
cy.get('.x-grid-cell-inner')
.first()
.click();

// verify edit button not disabled after selection
cy.extGet('slate-tasks-manager-appheader button[action=edit]')
.should('exist')
.should('not.have.class', 'x-btn-disabled')

// verify delete button not disabled after selection
cy.extGet('slate-tasks-manager-appheader button[action=delete]')
.should('exist')
.should('not.have.class', 'x-btn-disabled')
});

it('Verify grid filtering for archived tasks', () => {

// open student demonstrations dashboard
cy.visit('/cbl/dashboards/tasks/manager');

// verify app loaded
cy.extGet('slate-tasks-manager')
.should('exist')
.contains('.slate-apptitle', 'Task Library');

// wait for data load
cy.wait('@tasksData');

// verify that the archived task is not present
cy.extGet('slate-tasks-manager')
.should('exist')
.contains('.x-grid-cell-inner', 'An Archived Task')
.should('not.exist');

// open options menu
cy.extGet('slate-tasks-manager-grid button[action=settings]')
.should('exist')
.click();

// check 'include unshared' option
cy.extGet('slate-tasks-manager-grid menucheckitem[name=include-archived]')
.should('exist')
.click();

// wait for data load after option change
cy.wait('@tasksData');

// verify that archived task is present
cy.extGet('slate-tasks-manager')
.should('exist')
.contains('.x-grid-cell-inner', 'An Archived Task')
.should('exist');
});

it('Verify grid filtering for shared and unshared tasks', () => {

// open student demonstrations dashboard
Expand Down Expand Up @@ -264,7 +348,212 @@ describe('CBL / Admin / Tasks Manager', () => {
.contains('.x-boundlist-item', 'An UnShared Task')
.should('not.exist');
});
});

it('Verify sorting by column', () => {
var items;

// open student demonstrations dashboard
cy.visit('/cbl/dashboards/tasks/manager');

// verify app loaded
cy.extGet('slate-tasks-manager')
.should('exist')
.contains('.slate-apptitle', 'Task Library');

// wait for data load
cy.wait('@tasksData');

cy.extGet('slate-tasks-manager')
.should('not.have.class', 'is-loading');


/** Title column */
// click title column header to sort alphabetically
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.click();

// wait for data load
cy.wait('@tasksData');

// verify the sort order icon in column header
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.should('have.class', 'x-column-header-sort-ASC')

// verify column is sorted in alphabetical order
items = _getColumnValues(0);
cy.expect(items, 'Title column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click title column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.click();

// wait for data load
cy.wait('@tasksData');

// verify the sort order icon in column header
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Title')
.should('have.class', 'x-column-header-sort-DESC')

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(0);
cy.expect(items, 'Title column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());


/** Parent Task column */
// click Parent Task column header to sort alphabetically
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Subtask of')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(1);
cy.expect(items, 'Parent Task column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click Parent Task column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Subtask of')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(1);
cy.expect(items, 'Parent Task column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());


/** Experience Type column */
// click Experience Type column header to sort alphabetically
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Type of Exp.')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(2);
cy.expect(items, 'Experience Type column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click Experience Type column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Type of Exp.')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(2);
cy.expect(items, 'Experience Type column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());


/** Skills column */
// click Skills column header to sort alphabetically
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Skills')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(3);
cy.expect(items, 'Skills column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click Skills column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Skills')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(3);
cy.expect(items, 'Skills column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());


/** Creator column */
// click Creator column header to sort alphabetically
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Created by')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(4);
cy.expect(items, 'Creator column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click Creator column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.contains('.x-column-header', 'Created by')
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(4);
cy.expect(items, 'Creator column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());


/** Creation Date column */
// click Creation Date column header to sort alphabetically (access by index rather than text)
cy.get('.x-grid-header-ct', { log: false })
.find('.x-column-header .x-column-header-text', { log: false })
.eq(5, { log: false })
.then(($div) => {
expect($div).to.have.text('Created')
})
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in alphabetical order
items = _getColumnValues(5);
cy.expect(items, 'Creation Date column: items are sorted in alphabetical order.').to.deep.equal(items.slice().sort());

// click Creation Date column header to reverse sort
cy.get('.x-grid-header-ct', { log: false })
.find('.x-column-header .x-column-header-text', { log: false })
.eq(5, { log: false })
.then(($div) => {
expect($div).to.have.text('Created')
})
.click();

// wait for data load
cy.wait('@tasksData');

// verify column is sorted in reverse alphabetical order
items = _getColumnValues(5);
cy.expect(items, 'Creation Date column: items are sorted in reverse alphabetical order.').to.deep.equal(items.slice().sort().reverse());

});

function _getColumnValues(col) {
let items = [];
cy.get('.x-grid-row', { log: false })
.each(($row) => {
cy.wrap($row, { log: false })
.find('.x-grid-cell-inner', { log: false })
.eq(col, { log: false })
.should(($div) => {
items.push($div.text().trim());
})
})
return items;
};
});
2 changes: 2 additions & 0 deletions fixtures/cbl_student_tasks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ INSERT INTO `cbl_student_tasks` VALUES (210,'Slate\\CBL\\Tasks\\StudentTask','20
INSERT INTO `cbl_student_tasks` VALUES (211,'Slate\\CBL\\Tasks\\StudentTask','2022-08-09 21:22:53',3,NULL,NULL,14,10,'assigned',NULL,NULL,NULL);
INSERT INTO `cbl_student_tasks` VALUES (212,'Slate\\CBL\\Tasks\\StudentTask','2022-10-28 16:16:28',3,NULL,NULL,47,4,'assigned',NULL,NULL,NULL);
INSERT INTO `cbl_student_tasks` VALUES (213,'Slate\\CBL\\Tasks\\StudentTask','2022-10-28 16:16:28',3,NULL,NULL,47,6,'assigned',NULL,NULL,NULL);
INSERT INTO `cbl_student_tasks` VALUES (214,'Slate\\CBL\\Tasks\\StudentTask','2022-11-17 21:00:26',3,NULL,NULL,48,4,'assigned',NULL,NULL,NULL);
INSERT INTO `cbl_student_tasks` VALUES (215,'Slate\\CBL\\Tasks\\StudentTask','2022-11-17 21:00:26',3,NULL,NULL,48,6,'assigned',NULL,NULL,NULL);


CREATE TABLE `history_cbl_student_tasks` (
Expand Down
2 changes: 2 additions & 0 deletions fixtures/cbl_task_skills.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ INSERT INTO `cbl_task_skills` VALUES (117,'Slate\\CBL\\Tasks\\TaskSkill','2022-1
INSERT INTO `cbl_task_skills` VALUES (118,'Slate\\CBL\\Tasks\\TaskSkill','2022-10-28 16:16:28',3,NULL,NULL,47,62);
INSERT INTO `cbl_task_skills` VALUES (119,'Slate\\CBL\\Tasks\\TaskSkill','2022-10-28 16:17:07',3,NULL,NULL,46,61);
INSERT INTO `cbl_task_skills` VALUES (120,'Slate\\CBL\\Tasks\\TaskSkill','2022-10-28 16:17:07',3,NULL,NULL,46,62);
INSERT INTO `cbl_task_skills` VALUES (121,'Slate\\CBL\\Tasks\\TaskSkill','2022-11-17 21:00:26',3,NULL,NULL,48,61);
INSERT INTO `cbl_task_skills` VALUES (122,'Slate\\CBL\\Tasks\\TaskSkill','2022-11-17 21:00:26',3,NULL,NULL,48,62);


CREATE TABLE `history_cbl_task_skills` (
Expand Down
1 change: 1 addition & 0 deletions fixtures/cbl_tasks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ INSERT INTO `cbl_tasks` VALUES (44,'Slate\\CBL\\Tasks\\ExperienceTask','2021-05-
INSERT INTO `cbl_tasks` VALUES (45,'Slate\\CBL\\Tasks\\ExperienceTask','2021-05-29 14:14:45',5,NULL,NULL,7,'Reflection: Who Gets a Vote','reflection--who_gets_a_vote',NULL,21,NULL,'shared','Complete the reflection google form.',NULL,NULL,'Studio');
INSERT INTO `cbl_tasks` VALUES (46,'Slate\\CBL\\Tasks\\ExperienceTask','2022-10-28 16:13:22',3,'2022-10-28 16:17:07',3,0,'A Shared Task','a_shared_task',NULL,NULL,NULL,'shared','A shared task that will be used to test the filtering of shared and unshared tasks',NULL,NULL,'Studio');
INSERT INTO `cbl_tasks` VALUES (47,'Slate\\CBL\\Tasks\\ExperienceTask','2022-10-28 16:16:28',3,NULL,NULL,1,'An Unshared Task','an_unshared_task',NULL,NULL,NULL,'private','An unshared task that will be used to test the filtering of shared and unshared tasks',NULL,NULL,'Studio');
INSERT INTO `cbl_tasks` VALUES (48,'Slate\\CBL\\Tasks\\ExperienceTask','2022-11-17 21:00:26',3,'2022-11-17 21:00:35',3,1,'An Archived Task','an_archived_task',NULL,46,NULL,'archived','An archived task that will be used to test the filtering of archived tasks',NULL,NULL,'Studio');


CREATE TABLE `history_cbl_tasks` (
Expand Down
Loading

0 comments on commit fa3c450

Please sign in to comment.