Skip to content

Commit

Permalink
Use NO_SEMINAR_ROLES constant
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Aug 24, 2024
1 parent 7289053 commit 5a65708
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions spec/cypress/e2e/vouchers_spec.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FactoryBot from "../support/factorybot";

const ROLES = ["tutor", "editor", "teacher", "speaker"];
const NO_SEMINAR_ROLES = ROLES.filter(role => role !== "speaker");

function createLectureScenario(context, type = "lecture") {
cy.createUserAndLogin("teacher").as("teacher");
Expand Down Expand Up @@ -49,28 +50,28 @@ describe("If the lecture is not a seminar", () => {
it("shows buttons for creating tutor, editor and teacher vouchers", function () {
cy.contains(this.vouchers).should("be.visible");

ROLES.filter(role => role !== "speaker").forEach((role) => {
NO_SEMINAR_ROLES.forEach((role) => {
cy.getBySelector(`create-${role}-voucher-btn`).should("be.visible");
});

cy.getBySelector("create-speaker-voucher-btn").should("not.exist");
});

it("displays the voucher and invalidate button after the create button is clicked", function () {
ROLES.filter(role => role !== "speaker").forEach((role) => {
NO_SEMINAR_ROLES.forEach((role) => {
testCreateVoucher(role);
});
});

it("displays that there is no active voucher after the invalidate button is clicked", function () {
ROLES.filter(role => role !== "speaker").forEach((role) => {
NO_SEMINAR_ROLES.forEach((role) => {
testCreateVoucher(role);
testInvalidateVoucher(role);
});
});

it.skip("copies the voucher hash to the clipboard", function () {
ROLES.filter(role => role !== "speaker").forEach((role) => {
NO_SEMINAR_ROLES.forEach((role) => {
cy.getBySelector(`create-${role}-voucher-btn`).click();
cy.getBySelector(`${role}-voucher-secure-hash`).then(($hash) => {
const hashText = $hash.text();
Expand Down

0 comments on commit 5a65708

Please sign in to comment.