diff --git a/cypress/fixtures/projectCommits.json b/cypress/fixtures/projectCommits.json index 480d0d3ce..30c304c5c 100644 --- a/cypress/fixtures/projectCommits.json +++ b/cypress/fixtures/projectCommits.json @@ -67,7 +67,7 @@ } ], "stats": { - "commits": 1, + "commits": 3, "branches": 1, "contributors": 1 } diff --git a/cypress/integration/project.spec.ts b/cypress/integration/project.spec.ts index 97666a043..784dc2187 100644 --- a/cypress/integration/project.spec.ts +++ b/cypress/integration/project.spec.ts @@ -2,8 +2,8 @@ /// import { MockExtensionProvider } from "../support"; -describe("Project View", () => { - before(() => { +describe("Project view", () => { + beforeEach(() => { cy.intercept("https://willow.radicle.garden:8777/", { fixture: "projectHome.json" }); cy.intercept("https://willow.radicle.garden:8777/v1/peer", { fixture: "projectPeer.json" }); cy.intercept("https://willow.radicle.garden:8777/v1/projects/bright-forest-protocol", { fixture: "projectInfo.json" }); @@ -18,33 +18,32 @@ describe("Project View", () => { cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a", { fixture: "projectCommit.json" }); }); - it("Load project view and use peer and branch selector ", () => { + it("Page header", () => { cy.visit("/seeds/willow.radicle.garden/bright-forest-protocol", { onBeforeLoad(win) { win.ethereum = new MockExtensionProvider(); }, }); - - cy.log("Check that the project view is loaded and populated with the stubbed data"); - cy.log("Page Header"); cy.get("div.title").contains("bright-forest-protocol"); cy.get("div.urn").contains("rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy"); cy.get("div.description").contains("bfc-sc"); + }); - cy.log("README"); + it("Browser", () => { cy.get("div.column-right article div.markdown h1").should("have.text", "Basic Sample Hardhat Project"); + }); - cy.log("Project Header"); + it("Project Header", () => { cy.get("div.stat.seed span").should("have.text", "willow.radicle.garden"); cy.get("div.stat.commit-count").should("have.text", "3 commit(s)"); cy.get("div.stat.contributor-count").should("have.text", "1 contributor(s)"); cy.get("div.anchor span.anchor-label").contains("not anchored 🔓"); cy.get("div.stat.branch").should("have.class", "not-allowed").should("have.text", "main"); cy.get("div.hash.desktop").should("have.text", "56e4e02"); - cy.get("div.clone").click(); + }); - cy.log("Peer Selection"); + it("Peer selector ", () => { cy.get("div.selector").click(); cy.get("div.dropdown-item").contains("dabit3 hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke delegate").click(); cy.location().should((location) => { @@ -53,8 +52,9 @@ describe("Project View", () => { cy.get("span.peer-id span[title='hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke']").should("have.text", "hyndc7…j9oeke"); cy.get("div.stat.peer span.peer-id").should("have.text", "dabit3"); cy.get("div.stat.peer span.badge").should("have.text", "delegate"); + }); - cy.log("Branch Selection"); + it("Branch selector ", () => { cy.get("div.commit div.stat.branch").click(); cy.get("div.dropdown-item") .first() @@ -67,8 +67,9 @@ describe("Project View", () => { }); cy.get("div.stat.branch").should("have.text", "master"); cy.get("div.hash.desktop").should("have.text", "cbf5df4"); + }); - cy.log("Commit history view"); + it("Commit button ", () => { cy.get("div.stat.commit-count") .should("not.have.class", "active") .click(); @@ -76,8 +77,9 @@ describe("Project View", () => { expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/history/master'); }); cy.get("div.stat.commit-count").should("have.class", "active"); + }); - cy.log("Commit Group & Commit Trailer"); + it("Commit group & commit trailer ", () => { cy.fixture("groupedCommits.json").then((commitGroup) => { // This iterates over the commit groups and then over each commit. cy.get("div.commit-group").should("have.length", 2) @@ -95,8 +97,11 @@ describe("Project View", () => { // Checking that the initial commit has the Verified badge cy.get(".badge").last().should("have.text", "Verified"); cy.get("div.summary").last().click(); + }); + }); - cy.log("Commit Detail View"); + it("Commit detail view ", () => { + cy.fixture("groupedCommits.json").then((commitGroup) => { // We get the initial commit from the fixture file to assert here const { committer, committerTime, summary, description } = commitGroup[1].commits[1];