Skip to content

Commit

Permalink
N21-1318 adjust tests for new class page changes (#154)
Browse files Browse the repository at this point in the history
* adjust for new column, create class via new class page
* request changes N21-1264
* add test for legacy functionality
  • Loading branch information
IgorCapCoder authored Nov 6, 2023
1 parent ba5ea50 commit ec4eecc
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 150 deletions.
20 changes: 20 additions & 0 deletions cypress/e2e/class_management/groupMembers.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#@release
@unstable_test
Feature: Group - To show members in a group

As a teacher I want to see the members in a group

Scenario: As a teacher I can manage a group of type class from external systems
Given I am logged in as a 'teacher1_nbc' at 'nbc'
When I go to administration page
When I go to new class administration page
Then I see the new class administration page
Then I can see the group 'Cypress-Test-Group' with source 'moin.schule'
Then I can see the manage button for group 'Cypress-Test-Group'
When I click the manage group button
Then I can see the manage group page
Then I can see the manage group page title
Then I can see the group member table
Then I can see the 'Lehrkraft' with name 'Herzog'
Then I can see the infobox
Then I can see the infotext
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#@release
@unstable_test
Feature: Group - To show groups and classes in one table with respective functionality

As a teacher I want to see all groups and classes belonging to my school.


Scenario: As a pre-condition teacher adds a class to school
Scenario: As a teacher i can add a class to school
Given I am logged in as a 'teacher1_nbc' at 'nbc'
When I go to administration page
And I go to class administration
And I click on add class
And I click on the confirm button
And I confirm managing the class
When I go to new class administration page
Then I see the new class administration page
When I click on add class
Then I can see the create class page
When I click the cancel create class button
Then I can see the cancel modal
When I click the confirmation button on the cancel modal
Then I see the new class administration page
When I click on add class
When I click on the confirm button
When I confirm managing the class
Then I see the new class administration page


Scenario: As a teacher i can see all classes and groups of my school on the new class administration page.
Given I see the new class administration page
Then I can see the page title
And I can see the group 'Cypress-Test-Group' with source 'moin.schule'
And I can see the class '1' without source
And the group 'Cypress-Test-Group' has a manage button
And the class '1' has 4 enabled action items

Then I can see 3 tabs
Then I can see 5 columns in the table
Then I can see the group 'Cypress-Test-Group' with source 'moin.schule'
Then I can see the class '1' without source
Then I can see the manage button for group 'Cypress-Test-Group'
Then I can see 4 enabled action items for class '1'

Scenario: As a teacher i can manage my classes
Given I see the new class administration page
Expand All @@ -32,10 +39,9 @@ Feature: Group - To show groups and classes in one table with respective functio
When I click the confirmation button on the cancel modal
Then I see the new class administration page
When I click the manage button
And I confirm managing the class
When I confirm managing the class
Then I see the new class administration page


Scenario: As a teacher i can edit my classes
Given I see the new class administration page
When I click the edit button
Expand All @@ -47,8 +53,7 @@ Feature: Group - To show groups and classes in one table with respective functio
When I click the edit button
When I click in the name suffix text element
Then I can click on the save changes button
And I see the new class administration page

Then I see the new class administration page

Scenario: As a teacher i can upgrade my upgradable classes
Given I see the new class administration page
Expand All @@ -62,8 +67,7 @@ Feature: Group - To show groups and classes in one table with respective functio
And I confirm creating the successor
And I confirm managing the class
Then I see the new class administration page
And the create successor button of the original class is disabled

Then I can see the disabled create successor button of the original class

Scenario: As a teacher i can delete my classes
Given I see the new class administration page
Expand All @@ -72,12 +76,19 @@ Feature: Group - To show groups and classes in one table with respective functio
When I click the cancel button on the delete modal
Then I see the new class administration page
When I click the delete button
And I click the confirmation button on the delete modal
When I click the confirmation button on the delete modal
Then I see the new class administration page


Scenario: As a post-condition teacher deletes the successor class and logs out
Given I see the new class administration page
When I click on the next year tab
When I click the delete button
And I click the confirmation button on the delete modal
When I click the confirmation button on the delete modal
Then I see the new class administration page

Scenario: As a teacher i can not see the new class page, when the feature flag is off
Given I am logged in as a 'teacher1_dbc' at 'default'
When I go to administration page
Then I cannot see the new class administration page
When I navigate to class administration page
Then I cannot see the source header in the table
20 changes: 0 additions & 20 deletions cypress/e2e/group/groupMembers.feature
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
@unstable_test
Feature: Group - To show members in a group

As a teacher I want to see the members in a group


Scenario: As a teacher I can manage a group of type class from external systems
Given I am logged in as a 'teacher1_nbc' at 'nbc'
When I go to administration page
And I go to new class administration page
Then I see the new class administration page
And I can see the group 'Cypress-Test-Group' with source 'moin.schule'
And the group 'Cypress-Test-Group' has a manage button
When I click the manage group button
Then I can see the manage group page
And I can see the manage group page title
And I can see the group member table
And I can see the 'Lehrkraft' with name 'Herzog'
And I can see the infobox
And I can see the infotext
2 changes: 1 addition & 1 deletion cypress/support/pages/admin/pageAdministration.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Management {
static #teacherAdministrationNavigationButton = '[data-testid="Lehrkräfte"]'
static #courseAdministrationNavigationButton = '[data-testid="Kurse"]'
static #classAdministrationNavigationButton = '[data-testid="Klassen"]'
static #newClassAdministrationNavigationButton = '[data-testid="administrate_classes_new"]'
static #newClassAdministrationNavigationButton = '[data-testid="administrate_classes"]'
static #teamAdministrationNavigationButton = '[data-testid="Teams"]'
static #schoolAdministrationNavigationButton = '[data-testid="Schule"]'
static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
'use strict'

class Groups {
static #createClass = '[data-testid="createClass"]';
class Classes {
static #createClass = '[data-testid="admin-class-add-button"]';
static #confirmClassCreate = '[data-testid="confirmClassCreate"]';
static #manageConfirm = '[data-testid="manage-confirm"]';
static #classTitleNew = '[data-testid="admin-class-title"]';
static #classTableNew = '[data-testid="admin-class-table"]';
static #nextYearTab = '[data-testid="admin-class-next-year-tab"]'
static #currentYearTab = '[data-testid="admin-class-current-year-tab"]'
static #previousYearsTab = '[data-testid="admin-class-previous-years-tab"]'
static #manageClassButton = '[data-testid="legacy-class-table-manage-btn"]';
static #cancelModal = '[data-testid="modal_content"]';
static #editClassButton = '[data-testid="class-table-edit-btn"]';
static #createSuccessorButton = '[data-testid="class-table-successor-btn"]';
static #deleteClassButton = '[data-testid="class-table-delete-btn"]';
static #deleteDialog = '.v-dialog--active';
static #deleteDialog = '[data-testid="dialog-title"]';
static #deleteDialogCancel = '[data-testid="dialog-cancel"]';
static #deleteDialogConfirm = '[data-testid="dialog-confirm"]';
static #adminGroupTitle = '[data-testid="admin-class-title"]';
static #groupMemberTable = '[data-testid="class-members-table"]';
static #classMemberInfoBox = '[data-testid="class-members-info-box"]';
static #classMemberInfoBoxText = '[data-testid="class-members-info-box-text"]';
static #manageGroupButton = '[data-testid="class-table-members-manage-btn"]';
static #adminClassNavigationSidebarCard = '[data-testid="Klassen"]';
static #adminClassNavigationCard = '[data-testid="administrate_classes"]'
static #legacyClassTable = '[data-testid="table_container"]'

clickCreateClass() {
cy.get(Groups.#createClass)
cy.get(Classes.#createClass)
.click();
}

clickConfirmCreateClass() {
cy.get(Groups.#confirmClassCreate)
cy.get(Classes.#confirmClassCreate)
.click();
}

clickConfirmManageClass() {
cy.get(Groups.#manageConfirm)
cy.get(Classes.#manageConfirm)
.click();
}

Expand All @@ -41,7 +47,7 @@ class Groups {
}

clickManageClassButton() {
cy.get(Groups.#manageClassButton)
cy.get(Classes.#manageClassButton)
.first().click();
}

Expand All @@ -51,7 +57,7 @@ class Groups {
}

clickEditClassButton() {
cy.get(Groups.#editClassButton)
cy.get(Classes.#editClassButton)
.first().click();
}

Expand All @@ -61,7 +67,7 @@ class Groups {
}

clickCreateSuccessorButton() {
cy.get(Groups.#createSuccessorButton)
cy.get(Classes.#createSuccessorButton)
.first().click();
}

Expand All @@ -79,17 +85,27 @@ class Groups {
}

clickDeleteButton() {
cy.get(Groups.#deleteClassButton)
cy.get(Classes.#deleteClassButton)
.first().click();
}

clickCancelDeleteDialogButton() {
cy.get(Groups.#deleteDialogCancel)
cy.get(Classes.#deleteDialogCancel)
.click();
}

clickConfirmDeleteDialogButton() {
cy.get(Groups.#deleteDialogConfirm)
cy.get(Classes.#deleteDialogConfirm)
.click();
}

clickManageGroupButton() {
cy.get(Classes.#manageGroupButton)
.first().click();
}

clickNextYearTab() {
cy.get(Classes.#nextYearTab)
.click();
}

Expand All @@ -108,7 +124,7 @@ class Groups {
}

isCancelModal() {
cy.get(Groups.#cancelModal).should('exist');
cy.get(Classes.#cancelModal).should('exist');
}

isCreateSuccessorPage() {
Expand All @@ -117,60 +133,77 @@ class Groups {
}

seeNewClassPageTitle() {
cy.get(Groups.#classTitleNew).should('exist');
cy.get(Classes.#classTitleNew).should('exist');
}

isSuccessorButtonDisabled() {
cy.get(Groups.#createSuccessorButton)
cy.get(Classes.#createSuccessorButton)
.first().should('have.class', 'v-btn--disabled');
}

isDeleteDialog() {
cy.get(Groups.#deleteDialog)
cy.get(Classes.#deleteDialog)
.should('be.visible');
}

newClassTableContainsClass(className, sourceName) {
const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className);
isCreateClassPage() {
cy.url().should('include', '/administration/classes');
cy.url().should('include', '/create');
}

seeNewClassTableContainsClass(className, sourceName) {
const classNameData = cy.get(Classes.#classTableNew).find('td').contains(className);

classNameData.should('be.visible');
classNameData.siblings('td').eq(0).should(($td) => {
expect($td.text().trim()).to.equal(sourceName);
});
}

groupsHaveAManageButton(groupName) {
const classNameData = cy.get(Groups.#classTableNew).find('td').contains(groupName);
seeGroupsHaveAManageButton(groupName) {
const classNameData = cy.get(Classes.#classTableNew).find('td').contains(groupName);

classNameData.siblings('td').eq(2).find('a[data-testid="class-table-members-manage-btn"]')
classNameData.siblings('td').eq(3).find('a[data-testid="class-table-members-manage-btn"]')
.should('exist');
}

classesHave4ActiveActionItems(className) {
const classNameData = cy.get(Groups.#classTableNew).find('td').contains(className);
seeClassesHave4ActiveActionItems(className) {
const classNameData = cy.get(Classes.#classTableNew).find('td').contains(className);

const buttons = classNameData.siblings('td').eq(2).find('a, button');
const buttons = classNameData.siblings('td').eq(3).find('a, button');

buttons.should('have.length', 4);
buttons.each(($btn) => {
cy.wrap($btn).should('not.be.disabled');
})
}

seeTableHas5Columns() {
const tableHeader = cy.get(Classes.#classTableNew).find('th')

tableHeader.should('have.length', 5);
}

see3Tabs() {
cy.get(Classes.#nextYearTab).should('exist')
cy.get(Classes.#currentYearTab).should('exist').and('have.class', 'v-tab v-tab--active')
cy.get(Classes.#previousYearsTab).should('exist')
}

seeManageGroupPage(){
cy.url().should('include', '/administration/groups/classes/');
}

seeManageGroupPageTitle() {
cy.get(Groups.#adminGroupTitle).should('be.visible')
cy.get(Classes.#adminGroupTitle).should('be.visible')
}

seeGroupMemberTable() {
cy.get(Groups.#groupMemberTable).should('be.visible')
cy.get(Classes.#groupMemberTable).should('be.visible')
}

seeGroupMemberTableContainsMember(role, lastName){
const groupMemberData = cy.get(Groups.#groupMemberTable).find('td').contains(lastName);
const groupMemberData = cy.get(Classes.#groupMemberTable).find('td').contains(lastName);

groupMemberData.should('be.visible');
groupMemberData.siblings('td').eq(1).should(($td) => {
Expand All @@ -179,18 +212,21 @@ class Groups {
}

seeClassMemberInfoBox() {
cy.get(Groups.#classMemberInfoBox).should('be.visible')
cy.get(Classes.#classMemberInfoBox).should('be.visible')
}

seeClassMemberInfoBoxText() {
cy.get(Groups.#classMemberInfoBoxText).should('be.visible')
cy.get(Classes.#classMemberInfoBoxText).should('be.visible')
}

clickManageGroupButton(){
cy.get(Groups.#manageGroupButton)
.first().click();
seeNoNewClassAdministrationPage() {
cy.get(Classes.#adminClassNavigationSidebarCard).should('not.have.attr', 'href', '/administration/groups/classes')
cy.get(Classes.#adminClassNavigationCard).should('not.have.attr', 'data-loclink', '/administration/groups/classes')
}

seeNoSourceHeader() {
cy.get(Classes.#legacyClassTable).find('th').should('not.contain', 'source');
}
}

export default Groups
export default Classes
Loading

0 comments on commit ec4eecc

Please sign in to comment.