Skip to content

Commit

Permalink
Add cypress test for lecture edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Aug 20, 2024
1 parent 4c6410f commit cbf4661
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/lectures/edit/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
id="lecture-nav-content" type="button" role="tab"
href="#content"
data-bs-toggle="pill" data-bs-target="#lecture-pane-content"
data-cy="content-tab-btn"
aria-controls="lecture-pane-content" aria-selected="true">
<%= t('content') %>
</button>
Expand Down
17 changes: 17 additions & 0 deletions spec/cypress/e2e/lecture_spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import FactoryBot from "../support/factorybot";

describe("Lecture edit page", () => {
it("shows content tab button", function () {
cy.createUserAndLogin("teacher").as("teacher");

cy.then(() => {
FactoryBot.create("lecture", "with_teacher_by_id",
{ teacher_id: this.teacher.id }).as("lecture");
});

cy.then(() => {
cy.visit(`/lectures/${this.lecture.id}/edit`);
cy.getBySelector("content-tab-btn").should("be.visible");
});
});
});

0 comments on commit cbf4661

Please sign in to comment.