Skip to content

Commit

Permalink
add test of removed users
Browse files Browse the repository at this point in the history
  • Loading branch information
scytacki committed Oct 2, 2024
1 parent 575ba10 commit 5eea6af
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions cypress/e2e/functional/document_tests/group_chooser_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ let student1 = '20',
student4 = '23',
student5 = '24',
student6 = '25',
// Students with ids higher than 99 are not part of the fake class
// that is setup for QA, Dev, and Demo modes. For the CLUE window
// that is showing a high id student they are added to the class,
// but for other CLUE windows they will not be part of the class.
// So when viewed in other CLUE windows this student will
// be considered not in the class.
studentNotInClass = '150',
fakeClass = '15',
problem = '1.1',
group1 = '20',
Expand Down Expand Up @@ -125,5 +132,48 @@ context('Test student join a group', function () {
clueHeader.getGroupName().should('contain', 'Group ' + group1);
header.getUserName().should('contain', 'Student ' + student1);
clueHeader.getGroupMembers().should('contain', 'S' + student1).and('have.length', 1);

cy.log('will verify a student removed from the class is not visible');
// have student6 leave first group so special student can join
setup(student6, { alreadyInGroup: true });
cy.get('.app .group > .name').contains('Group ' + group1).click();
cy.get("#okButton").should('contain', 'Yes').click();

// have special student join group 1
setup(studentNotInClass);
cy.wait(500);
cy.get('.groups > .group-list > .group').contains(group1).click();
clueHeader.getGroupName().should('contain', 'Group ' + group1);
header.getUserName().should('contain', 'Student ' + studentNotInClass);
clueHeader.getGroupMembers()
.should('contain', 'S' + student1)
.and('contain', 'S' + student2)
.and('contain', 'S' + student4)
.and('contain', 'S' + studentNotInClass);

// Need to wait more than 1s so the student not in the class is considered removed
cy.wait(1500);
// switch back to student 1
setup(student1, { alreadyInGroup: true });
clueHeader.getGroupName().should('contain', 'Group ' + group1);
header.getUserName().should('contain', 'Student ' + student1);
// The studentNotInClass should not show up now
clueHeader.getGroupMembers()
.should('contain', 'S' + student1)
.and('contain', 'S' + student2)
.and('contain', 'S' + student4)
.and('not.contain', '**') // these are the initials of new students
.and('not.contain', 'S' + studentNotInClass);

cy.log('verify a 4th student can join a group with a removed student');
setup(student6);
cy.get('.groups > .group-list > .group').contains(group1).click();
clueHeader.getGroupName().should('contain', 'Group ' + group1);
header.getUserName().should('contain', 'Student ' + student6);
clueHeader.getGroupMembers()
.should('contain', 'S' + student1)
.and('contain', 'S' + student2)
.and('contain', 'S' + student4)
.and('contain', 'S' + student6);
});
});

0 comments on commit 5eea6af

Please sign in to comment.