Add frontend tests, add translations
This commit is contained in:
parent
232959b92d
commit
7c21070b96
|
|
@ -60,6 +60,7 @@ async function exportData() {
|
||||||
<button
|
<button
|
||||||
v-if="userStore.course_session_experts.length > 0"
|
v-if="userStore.course_session_experts.length > 0"
|
||||||
class="flex"
|
class="flex"
|
||||||
|
data-cy="export-button"
|
||||||
@click="exportData"
|
@click="exportData"
|
||||||
>
|
>
|
||||||
<it-icon-export></it-icon-export>
|
<it-icon-export></it-icon-export>
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ async function exportData() {
|
||||||
<button
|
<button
|
||||||
v-if="userStore.course_session_experts.length > 0"
|
v-if="userStore.course_session_experts.length > 0"
|
||||||
class="flex"
|
class="flex"
|
||||||
|
data-cy="export-button"
|
||||||
@click="exportData"
|
@click="exportData"
|
||||||
>
|
>
|
||||||
<it-icon-export></it-icon-export>
|
<it-icon-export></it-icon-export>
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ async function exportData() {
|
||||||
<button
|
<button
|
||||||
v-if="userStore.course_session_experts.length > 0"
|
v-if="userStore.course_session_experts.length > 0"
|
||||||
class="flex"
|
class="flex"
|
||||||
|
data-cy="export-button"
|
||||||
@click="exportData"
|
@click="exportData"
|
||||||
>
|
>
|
||||||
<it-icon-export></it-icon-export>
|
<it-icon-export></it-icon-export>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
import { login } from "../helpers";
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
// ignore automatic import mess-up...
|
||||||
|
|
||||||
|
// const getDashboardStatistics = (what) => {
|
||||||
|
// return cy.get(`[data-cy="dashboard.stats.${what}"]`);
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// const clickOnDetailsLink = (within) => {
|
||||||
|
// cy.get(`[data-cy="dashboard.stats.${within}"]`).within(() => {
|
||||||
|
// cy.get('[data-cy="basebox.detailsLink"]').click();
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
|
||||||
|
function getCurrentDate() {
|
||||||
|
const date = new Date();
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
|
||||||
|
const day = String(date.getDate()).padStart(2, "0");
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyExportFileExists(fileName) {
|
||||||
|
const downloadsFolder = Cypress.config("downloadsFolder");
|
||||||
|
cy.readFile(
|
||||||
|
path.join(downloadsFolder, `${fileName}_${getCurrentDate()}.xlsx`)
|
||||||
|
).should("exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
function testExport(url, fileName) {
|
||||||
|
cy.visit(url);
|
||||||
|
cy.get('[data-cy="export-button"]').click();
|
||||||
|
verifyExportFileExists(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("dashboardExport.cy.js", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.manageCommand(
|
||||||
|
"cypress_reset --create-assignment-evaluation --create-feedback-responses --create-course-completion-performance-criteria --create-attendance-days"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("as supervisor", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
login("test-supervisor1@example.com", "test");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the attendance export", () => {
|
||||||
|
testExport("/statistic/test-lehrgang/attendance", "export_anwesenheit");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the competence elements export", () => {
|
||||||
|
testExport(
|
||||||
|
"/statistic/test-lehrgang/assignment",
|
||||||
|
"export_kompetenznachweis_elemente"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the feedback export", () => {
|
||||||
|
testExport("/statistic/test-lehrgang/feedback", "export_feedback");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("as trainer", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
login("test-trainer1@example.com", "test");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the attendance export", () => {
|
||||||
|
testExport("/statistic/test-lehrgang/attendance", "export_anwesenheit");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the competence elements export", () => {
|
||||||
|
testExport(
|
||||||
|
"/statistic/test-lehrgang/assignment",
|
||||||
|
"export_kompetenznachweis_elemente"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should download the feedback export", () => {
|
||||||
|
testExport("/statistic/test-lehrgang/feedback", "export_feedback");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Binary file not shown.
|
|
@ -129,7 +129,7 @@ msgstr ""
|
||||||
|
|
||||||
#: vbv_lernwelt/course_session/services/export_attendance.py:122
|
#: vbv_lernwelt/course_session/services/export_attendance.py:122
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr ""
|
msgstr "Email"
|
||||||
|
|
||||||
#: vbv_lernwelt/course_session/services/export_attendance.py:123
|
#: vbv_lernwelt/course_session/services/export_attendance.py:123
|
||||||
#: vbv_lernwelt/course_session/services/export_attendance.py:135
|
#: vbv_lernwelt/course_session/services/export_attendance.py:135
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue