mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-31 01:00:47 +08:00
Refactor project testing routes into separate modules
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -1,283 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/// <reference types="cypress" />
|
||||
import { MockProvider } from "@rsksmart/mock-web3-provider";
|
||||
|
||||
const groupedCommits = [
|
||||
{
|
||||
groupDate: "Thursday, March 3, 2022",
|
||||
commits: [
|
||||
{
|
||||
header: {
|
||||
sha: "9cd3532",
|
||||
summary: "Second commit",
|
||||
description: "",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "06:51 GMT+1",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
groupDate: "Wednesday, March 2, 2022",
|
||||
commits: [
|
||||
{
|
||||
header: {
|
||||
sha: "e045b92",
|
||||
summary: "Update README",
|
||||
description: "",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "17:14 GMT+1",
|
||||
},
|
||||
},
|
||||
{
|
||||
header: {
|
||||
sha: "cbf5df4",
|
||||
summary: "initial commit",
|
||||
description: "this is the first commit of many",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "16:58 GMT+1",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
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" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy",
|
||||
{ fixture: "projectInfo.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes",
|
||||
{ fixture: "projectRemotes.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/issues",
|
||||
{ fixture: "projectIssues.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/patches",
|
||||
{ fixture: "projectPatches.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectTree56e4e02.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectTreecbf5df4.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke",
|
||||
{ fixture: "projectBranches.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectReadme.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits?parent=cbf5df499ab4f4a908f1756fbe2c236a4530516a?verified=true",
|
||||
{ fixture: "projectCommits.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectReadme.json" },
|
||||
);
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectCommit.json" },
|
||||
);
|
||||
});
|
||||
|
||||
it("Page header", () => {
|
||||
cy.visit("/seeds/willow.radicle.garden/bright-forest-protocol", {
|
||||
onBeforeLoad(win) {
|
||||
const address = "0xB98bD7C7f656290071E52D1aA617D9cB4467Fd6D";
|
||||
const privateKey =
|
||||
"de926db3012af759b4f24b5a51ef6afa397f04670f634aa4f48d4480417007f3";
|
||||
win.ethereum = new MockProvider({
|
||||
address,
|
||||
privateKey,
|
||||
networkVersion: 1,
|
||||
});
|
||||
},
|
||||
});
|
||||
cy.get("div.title").contains("bright-forest-protocol");
|
||||
cy.get("div.urn").contains("rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy");
|
||||
cy.get("div.description").contains("bfc-sc");
|
||||
});
|
||||
|
||||
it("Browser", () => {
|
||||
cy.get("div.column-right article div.markdown h1").should(
|
||||
"have.text",
|
||||
"Basic Sample Hardhat Project",
|
||||
);
|
||||
});
|
||||
|
||||
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\n commit(s)");
|
||||
cy.get("div.stat.contributor-count").should(
|
||||
"have.text",
|
||||
"1\n contributor(s)",
|
||||
);
|
||||
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-button").click();
|
||||
});
|
||||
|
||||
it("Peer selector", () => {
|
||||
cy.get("div.selector").click();
|
||||
cy.get("div.dropdown-item")
|
||||
.contains(
|
||||
"dabit3 hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke delegate",
|
||||
)
|
||||
.click();
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree",
|
||||
);
|
||||
});
|
||||
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");
|
||||
});
|
||||
|
||||
it("Branch selector", () => {
|
||||
cy.get("div.commit div.stat.branch").click();
|
||||
cy.get("div.dropdown-item")
|
||||
.first()
|
||||
.contains("main")
|
||||
.next()
|
||||
.contains("master")
|
||||
.click();
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree/master",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.branch").should("have.text", "master");
|
||||
cy.get("div.hash.desktop").should("have.text", "cbf5df4");
|
||||
});
|
||||
|
||||
it("Commits button", () => {
|
||||
cy.get("div.stat.commit-count").should("not.have.class", "active").click();
|
||||
cy.location().should(location => {
|
||||
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");
|
||||
});
|
||||
|
||||
it("Commit group & commit trailer", () => {
|
||||
// This iterates over the commit groups and then over each commit.
|
||||
cy.get(".commit-group")
|
||||
.should("have.length", 2)
|
||||
.each((item, index) => {
|
||||
expect(Cypress.$(item.children(".commit-date")).text()).to.eq(
|
||||
groupedCommits[index].groupDate,
|
||||
);
|
||||
const $el = Cypress.$(item.find(".commit-teaser"));
|
||||
cy.wrap($el).each((commit, commitIndex) => {
|
||||
expect(Cypress.$(commit).find(".hash").text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.sha,
|
||||
);
|
||||
expect(Cypress.$(commit).find(".summary").text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.summary,
|
||||
);
|
||||
expect(Cypress.$(commit).find(".committer").first().text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.committer.name,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
cy.get(".commit-teaser .badge").trigger("mouseenter");
|
||||
// Checking that the initial commit has the Verified badge
|
||||
cy.get(".popup .header").should(
|
||||
"have.text",
|
||||
"✔ This commit was signed\n with the committer's radicle key.",
|
||||
);
|
||||
cy.get(".popup .peer").should(
|
||||
"contain.text",
|
||||
"hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
);
|
||||
cy.get(".popup .committer").should("contain.text", "dabit3");
|
||||
|
||||
cy.get(".commit").last().click();
|
||||
});
|
||||
|
||||
it("Commit detail view", () => {
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
);
|
||||
});
|
||||
cy.get("header .summary .text-medium").should(
|
||||
"have.text",
|
||||
"initial commit",
|
||||
);
|
||||
cy.get("header pre.description").should(
|
||||
"have.text",
|
||||
"this is the first commit of many",
|
||||
);
|
||||
cy.get("header .committer").should("have.text", "dabit3");
|
||||
cy.get("div.changeset-summary").should(
|
||||
"have.text",
|
||||
"1 file(s) changed, 1 file(s) created, 1 file(s) deleted\n with\n 0 addition(s)\n and\n 0 deletion(s)",
|
||||
);
|
||||
cy.get("header.file-header:nth-child(1) p.file-path")
|
||||
.first()
|
||||
.should("have.text", "test.md")
|
||||
.next()
|
||||
.should("have.text", "created");
|
||||
cy.get("tr.diff-line td.diff-line-number").contains("16");
|
||||
cy.get("tr.diff-line td.diff-line-content").contains(
|
||||
"To prevent front-running, the RAD/USDC balances are set through the Uniswap router *proxy* contract",
|
||||
);
|
||||
});
|
||||
|
||||
it("Issues button", () => {
|
||||
cy.get("div.stat.issue-count").click();
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/issues",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.issue-count").should("have.class", "active");
|
||||
});
|
||||
|
||||
it("Patches button", () => {
|
||||
cy.get("div.stat.patch-count").click();
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/patches",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.patch-count").should("have.class", "active");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,176 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/// <reference types="cypress" />
|
||||
import { MockProvider } from "@rsksmart/mock-web3-provider";
|
||||
|
||||
const groupedCommits = [
|
||||
{
|
||||
groupDate: "Thursday, March 3, 2022",
|
||||
commits: [
|
||||
{
|
||||
header: {
|
||||
sha: "9cd3532",
|
||||
summary: "Second commit",
|
||||
description: "",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "06:51 GMT+1",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
groupDate: "Wednesday, March 2, 2022",
|
||||
commits: [
|
||||
{
|
||||
header: {
|
||||
sha: "e045b92",
|
||||
summary: "Update README",
|
||||
description: "",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "17:14 GMT+1",
|
||||
},
|
||||
},
|
||||
{
|
||||
header: {
|
||||
sha: "cbf5df4",
|
||||
summary: "initial commit",
|
||||
description: "this is the first commit of many",
|
||||
committer: {
|
||||
name: "dabit3",
|
||||
mail: "dabit3@gmail.com",
|
||||
},
|
||||
committerTime: "16:58 GMT+1",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
describe("Project commits", () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept("/", {
|
||||
fixture: "projectHome.json",
|
||||
}).as("seedHome");
|
||||
cy.intercept("v1/peer", {
|
||||
fixture: "projectPeer.json",
|
||||
}).as("seedPeer");
|
||||
cy.intercept("v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy", {
|
||||
fixture: "projectInfo.json",
|
||||
}).as("seedInfo");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes",
|
||||
{ fixture: "projectRemotes.json" },
|
||||
).as("seedRemotes");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49/",
|
||||
{ fixture: "projectTree56e4e02.json" },
|
||||
).as("seedTree56e4e02");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/cbf5df499ab4f4a908f1756fbe2c236a4530516a/",
|
||||
{ fixture: "projectTreecbf5df4.json" },
|
||||
).as("seedTreecbf5df4");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits?parent=56e4e029c294b08546386e1fb706b772c7433c49&verified=true",
|
||||
{ fixture: "projectCommits.json" },
|
||||
).as("seedCommits");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectCommit.json" },
|
||||
).as("seedCommit");
|
||||
});
|
||||
|
||||
it("Commit group & commit trailer", () => {
|
||||
cy.visit(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/history",
|
||||
{
|
||||
onBeforeLoad(win) {
|
||||
const address = "0xB98bD7C7f656290071E52D1aA617D9cB4467Fd6D";
|
||||
const privateKey =
|
||||
"de926db3012af759b4f24b5a51ef6afa397f04670f634aa4f48d4480417007f3";
|
||||
win.ethereum = new MockProvider({
|
||||
address,
|
||||
privateKey,
|
||||
networkVersion: 1,
|
||||
});
|
||||
},
|
||||
},
|
||||
);
|
||||
cy.wait([
|
||||
"@seedHome",
|
||||
"@seedPeer",
|
||||
"@seedInfo",
|
||||
"@seedRemotes",
|
||||
"@seedTree56e4e02",
|
||||
"@seedCommits",
|
||||
]);
|
||||
// This iterates over the commit groups and then over each commit.
|
||||
cy.get(".commit-group")
|
||||
.should("have.length", 2)
|
||||
.each((item, index) => {
|
||||
expect(Cypress.$(item.children(".commit-date")).text()).to.eq(
|
||||
groupedCommits[index].groupDate,
|
||||
);
|
||||
const $el = Cypress.$(item.find(".commit-teaser"));
|
||||
cy.wrap($el).each((commit, commitIndex) => {
|
||||
expect(Cypress.$(commit).find(".hash").text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.sha,
|
||||
);
|
||||
expect(Cypress.$(commit).find(".summary").text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.summary,
|
||||
);
|
||||
expect(Cypress.$(commit).find(".committer").first().text()).to.eq(
|
||||
groupedCommits[index].commits[commitIndex].header.committer.name,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
cy.get(".commit-teaser .badge").trigger("mouseenter");
|
||||
// Checking that the initial commit has the Verified badge
|
||||
cy.get(".popup .header").should(
|
||||
"have.text",
|
||||
"✔ This commit was signed\n with the committer's radicle key.",
|
||||
);
|
||||
cy.get(".popup .peer").should(
|
||||
"contain.text",
|
||||
"hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
);
|
||||
cy.get(".popup .committer").should("contain.text", "dabit3");
|
||||
|
||||
cy.get(".commit").last().click();
|
||||
});
|
||||
|
||||
it("Commit detail view", () => {
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
);
|
||||
});
|
||||
cy.get("header .summary .text-medium").should(
|
||||
"have.text",
|
||||
"initial commit",
|
||||
);
|
||||
cy.get(".commit pre.description").should(
|
||||
"have.text",
|
||||
"this is the first commit of many",
|
||||
);
|
||||
cy.get("header .committer").should("have.text", "dabit3");
|
||||
cy.get("div.changeset-summary").should(
|
||||
"have.text",
|
||||
"1 file(s) changed, 1 file(s) created, 1 file(s) deleted\n with\n 0 addition(s)\n and\n 0 deletion(s)",
|
||||
);
|
||||
cy.get("header.file-header:nth-child(1) p.file-path")
|
||||
.first()
|
||||
.should("have.text", "test.md")
|
||||
.next()
|
||||
.should("have.text", "created");
|
||||
cy.get("tr.diff-line td.diff-line-number").contains("16");
|
||||
cy.get("tr.diff-line td.diff-line-content").contains(
|
||||
"To prevent front-running, the RAD/USDC balances are set through the Uniswap router *proxy* contract",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,172 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/// <reference types="cypress" />
|
||||
import { MockProvider } from "@rsksmart/mock-web3-provider";
|
||||
|
||||
describe("Project header", () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept("/", {
|
||||
fixture: "projectHome.json",
|
||||
}).as("projectHome");
|
||||
cy.intercept("v1/peer", {
|
||||
fixture: "projectPeer.json",
|
||||
}).as("projectPeer");
|
||||
cy.intercept("v1/projects/bright-forest-protocol", {
|
||||
fixture: "projectInfo.json",
|
||||
}).as("projectInfo");
|
||||
cy.intercept("v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy", {
|
||||
fixture: "projectInfo.json",
|
||||
}).as("projectInfo");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes",
|
||||
{ fixture: "projectRemotes.json" },
|
||||
).as("projectRemotes");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/issues",
|
||||
{ fixture: "projectIssues.json" },
|
||||
).as("projectIssues");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/patches",
|
||||
{ fixture: "projectPatches.json" },
|
||||
).as("projectPatches");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectTree56e4e02.json" },
|
||||
).as("projectTree56e4e02");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectTreecbf5df4.json" },
|
||||
).as("projectTreecbf5df4");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke",
|
||||
{ fixture: "projectBranches.json" },
|
||||
).as("projectBranches");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectReadme.json" },
|
||||
).as("projectReadme");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits?parent=cbf5df499ab4f4a908f1756fbe2c236a4530516a?verified=true",
|
||||
{ fixture: "projectCommits.json" },
|
||||
).as("projectCommits");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectReadme.json" },
|
||||
).as("projectReadme");
|
||||
cy.intercept(
|
||||
"v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
|
||||
{ fixture: "projectCommit.json" },
|
||||
).as("projectCommit");
|
||||
});
|
||||
it("renders header correctly", () => {
|
||||
cy.visit("/seeds/willow.radicle.garden/bright-forest-protocol", {
|
||||
onBeforeLoad(win) {
|
||||
const address = "0xB98bD7C7f656290071E52D1aA617D9cB4467Fd6D";
|
||||
const privateKey =
|
||||
"de926db3012af759b4f24b5a51ef6afa397f04670f634aa4f48d4480417007f3";
|
||||
win.ethereum = new MockProvider({
|
||||
address,
|
||||
privateKey,
|
||||
networkVersion: 1,
|
||||
});
|
||||
},
|
||||
});
|
||||
cy.wait([
|
||||
"@projectHome",
|
||||
"@projectPeer",
|
||||
"@projectInfo",
|
||||
"@projectRemotes",
|
||||
"@projectTree56e4e02",
|
||||
"@projectReadme",
|
||||
]);
|
||||
cy.get("div.stat.seed span").should("have.text", "willow.radicle.garden");
|
||||
cy.get("div.stat.commit-count").should("have.text", "3\n commit(s)");
|
||||
cy.get("div.stat.contributor-count").should(
|
||||
"have.text",
|
||||
"1\n contributor(s)",
|
||||
);
|
||||
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-button").click();
|
||||
});
|
||||
|
||||
it("Peer Selector", () => {
|
||||
cy.get("div.selector").click();
|
||||
cy.get("div.dropdown-item")
|
||||
.contains(
|
||||
"dabit3 hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke delegate",
|
||||
)
|
||||
.click();
|
||||
cy.wait([
|
||||
"@projectHome",
|
||||
"@projectPeer",
|
||||
"@projectInfo",
|
||||
"@projectRemotes",
|
||||
"@projectBranches",
|
||||
"@projectTree56e4e02",
|
||||
"@projectReadme",
|
||||
]);
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree",
|
||||
);
|
||||
});
|
||||
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");
|
||||
});
|
||||
|
||||
it("Branch selector", () => {
|
||||
cy.get("div.commit div.stat.branch").click();
|
||||
cy.get("div.dropdown-item")
|
||||
.first()
|
||||
.contains("main")
|
||||
.next()
|
||||
.contains("master")
|
||||
.click();
|
||||
cy.wait(["@projectTreecbf5df4", "@projectReadme"]);
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree/master",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.branch").should("have.text", "master");
|
||||
cy.get("div.hash.desktop").should("have.text", "cbf5df4");
|
||||
});
|
||||
|
||||
it("Commits button", () => {
|
||||
cy.get("div.stat.commit-count").should("not.have.class", "active").click();
|
||||
cy.wait(["@projectTreecbf5df4", "@projectCommits"]);
|
||||
cy.location().should(location => {
|
||||
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");
|
||||
});
|
||||
|
||||
it("Issues button", () => {
|
||||
cy.get("div.stat.issue-count").click();
|
||||
cy.wait(["@projectTreecbf5df4", "@projectIssues"]);
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/issues",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.issue-count").should("have.class", "active");
|
||||
});
|
||||
|
||||
it("Patches button", () => {
|
||||
cy.get("div.stat.patch-count").click();
|
||||
cy.wait(["@projectTree56e4e02", "@projectPatches"]);
|
||||
cy.location().should(location => {
|
||||
expect(location.pathname).to.eq(
|
||||
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/patches",
|
||||
);
|
||||
});
|
||||
cy.get("div.stat.patch-count").should("have.class", "active");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/// <reference types="cypress" />
|
||||
import { MockProvider } from "@rsksmart/mock-web3-provider";
|
||||
|
||||
describe("Root", () => {
|
||||
it("Meta", () => {
|
||||
cy.intercept("https://willow.radicle.garden:8777/", {
|
||||
fixture: "projectHome.json",
|
||||
}).as("projectHome");
|
||||
cy.intercept("https://willow.radicle.garden:8777/v1/peer", {
|
||||
fixture: "projectPeer.json",
|
||||
}).as("projectPeer");
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/bright-forest-protocol",
|
||||
{ fixture: "projectInfo.json" },
|
||||
).as("projectInfo");
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes",
|
||||
{ fixture: "projectRemotes.json" },
|
||||
).as("projectRemotes");
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectTree56e4e02.json" },
|
||||
).as("projectTree56e4e02");
|
||||
cy.intercept(
|
||||
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/56e4e029c294b08546386e1fb706b772c7433c49",
|
||||
{ fixture: "projectReadme.json" },
|
||||
).as("projectReadme");
|
||||
cy.visit("/seeds/willow.radicle.garden/bright-forest-protocol", {
|
||||
onBeforeLoad(win) {
|
||||
const address = "0xB98bD7C7f656290071E52D1aA617D9cB4467Fd6D";
|
||||
const privateKey =
|
||||
"de926db3012af759b4f24b5a51ef6afa397f04670f634aa4f48d4480417007f3";
|
||||
win.ethereum = new MockProvider({
|
||||
address,
|
||||
privateKey,
|
||||
networkVersion: 1,
|
||||
});
|
||||
},
|
||||
});
|
||||
cy.wait([
|
||||
"@projectHome",
|
||||
"@projectPeer",
|
||||
"@projectInfo",
|
||||
"@projectRemotes",
|
||||
"@projectTree56e4e02",
|
||||
]);
|
||||
cy.get("div.title").contains("bright-forest-protocol");
|
||||
cy.get("div.urn").contains("rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy");
|
||||
cy.get("div.description").contains("bfc-sc");
|
||||
cy.get("div.column-right article div.markdown h1").should(
|
||||
"have.text",
|
||||
"Basic Sample Hardhat Project",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user