Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-6075 new test manageAccessToLearnstore #171

Merged
merged 5 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions cypress/e2e/learning_store/manageAccessToLearningstore.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@release
Feature: Learning store - Activating and deactivating access for students

As an admin I want to activate and deactivate students access to learning store

@stable_test
Scenario Outline: Admin activates and deactivates students access to Learning store
# Admin deactivates students access to Learning store - pre-condition to set the needed configuration
Given I am logged in as a '<admin>' at '<namespace>'
When I go to administration page
When I go to school administration
When I click the checkbox to disable students access to learning store
When I click on admin setting save button
Then I see checkbox to enable students access to learning store is unchecked
# Student doesn't see link to Learning store in menu
Given I am logged in as a '<student>' at '<namespace>'
Then I do not see Learning Store in side bar
# Admin activates students access to Learning store
Given I am logged in as a '<admin>' at '<namespace>'
When I go to administration page
When I go to school administration
When I click the checkbox to enable students access to learning store
When I click on admin setting save button
# Student sees link to Learning store in menu
Given I am logged in as a '<student>' at '<namespace>'
Then I see Learning Store in side bar
When I go to Learning Store overview
# Admin deactivates students access to Learning store again (tests change from access to no-access)
Given I am logged in as a '<admin>' at '<namespace>'
When I go to administration page
When I go to school administration
When I click the checkbox to disable students access to learning store
When I click on admin setting save button
# Student doesn't see link to Learning store in menu
Given I am logged in as a '<student>' at '<namespace>'
Then I do not see Learning Store in side bar


Examples:
| admin | namespace | student |
| admin1_brb | brb | student1_brb |
13 changes: 13 additions & 0 deletions cypress/support/pages/admin/pageAdministration.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Management {
static #teamAdministrationNavigationButton = '[data-testid="Teams"]'
static #schoolAdministrationNavigationButton = '[data-testid="Schule"]'
static #studentTeamCheckbox = '[data-testid="student_team_checkbox"]'
static #learningStoreStudentAccessCheckbox = '[id="studentlernstorevisibility"]'
static #submitButtonTeamsAdmin = '[data-testid="button_save_team_administration"]'
static #startMigrationButton = '[data-testid="migration-start-button"]'
static #migrationInformationText = '[data-testid="text-description"]'
Expand Down Expand Up @@ -101,6 +102,18 @@ class Management {
})
}

clickCheckboxToDisableAccessToLearningStore () {
cy.get(Management.#learningStoreStudentAccessCheckbox).uncheck()
}

clickCheckboxToEnableAccessToLearningStore () {
cy.get(Management.#learningStoreStudentAccessCheckbox).check()
}

assertStudentsAccessIsUnchecked() {
cy.get(Management.#learningStoreStudentAccessCheckbox).should('not.be.checked');
}

clickSaveButtonToAllowStudentCreateTeam () {
cy.get(Management.#submitButtonTeamsAdmin)
.eq(0)
Expand Down
14 changes: 11 additions & 3 deletions cypress/support/pages/learning_store/pageLearningStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

class Learning_Store {

static #lernStoreOverviewNavigationButton = '[data-testid="Lern-Store"]'
static #learningStoreMenuLink = '[data-testid="Lern-Store"]'

navigateToLernStoreOverview() {
navigateToLearningStoreOverview() {
cy.visit('/content')
cy.get(Learning_Store.#lernStoreOverviewNavigationButton).click()
cy.get(Learning_Store.#learningStoreMenuLink).click()
cy.url().should('include', '/content')
}

assertLearningStoreNotVisibleInMenu() {
cy.get(Learning_Store.#learningStoreMenuLink).should('not.exist')
}

assertLearningStoreVisibleInMenu() {
cy.get(Learning_Store.#learningStoreMenuLink).should('exist')
}
}
export default Learning_Store
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import Learning_Store from '../../pages/learning_store/pageLearningStore'

const learningStore = new Learning_Store()

When('I go to LernStore overview', () => {
learningStore.navigateToLernStoreOverview()
})
When('I go to Learning Store overview', () => {
learningStore.navigateToLearningStoreOverview()
})

When('I do not see Learning Store in side bar', () => {
learningStore.assertLearningStoreNotVisibleInMenu()
})

When('I see Learning Store in side bar', () => {
learningStore.assertLearningStoreVisibleInMenu()
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { When, Then } = require("@badeball/cypress-cucumber-preprocessor")
import Management from '../../pages/admin/pageAdministration'

const management = new Management()


When('I click the checkbox to disable students access to learning store', () => {
management.clickCheckboxToDisableAccessToLearningStore()
})

When('I click the checkbox to enable students access to learning store', () => {
management.clickCheckboxToEnableAccessToLearningStore()
})

Then('I see checkbox to enable students access to learning store is unchecked', () => {
management.assertStudentsAccessIsUnchecked()
})
Loading