78 lines
2.6 KiB
JavaScript
78 lines
2.6 KiB
JavaScript
import { login } from "../helpers"
|
|
|
|
function selectDropboxItem(dropboxSelector, item) {
|
|
cy.get(dropboxSelector).click()
|
|
cy.get(dropboxSelector).contains(item).click()
|
|
}
|
|
|
|
describe("ausbildungsverantwortlicher.cy.js", () => {
|
|
|
|
it("check data on dashboard", () => {
|
|
login("test-ausbildungsverantwortlicher1@example.com", "test")
|
|
cy.visit("/")
|
|
|
|
cy.get('[data-cy="panel-role-key"]').should("contain", "Ausbildungsverantwortlicher")
|
|
|
|
cy.get('[data-cy="num-dashboard-persons"]').should("contain", "3 Personen")
|
|
|
|
cy.get('[data-cy="dashboard.stats.trainingResponsible.totalCost"]').should(
|
|
"contain",
|
|
"649",
|
|
)
|
|
|
|
cy.get('[data-cy="dashboard.stats.trainingResponsible.participantsInCurrentYear"]').should(
|
|
"contain",
|
|
"2",
|
|
)
|
|
|
|
cy.get('[data-cy="dashboard.stats.trainingResponsible.chart.Allbranche.1"]').should(
|
|
'exist'
|
|
)
|
|
cy.get('[data-cy="dashboard.stats.trainingResponsible.chart.Nichtleben.1"]').should(
|
|
'exist'
|
|
)
|
|
})
|
|
|
|
it("check cost detail page", () => {
|
|
login("test-ausbildungsverantwortlicher1@example.com", "test")
|
|
cy.visit("/")
|
|
|
|
cy.get(
|
|
'[data-cy="dashboard.stats.trainingResponsible.cost"] [data-cy="basebox.detailsLink"]',
|
|
).click()
|
|
|
|
cy.get('[data-cy="cost-2024"]').should("have.length", 1)
|
|
cy.get('[data-cy="cost-2023"]').should("have.length", 1)
|
|
|
|
cy.get('[data-cy="cost-2024"]').should("contain", "649 CHF")
|
|
cy.get('[data-cy="cost-2023"]').should("contain", "324 CHF")
|
|
cy.get('[data-cy="participants-2024"]').should("contain", "2")
|
|
cy.get('[data-cy="participants-2023"]').should("contain", "1")
|
|
})
|
|
|
|
it("check participants detail page", () => {
|
|
login("test-ausbildungsverantwortlicher1@example.com", "test")
|
|
cy.visit("/")
|
|
|
|
cy.get(
|
|
'[data-cy="dashboard.stats.trainingResponsible.participants"] [data-cy="basebox.detailsLink"]',
|
|
).click()
|
|
|
|
// Test paid year filter
|
|
cy.get('[data-cy="person"]').should("have.length", 2) // year 2024 is preselected by query
|
|
selectDropboxItem('[data-cy="select-paid-year"]', "2023")
|
|
cy.get('[data-cy="person"]').should("have.length", 1)
|
|
selectDropboxItem('[data-cy="select-paid-year"]', "Jahr: Alle")
|
|
cy.get('[data-cy="person"]').should("have.length", 3)
|
|
|
|
// Test chosen profile filter
|
|
selectDropboxItem('[data-cy="select-chosen-profile"]', "Nichtleben")
|
|
cy.get('[data-cy="person"]').should("have.length", 1)
|
|
selectDropboxItem('[data-cy="select-chosen-profile"]', "Allbranche")
|
|
cy.get('[data-cy="person"]').should("have.length", 2)
|
|
selectDropboxItem('[data-cy="select-chosen-profile"]', "Alle")
|
|
cy.get('[data-cy="person"]').should("have.length", 3)
|
|
})
|
|
|
|
})
|