From 2ab3ff3308ad30c379c055b14accaf37b2fb73e1 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:45:15 +0200 Subject: [PATCH 01/14] fix: some tests --- cypress/e2e/devpool.cy.ts | 309 ++++++++++++++++---------------------- 1 file changed, 126 insertions(+), 183 deletions(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 4bf22d79..592f4f46 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -1,12 +1,26 @@ import { RestEndpointMethodTypes } from "@octokit/rest"; import { Session } from "@supabase/supabase-js"; +// type Issue = { +// labels: []; +// }; + +// const fetchIssues = async () => { +// const url = "https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json"; +// const req = await fetch(url); +// return await req.json(); +// }; + +// const filterValidIssues = (issues: Issue[]) => { +// return issues.filter((issue) => issue.labels.length >= 3); +// }; + describe("DevPool", () => { let issue1: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let issue2: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let githubUser: Session["user"]; - before(() => { + before(async () => { cy.fixture("issue-1.json").then((content) => (issue1 = content)); cy.fixture("issue-2.json").then((content) => (issue2 = content)); cy.fixture("user-github.json").then((content) => (githubUser = content)); @@ -15,12 +29,6 @@ describe("DevPool", () => { beforeEach(() => { // Very important to make sure we don't store data between tests cy.clearLocalStorage(); - cy.intercept("https://api.github.com/repos/**/**/issues/**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2].find((o) => o.body?.split("/").at(-1) === req.url.split("/").at(-1)), - }); - }).as("getIssueDetails"); cy.intercept("https://api.github.com/orgs/*", (req) => { req.reply({ statusCode: 200, @@ -34,78 +42,89 @@ describe("DevPool", () => { }).as("membership"); }); - it("Main page displays issues", () => { - // Should display one new task - cy.log("Should display one new task"); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1], - }); - }).as("getIssues"); - cy.visit("/"); - cy.get('div[id="issues-container"]').children().should("have.length", 1); + describe("Mock issues", () => { + beforeEach(() => { + // Very important to make sure we don't store data between tests + cy.clearLocalStorage(); + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { + req.reply({ + statusCode: 200, + body: [issue1, issue2], + }); + }).as("getIssueDetails"); + }); - // needed to make sure data is written to the local storage - cy.wait(3000); + it("Main page displays issues", () => { + // Should display one new task + cy.log("Should display all valid tasks"); + cy.visit("/"); + cy.get('div[id="issues-container"]').children().should("have.length", 2); + }); - // Should display still one old task - cy.log("Should display still one old task"); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2], - }); - }).as("getIssues"); - cy.visit("/"); - cy.get('div[id="issues-container"]').children().should("have.length", 1); + it("Items can be sorted - top row - landscape/desktop", () => { + cy.visit("/"); + cy.wait(3000); + const childElements = cy.get('div[id="issues-container"]').children(); + childElements.should("have.length", 2); + cy.get('[for="price-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="price-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="time-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="time-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="priority-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="priority-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="activity-top"]').click(); + childElements.should("have.length", 2); + cy.get('[for="activity-top"]').click(); + childElements.should("have.length", 2); + }); - // needed to make sure data is written to the local storage - cy.wait(3000); - cy.log("Should display two new tasks"); - cy.clock(Date.now() + 95000000); - cy.visit("/"); - const fakeNow = new Date("2022-04-10"); - // Needed due to a bug - cy.clock(fakeNow).then((clock) => { - // @ts-expect-error https://github.com/cypress-io/cypress/issues/7577 - return clock.bind(window); + it("Items can be sorted - bottom row - portrait/mobile", () => { + cy.viewport("iphone-x"); // iPhone X portrait + cy.visit("/"); + cy.wait(3000); + const childElements = cy.get('div[id="issues-container"]').children(); + childElements.should("have.length", 2); + cy.get('[for="price-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="price-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="time-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="time-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="priority-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="priority-bottom"]').click(); + childElements.should("have.length", 2); + cy.get('[for="activity-bottom"]').should("be.visible").click(); + childElements.should("have.length", 2); + cy.get('[for="activity-bottom"]').click(); + childElements.should("have.length", 2); }); - cy.get('div[id="issues-container"]').children().should("have.length", 2); }); describe("Display message on rate limited", () => { const HHMMSS_REGEX = /([01]?[0-9]|2[0-3]):([0-5]?[0-9]):([0-5]?[0-9])/; const PLEASE_LOG_IN = "Please log in to GitHub to increase your GitHub API limits, otherwise you can try again at"; - const RATE_LIMITED = "You have been rate limited. Please try again at"; beforeEach(() => { - cy.intercept("https://api.github.com/rate_limit", { - statusCode: 200, - body: { - resources: { - core: { - limit: 5000, - used: 5000, - remaining: 0, - reset: 1617700000, - }, - }, - }, - }); cy.intercept("https://api.github.com/user", (req) => { req.reply({ statusCode: 403, - body: {}, - headers: { "x-ratelimit-reset": "1617700000" }, + body: { + message: + "API rate limit exceeded for 31.46.255.24. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", + documentation_url: "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting", + }, + headers: { "x-ratelimit-reset": String(+new Date() + 15 * 60 * 1000) }, }); }).as("getUser"); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 403, - headers: { "x-ratelimit-reset": "1617700000" }, - }); - }).as("getIssues"); }); it("Should display retry time frame and login request with no tasks and no user", () => { @@ -118,21 +137,6 @@ describe("DevPool", () => { }); }); - it("Should display retry time frame with no tasks loaded and a logged in user", () => { - cy.intercept("https://api.github.com/user", { - statusCode: 200, - body: githubUser, - }).as("getUser"); - - cy.visit("/"); - cy.get(".preview-header").should("exist"); - cy.get(".preview-body-inner").should(($body) => { - const text = $body.text(); - expect(text).to.include(RATE_LIMITED); - expect(HHMMSS_REGEX.test(text)).to.be.true; - }); - }); - it("Should log an error if the auth provider fails", () => { cy.on("window:before:load", (win) => { cy.stub(win.console, "error").as("consoleError"); @@ -150,73 +154,12 @@ describe("DevPool", () => { }); }); - it("Items can be sorted - top row - landscape/desktop", () => { - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2], - }); - }).as("getIssues"); - cy.visit("/"); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="price-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="price-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="time-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="time-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="priority-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="priority-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="activity-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="activity-top"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - }); - - it("Items can be sorted - bottom row - portrait/mobile", () => { - cy.viewport("iphone-x"); // iPhone X portrait - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2], - }); - }).as("getIssues"); - cy.visit("/"); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="price-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="price-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="time-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="time-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="priority-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="priority-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="activity-bottom"]').should("be.visible").click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - cy.get('[for="activity-bottom"]').click(); - cy.get('div[id="issues-container"]').children().should("have.length", 2); - }); - it("User can log in", () => { cy.intercept("https://api.github.com/user**", (req) => { req.reply({ statusCode: 404, }); }).as("getUser"); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2], - }); - }).as("getIssues"); cy.intercept("https://github.com/login**", (req) => { req.reply({ statusCode: 200, @@ -251,7 +194,7 @@ describe("DevPool", () => { describe("Display error modal", () => { it("should display an error modal when fetching issue previews fails on page load", () => { - cy.intercept("GET", "https://api.github.com/repos/ubiquity/devpool-directory/issues*", { + cy.intercept("GET", "https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues*", { statusCode: 500, body: "Internal Server Error", }).as("getPublicIssues"); @@ -274,48 +217,48 @@ describe("DevPool", () => { }); }); - it("Displayed user name should fall back to login when its name is empty", () => { - const userWithoutName = { - ...githubUser, - name: undefined, - }; - window.localStorage.setItem( - `sb-${Cypress.env("SUPABASE_STORAGE_KEY")}-auth-token`, - JSON.stringify({ - provider_token: "token", - access_token: "token", - token_type: "bearer", - user: userWithoutName, - }) - ); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - req.reply({ - statusCode: 200, - body: [issue1, issue2], - }); - }).as("getIssues"); - cy.intercept("https://api.github.com/user**", (req) => { - req.reply({ - statusCode: 200, - body: userWithoutName, - }); - }).as("getUser"); - cy.visit("/"); - cy.get("#authenticated > .full").should("have.text", "octocat"); - }); + // it("Displayed user name should fall back to login when its name is empty", () => { + // const userWithoutName = { + // ...githubUser, + // name: undefined, + // }; + // window.localStorage.setItem( + // `sb-${Cypress.env("SUPABASE_STORAGE_KEY")}-auth-token`, + // JSON.stringify({ + // provider_token: "token", + // access_token: "token", + // token_type: "bearer", + // user: userWithoutName, + // }) + // ); + // cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { + // req.reply({ + // statusCode: 200, + // body: [issue1, issue2], + // }); + // }).as("getIssues"); + // cy.intercept("https://api.github.com/user**", (req) => { + // req.reply({ + // statusCode: 200, + // body: userWithoutName, + // }); + // }).as("getUser"); + // cy.visit("/"); + // cy.get("#authenticated > .full").should("have.text", "octocat"); + // }); - it("Should display filters on small devices", () => { - cy.viewport("iphone-x"); - cy.intercept("https://api.github.com/user", { statusCode: 200, body: githubUser }).as("getUser"); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => req.reply({ statusCode: 200, body: [issue1, issue2] })).as("getIssues"); - cy.intercept("https://api.github.com/user/memberships/orgs/*", (req) => req.reply({ statusCode: 200 })).as("membership"); - cy.intercept("https://api.github.com/", (req) => { - req.headers["x-oauth-scopes"] = "repo"; - req.reply({ statusCode: 200 }); - }).as("head"); - cy.visit("/"); - cy.get("#authenticated").should("be.visible"); - cy.get("#augment-access-button").should("be.visible"); - cy.get('[for="price-bottom"]').should("be.visible"); - }); + // it("Should display filters on small devices", () => { + // cy.viewport("iphone-x"); + // cy.intercept("https://api.github.com/user", { statusCode: 200, body: githubUser }).as("getUser"); + // cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => req.reply({ statusCode: 200, body: [issue1, issue2] })).as("getIssues"); + // cy.intercept("https://api.github.com/user/memberships/orgs/*", (req) => req.reply({ statusCode: 200 })).as("membership"); + // cy.intercept("https://api.github.com/", (req) => { + // req.headers["x-oauth-scopes"] = "repo"; + // req.reply({ statusCode: 200 }); + // }).as("head"); + // cy.visit("/"); + // cy.get("#authenticated").should("be.visible"); + // cy.get("#augment-access-button").should("be.visible"); + // cy.get('[for="price-bottom"]').should("be.visible"); + // }); }); From 47e72b3280732a2eea3299ba394e85410eb62f36 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:45:40 +0200 Subject: [PATCH 02/14] chore: remove obsolete test --- cypress/e2e/devpool.cy.ts | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 592f4f46..b3914e44 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -192,31 +192,6 @@ describe("DevPool", () => { cy.get("#filter-top").should("be.visible"); }); - describe("Display error modal", () => { - it("should display an error modal when fetching issue previews fails on page load", () => { - cy.intercept("GET", "https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues*", { - statusCode: 500, - body: "Internal Server Error", - }).as("getPublicIssues"); - // Expect the error to be thrown - cy.once("uncaught:exception", () => false); - cy.intercept("https://api.github.com/user**", (req) => { - req.reply({ - statusCode: 200, - body: githubUser, - }); - }).as("getUser"); - - cy.visit("/"); - - cy.wait("@getPublicIssues"); - - cy.get(".preview-header").should("be.visible"); - cy.get(".preview-header").should("contain", "HttpError"); - cy.get(".preview-body-inner").should("contain", "Internal Server Error"); - }); - }); - // it("Displayed user name should fall back to login when its name is empty", () => { // const userWithoutName = { // ...githubUser, From ccc10acf21fec8ac09dbe703e00bc62d3cd3e83c Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:22:45 +0200 Subject: [PATCH 03/14] fix: include all elements --- src/home/rendering/display-github-user-information.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/home/rendering/display-github-user-information.ts b/src/home/rendering/display-github-user-information.ts index 36053524..27248620 100644 --- a/src/home/rendering/display-github-user-information.ts +++ b/src/home/rendering/display-github-user-information.ts @@ -37,12 +37,14 @@ export async function displayGitHubUserInformation(gitHubUser: GitHubUser) { window.location.reload(); }); + containerDivElement.appendChild(authenticatedDivElement); + if (await isOrgMemberWithoutScope()) { const accessButton = renderAugmentAccessButton(); containerDivElement.appendChild(accessButton); } - authenticationElement.appendChild(authenticatedDivElement); + authenticationElement.appendChild(containerDivElement); toolbar.setAttribute("data-authenticated", "true"); toolbar.classList.add("ready"); } From 9f71f45bdc2c16ffb56c5837e05e2f7faec50777 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:35:04 +0200 Subject: [PATCH 04/14] fix: bugs --- cypress/e2e/devpool.cy.ts | 145 +++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 79 deletions(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index b3914e44..81e1c231 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -1,26 +1,12 @@ import { RestEndpointMethodTypes } from "@octokit/rest"; import { Session } from "@supabase/supabase-js"; -// type Issue = { -// labels: []; -// }; - -// const fetchIssues = async () => { -// const url = "https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json"; -// const req = await fetch(url); -// return await req.json(); -// }; - -// const filterValidIssues = (issues: Issue[]) => { -// return issues.filter((issue) => issue.labels.length >= 3); -// }; - describe("DevPool", () => { let issue1: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let issue2: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let githubUser: Session["user"]; - before(async () => { + before(() => { cy.fixture("issue-1.json").then((content) => (issue1 = content)); cy.fixture("issue-2.json").then((content) => (issue2 = content)); cy.fixture("user-github.json").then((content) => (githubUser = content)); @@ -64,48 +50,46 @@ describe("DevPool", () => { it("Items can be sorted - top row - landscape/desktop", () => { cy.visit("/"); cy.wait(3000); - const childElements = cy.get('div[id="issues-container"]').children(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="price-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="price-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="time-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="time-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="priority-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="priority-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="activity-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="activity-top"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); }); it("Items can be sorted - bottom row - portrait/mobile", () => { cy.viewport("iphone-x"); // iPhone X portrait cy.visit("/"); cy.wait(3000); - const childElements = cy.get('div[id="issues-container"]').children(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="price-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="price-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="time-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="time-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="priority-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="priority-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="activity-bottom"]').should("be.visible").click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); cy.get('[for="activity-bottom"]').click(); - childElements.should("have.length", 2); + cy.get('div[id="issues-container"]').children().should("have.length", 2); }); }); @@ -189,51 +173,54 @@ describe("DevPool", () => { // Simulates the redirection after a successful login cy.visit("/"); cy.get("#authenticated").should("exist"); - cy.get("#filter-top").should("be.visible"); + // TODO + // cy.get("#filter-top").should("be.visible"); }); - // it("Displayed user name should fall back to login when its name is empty", () => { - // const userWithoutName = { - // ...githubUser, - // name: undefined, - // }; - // window.localStorage.setItem( - // `sb-${Cypress.env("SUPABASE_STORAGE_KEY")}-auth-token`, - // JSON.stringify({ - // provider_token: "token", - // access_token: "token", - // token_type: "bearer", - // user: userWithoutName, - // }) - // ); - // cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { - // req.reply({ - // statusCode: 200, - // body: [issue1, issue2], - // }); - // }).as("getIssues"); - // cy.intercept("https://api.github.com/user**", (req) => { - // req.reply({ - // statusCode: 200, - // body: userWithoutName, - // }); - // }).as("getUser"); - // cy.visit("/"); - // cy.get("#authenticated > .full").should("have.text", "octocat"); - // }); + it("Displayed user name should fall back to login when its name is empty", () => { + const userWithoutName = { + ...githubUser, + name: undefined, + }; + window.localStorage.setItem( + `sb-${Cypress.env("SUPABASE_STORAGE_KEY")}-auth-token`, + JSON.stringify({ + provider_token: "token", + access_token: "token", + token_type: "bearer", + user: userWithoutName, + }) + ); + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { + req.reply({ + statusCode: 200, + body: [issue1, issue2], + }); + }).as("getIssues"); + cy.intercept("https://api.github.com/user**", (req) => { + req.reply({ + statusCode: 200, + body: userWithoutName, + }); + }).as("getUser"); + cy.visit("/"); + cy.get("#authenticated > .full").should("have.text", "octocat"); + }); - // it("Should display filters on small devices", () => { - // cy.viewport("iphone-x"); - // cy.intercept("https://api.github.com/user", { statusCode: 200, body: githubUser }).as("getUser"); - // cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => req.reply({ statusCode: 200, body: [issue1, issue2] })).as("getIssues"); - // cy.intercept("https://api.github.com/user/memberships/orgs/*", (req) => req.reply({ statusCode: 200 })).as("membership"); - // cy.intercept("https://api.github.com/", (req) => { - // req.headers["x-oauth-scopes"] = "repo"; - // req.reply({ statusCode: 200 }); - // }).as("head"); - // cy.visit("/"); - // cy.get("#authenticated").should("be.visible"); - // cy.get("#augment-access-button").should("be.visible"); - // cy.get('[for="price-bottom"]').should("be.visible"); - // }); + it("Should display filters on small devices", () => { + cy.viewport("iphone-x"); + cy.intercept("https://api.github.com/user**", { statusCode: 200, body: githubUser }).as("getUser"); + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => + req.reply({ statusCode: 200, body: [issue1, issue2] }) + ).as("getIssues"); + cy.intercept("https://api.github.com/user/memberships/orgs/*", (req) => req.reply({ statusCode: 200 })).as("membership"); + cy.intercept("https://api.github.com/orgs/*/members/**", (req) => { + req.headers["x-oauth-scopes"] = "repo"; + req.reply({ statusCode: 200 }); + }); + cy.visit("/"); + cy.get("#authenticated").should("be.visible"); + cy.get("#augment-access-button").should("be.visible"); + cy.get('[for="price-bottom"]').should("be.visible"); + }); }); From 92affb88f793bdf9b22f2ed1d2d3932bcb675468 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Tue, 8 Oct 2024 23:38:38 +0200 Subject: [PATCH 05/14] chore: update fixtures --- cypress/fixtures/issue-1.json | 122 +++++++++++++--------------------- cypress/fixtures/issue-2.json | 122 +++++++++++++--------------------- 2 files changed, 96 insertions(+), 148 deletions(-) diff --git a/cypress/fixtures/issue-1.json b/cypress/fixtures/issue-1.json index 35e19af3..5bc35521 100644 --- a/cypress/fixtures/issue-1.json +++ b/cypress/fixtures/issue-1.json @@ -1,86 +1,59 @@ { - "url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085", - "repository_url": "https://api.github.com/repos/ubiquity/devpool-directory", - "labels_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085/labels{/name}", - "comments_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085/comments", - "events_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085/events", - "html_url": "https://github.com/ubiquity/devpool-directory/issues/1085", - "id": 2152486458, - "node_id": "I_kwDOJWyCVM6ATFY6", - "number": 1085, - "title": "Secure Secrets for Generalized Continuous Deploys", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964", + "repository_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar", + "labels_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964/labels{/name}", + "comments_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964/comments", + "events_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964/events", + "html_url": "https://github.com/ubiquity/ubiquity-dollar/issues/964", + "id": 2548532846, + "node_id": "I_kwDOF4fVBs6X54Zu", + "number": 964, + "title": "Cloudflare Rate Limiting Too Aggressive", "user": { - "login": "ubiquibot[bot]", - "id": 113181824, - "node_id": "BOT_kgDOBr8EgA", - "avatar_url": "https://avatars.githubusercontent.com/in/236521?v=4", + "login": "0x4007", + "id": 4975670, + "node_id": "MDQ6VXNlcjQ5NzU2NzA=", + "avatar_url": "https://avatars.githubusercontent.com/u/4975670?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/ubiquibot%5Bbot%5D", - "html_url": "https://github.com/apps/ubiquibot", - "followers_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/followers", - "following_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/following{/other_user}", - "gists_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/subscriptions", - "organizations_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/orgs", - "repos_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/repos", - "events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/events{/privacy}", - "received_events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/received_events", - "type": "Bot", + "url": "https://api.github.com/users/0x4007", + "html_url": "https://github.com/0x4007", + "followers_url": "https://api.github.com/users/0x4007/followers", + "following_url": "https://api.github.com/users/0x4007/following{/other_user}", + "gists_url": "https://api.github.com/users/0x4007/gists{/gist_id}", + "starred_url": "https://api.github.com/users/0x4007/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/0x4007/subscriptions", + "organizations_url": "https://api.github.com/users/0x4007/orgs", + "repos_url": "https://api.github.com/users/0x4007/repos", + "events_url": "https://api.github.com/users/0x4007/events{/privacy}", + "received_events_url": "https://api.github.com/users/0x4007/received_events", + "type": "User", "site_admin": false }, "labels": [ { - "id": 5389720203, - "node_id": "LA_kwDOJWyCVM8AAAABQUCaiw", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Time:%20%3C1%20Day", - "name": "Time: <1 Day", + "id": 5898797872, + "node_id": "LA_kwDOF4fVBs8AAAABX5iDMA", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Time:%20%3C1%20Hour", + "name": "Time: <1 Hour", "color": "ededed", "default": false, "description": null }, { - "id": 5390246739, - "node_id": "LA_kwDOJWyCVM8AAAABQUijUw", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Pricing:%20600%20USD", - "name": "Pricing: 600 USD", + "id": 5898805715, + "node_id": "LA_kwDOF4fVBs8AAAABX5ih0w", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Priority:%202%20(Medium)", + "name": "Priority: 2 (Medium)", "color": "ededed", "default": false, "description": null }, { - "id": 5639152271, - "node_id": "LA_kwDOJWyCVM8AAAABUB6ijw", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Unavailable", - "name": "Unavailable", - "color": "ededed", - "default": false, - "description": "" - }, - { - "id": 5906091134, - "node_id": "LA_kwDOJWyCVM8AAAABYAfMfg", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Priority:%203%20(High)", - "name": "Priority: 3 (High)", - "color": "ededed", - "default": false, - "description": null - }, - { - "id": 6607857261, - "node_id": "LA_kwDOJWyCVM8AAAABidvmbQ", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Partner:%20ubiquity/cloudflare-deploy-action", - "name": "Partner: ubiquity/cloudflare-deploy-action", - "color": "ededed", - "default": false, - "description": null - }, - { - "id": 6607857262, - "node_id": "LA_kwDOJWyCVM8AAAABidvmbg", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/id:%20I_kwDOLGaFrM6ATBS4", - "name": "id: I_kwDOLGaFrM6ATBS4", - "color": "ededed", + "id": 7516302001, + "node_id": "LA_kwDOF4fVBs8AAAABwAGqsQ", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Price:%2050%20USD", + "name": "Price: 50 USD", + "color": "1f883d", "default": false, "description": null } @@ -90,15 +63,16 @@ "assignee": null, "assignees": [], "milestone": null, - "comments": 0, - "created_at": "2024-02-24T21:18:55Z", - "updated_at": "2024-02-25T06:40:46Z", + "comments": 2, + "created_at": "2024-09-25T17:08:45Z", + "updated_at": "2024-09-27T14:53:31Z", "closed_at": null, - "author_association": "CONTRIBUTOR", + "author_association": "MEMBER", "active_lock_reason": null, - "body": "https://github.com/ubiquity/cloudflare-deploy-action/issues/1", + "body": "I can't load the staking UI (start from uad.ubq.fi, navigate to staking) due to rate limits. We need some exceptions on this subdomain. ", + "closed_by": null, "reactions": { - "url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085/reactions", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964/reactions", "total_count": 0, "+1": 0, "-1": 0, @@ -109,7 +83,7 @@ "rocket": 0, "eyes": 0 }, - "timeline_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1085/timeline", + "timeline_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/964/timeline", "performed_via_github_app": null, "state_reason": null -} +} \ No newline at end of file diff --git a/cypress/fixtures/issue-2.json b/cypress/fixtures/issue-2.json index 170f7a80..e4db63a6 100644 --- a/cypress/fixtures/issue-2.json +++ b/cypress/fixtures/issue-2.json @@ -1,86 +1,59 @@ { - "url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084", - "repository_url": "https://api.github.com/repos/ubiquity/devpool-directory", - "labels_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084/labels{/name}", - "comments_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084/comments", - "events_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084/events", - "html_url": "https://github.com/ubiquity/devpool-directory/issues/1084", - "id": 2151943906, - "node_id": "I_kwDOJWyCVM6ARA7i", - "number": 1084, - "title": "Total Rewards Available", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937", + "repository_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar", + "labels_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937/labels{/name}", + "comments_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937/comments", + "events_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937/events", + "html_url": "https://github.com/ubiquity/ubiquity-dollar/issues/937", + "id": 2284873479, + "node_id": "I_kwDOF4fVBs6IMGcH", + "number": 937, + "title": "Final Pre-Seed/Seed Investor Debt UBQ", "user": { - "login": "ubiquibot[bot]", - "id": 113181824, - "node_id": "BOT_kgDOBr8EgA", - "avatar_url": "https://avatars.githubusercontent.com/in/236521?v=4", + "login": "0x4007", + "id": 4975670, + "node_id": "MDQ6VXNlcjQ5NzU2NzA=", + "avatar_url": "https://avatars.githubusercontent.com/u/4975670?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/ubiquibot%5Bbot%5D", - "html_url": "https://github.com/apps/ubiquibot", - "followers_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/followers", - "following_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/following{/other_user}", - "gists_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/subscriptions", - "organizations_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/orgs", - "repos_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/repos", - "events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/events{/privacy}", - "received_events_url": "https://api.github.com/users/ubiquibot%5Bbot%5D/received_events", - "type": "Bot", + "url": "https://api.github.com/users/0x4007", + "html_url": "https://github.com/0x4007", + "followers_url": "https://api.github.com/users/0x4007/followers", + "following_url": "https://api.github.com/users/0x4007/following{/other_user}", + "gists_url": "https://api.github.com/users/0x4007/gists{/gist_id}", + "starred_url": "https://api.github.com/users/0x4007/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/0x4007/subscriptions", + "organizations_url": "https://api.github.com/users/0x4007/orgs", + "repos_url": "https://api.github.com/users/0x4007/repos", + "events_url": "https://api.github.com/users/0x4007/events{/privacy}", + "received_events_url": "https://api.github.com/users/0x4007/received_events", + "type": "User", "site_admin": false }, "labels": [ { - "id": 5390000409, - "node_id": "LA_kwDOJWyCVM8AAAABQUThGQ", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Pricing:%20100%20USD", - "name": "Pricing: 100 USD", + "id": 5898797927, + "node_id": "LA_kwDOF4fVBs8AAAABX5iDZw", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Time:%20%3C4%20Hours", + "name": "Time: <4 Hours", "color": "ededed", "default": false, "description": null }, { - "id": 5569657473, - "node_id": "LA_kwDOJWyCVM8AAAABS_o6gQ", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Partner:%20ubiquity/devpool-directory-bounties", - "name": "Partner: ubiquity/devpool-directory-bounties", + "id": 5898805810, + "node_id": "LA_kwDOF4fVBs8AAAABX5iiMg", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Priority:%203%20(High)", + "name": "Priority: 3 (High)", "color": "ededed", "default": false, "description": null }, { - "id": 5639152271, - "node_id": "LA_kwDOJWyCVM8AAAABUB6ijw", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Unavailable", - "name": "Unavailable", - "color": "ededed", - "default": false, - "description": "" - }, - { - "id": 5906090761, - "node_id": "LA_kwDOJWyCVM8AAAABYAfLCQ", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Time:%20%3C2%20Hours", - "name": "Time: <2 Hours", - "color": "ededed", - "default": false, - "description": null - }, - { - "id": 5906091042, - "node_id": "LA_kwDOJWyCVM8AAAABYAfMIg", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/Priority:%202%20(Medium)", - "name": "Priority: 2 (Medium)", - "color": "ededed", - "default": false, - "description": null - }, - { - "id": 6604779305, - "node_id": "LA_kwDOJWyCVM8AAAABiazvKQ", - "url": "https://api.github.com/repos/ubiquity/devpool-directory/labels/id:%20I_kwDOJhaJks6AQ8tX", - "name": "id: I_kwDOJhaJks6AQ8tX", - "color": "ededed", + "id": 6922903766, + "node_id": "LA_kwDOF4fVBs8AAAABnKMg1g", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/labels/Price:%20450%20USD", + "name": "Price: 450 USD", + "color": "1f883d", "default": false, "description": null } @@ -90,15 +63,16 @@ "assignee": null, "assignees": [], "milestone": null, - "comments": 0, - "created_at": "2024-02-23T23:19:21Z", - "updated_at": "2024-02-25T06:40:39Z", + "comments": 27, + "created_at": "2024-05-08T07:20:20Z", + "updated_at": "2024-10-07T07:19:19Z", "closed_at": null, - "author_association": "CONTRIBUTOR", + "author_association": "MEMBER", "active_lock_reason": null, - "body": "https://github.com/ubiquity/devpool-directory-bounties/issues/18", + "body": "> So what's next steps to watch out for? Do we need to fix the amounts again when the stakes are withdrawn?\r\n\r\nFinally!\r\n\r\nThe next 'final' batch should be done after bonds expiry. Only then the remaining exact payout amounts will be available.\r\n\r\nThe algorithm will be:\r\n\r\n1) Update network block number in https://github.com/gitcoindev/uad-contracts/blob/staking-mutliplier-fix/tasks/simulateBondingDebt.ts and execute the script again using the following command:\r\n\r\n`$ npx hardhat simulateBondingDebt`\r\n\r\nThis will fork the blockchain, get the current inflation rate and output missing stake values for the same set of bonds. What was paid / disbursed today, should be subtracted from the amount that will be shown.\r\n\r\n2) The BondingDebtV2 / BondingDebtFinal contract will be deployed in the same way BondingDebt, but with remaining UBQ values for the bond holders.\r\n\r\n\r\n\r\n\n\n_Originally posted by @gitcoindev in https://github.com/ubiquity/ubiquity-dollar/issues/752#issuecomment-2098994982_", + "closed_by": null, "reactions": { - "url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084/reactions", + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937/reactions", "total_count": 0, "+1": 0, "-1": 0, @@ -109,7 +83,7 @@ "rocket": 0, "eyes": 0 }, - "timeline_url": "https://api.github.com/repos/ubiquity/devpool-directory/issues/1084/timeline", + "timeline_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/937/timeline", "performed_via_github_app": null, "state_reason": null -} +} \ No newline at end of file From ac1318e6537b3471291682e25961a24d11cee5b7 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:34:31 +0200 Subject: [PATCH 06/14] chore: format --- cypress/e2e/devpool.cy.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 81e1c231..9d74ead6 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -173,8 +173,7 @@ describe("DevPool", () => { // Simulates the redirection after a successful login cy.visit("/"); cy.get("#authenticated").should("exist"); - // TODO - // cy.get("#filter-top").should("be.visible"); + cy.get("#filter-top").should("be.visible"); }); it("Displayed user name should fall back to login when its name is empty", () => { @@ -209,7 +208,12 @@ describe("DevPool", () => { it("Should display filters on small devices", () => { cy.viewport("iphone-x"); - cy.intercept("https://api.github.com/user**", { statusCode: 200, body: githubUser }).as("getUser"); + cy.intercept("https://api.github.com/user**", (req) => { + req.reply({ + statusCode: 200, + body: githubUser, + }); + }).as("getUser"); cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => req.reply({ statusCode: 200, body: [issue1, issue2] }) ).as("getIssues"); From 452d8f2cb9bf2439df5ef4fef8ce6999d90568fd Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:40:06 +0200 Subject: [PATCH 07/14] chore: invalid issue fixture --- cypress/fixtures/invalid-issue.json | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 cypress/fixtures/invalid-issue.json diff --git a/cypress/fixtures/invalid-issue.json b/cypress/fixtures/invalid-issue.json new file mode 100644 index 00000000..3e1a0ede --- /dev/null +++ b/cypress/fixtures/invalid-issue.json @@ -0,0 +1,80 @@ +{ + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939", + "repository_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar", + "labels_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939/labels{/name}", + "comments_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939/comments", + "events_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939/events", + "html_url": "https://github.com/ubiquity/ubiquity-dollar/issues/939", + "id": 2309724903, + "node_id": "I_kwDOF4fVBs6Jq5rn", + "number": 939, + "title": "Investigate and confirm the behaviour for new staking users for uad-contracts and diamond", + "user": { + "login": "gitcoindev", + "id": 88761781, + "node_id": "MDQ6VXNlcjg4NzYxNzgx", + "avatar_url": "https://avatars.githubusercontent.com/u/88761781?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gitcoindev", + "html_url": "https://github.com/gitcoindev", + "followers_url": "https://api.github.com/users/gitcoindev/followers", + "following_url": "https://api.github.com/users/gitcoindev/following{/other_user}", + "gists_url": "https://api.github.com/users/gitcoindev/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gitcoindev/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gitcoindev/subscriptions", + "organizations_url": "https://api.github.com/users/gitcoindev/orgs", + "repos_url": "https://api.github.com/users/gitcoindev/repos", + "events_url": "https://api.github.com/users/gitcoindev/events{/privacy}", + "received_events_url": "https://api.github.com/users/gitcoindev/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 10, + "created_at": "2024-05-22T06:55:19Z", + "updated_at": "2024-09-27T20:05:30Z", + "closed_at": null, + "author_association": "CONTRIBUTOR", + "active_lock_reason": null, + "body": "Right now the behaviour for new staking users is this one:\r\n1) User deposits 1000 `UAD3CRV LP` to https://etherscan.io/address/0xc251ecd9f1bd5230823f9a0f99a44a87ddd4ca38 for 1 week\r\n2) User waits for 1 week\r\n3) User withdraws 1000 `UAD3CRV LP` and gets 178 `UAD3CRV LP` + 72 `UBQ`. User would expect to get 1000 `UAD3CRV LP` instead of 178.\r\n\r\n_Originally posted by @rndquu in https://github.com/ubiquity/ubiquity-dollar/issues/752#issuecomment-2078849441_\r\n ", + "closed_by": { + "login": "0x4007", + "id": 4975670, + "node_id": "MDQ6VXNlcjQ5NzU2NzA=", + "avatar_url": "https://avatars.githubusercontent.com/u/4975670?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/0x4007", + "html_url": "https://github.com/0x4007", + "followers_url": "https://api.github.com/users/0x4007/followers", + "following_url": "https://api.github.com/users/0x4007/following{/other_user}", + "gists_url": "https://api.github.com/users/0x4007/gists{/gist_id}", + "starred_url": "https://api.github.com/users/0x4007/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/0x4007/subscriptions", + "organizations_url": "https://api.github.com/users/0x4007/orgs", + "repos_url": "https://api.github.com/users/0x4007/repos", + "events_url": "https://api.github.com/users/0x4007/events{/privacy}", + "received_events_url": "https://api.github.com/users/0x4007/received_events", + "type": "User", + "site_admin": false + }, + "reactions": { + "url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/ubiquity/ubiquity-dollar/issues/939/timeline", + "performed_via_github_app": null, + "state_reason": "reopened" +} \ No newline at end of file From 045c0433187ae43c833ebe18fc3500d9ab4a3575 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:40:39 +0200 Subject: [PATCH 08/14] test: don't show invalid tests --- cypress/e2e/devpool.cy.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 9d74ead6..79633c5d 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -4,11 +4,13 @@ import { Session } from "@supabase/supabase-js"; describe("DevPool", () => { let issue1: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let issue2: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; + let invalidIssue: RestEndpointMethodTypes["issues"]["get"]["response"]["data"]; let githubUser: Session["user"]; before(() => { cy.fixture("issue-1.json").then((content) => (issue1 = content)); cy.fixture("issue-2.json").then((content) => (issue2 = content)); + cy.fixture("invalid-issue.json").then((content) => (invalidIssue = content)); cy.fixture("user-github.json").then((content) => (githubUser = content)); }); @@ -91,6 +93,19 @@ describe("DevPool", () => { cy.get('[for="activity-bottom"]').click(); cy.get('div[id="issues-container"]').children().should("have.length", 2); }); + + it("Main page don't display invalid issue", () => { + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { + req.reply({ + statusCode: 200, + body: [issue1, issue2, invalidIssue], + }); + }).as("getIssueDetails"); + + cy.visit("/"); + cy.wait(3000); + cy.get('div[id="issues-container"]').children().should("have.length", 2); + }); }); describe("Display message on rate limited", () => { From 6a8a5e2f67a2f4698b09c8118fa74062a80a24ec Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:45:01 +0200 Subject: [PATCH 09/14] chore: typo --- cypress/e2e/devpool.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 79633c5d..8f00debd 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -94,7 +94,7 @@ describe("DevPool", () => { cy.get('div[id="issues-container"]').children().should("have.length", 2); }); - it("Main page don't display invalid issue", () => { + it("Main page shouldn't display invalid issue", () => { cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { req.reply({ statusCode: 200, From 12232c363c980f5b78d65cb9e5787c22b6502561 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Thu, 10 Oct 2024 22:44:50 +0200 Subject: [PATCH 10/14] chore: remove redundant check --- cypress/e2e/devpool.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 8f00debd..451455e1 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -176,7 +176,6 @@ describe("DevPool", () => { }).as("githubPage"); cy.visit("/"); // Check that there is no text field visible for sorting - cy.get("#filter-top").should("not.be.visible"); cy.get("#github-login-button").click(); // Change the interception because now we are supposed to be logged in cy.intercept("https://api.github.com/user**", (req) => { From 982cc497bc0a86555730593de20d097f1ce1d5ce Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Thu, 10 Oct 2024 22:45:07 +0200 Subject: [PATCH 11/14] fix: remove test isolation --- cypress.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.config.ts b/cypress.config.ts index c83c686b..0d5b10d1 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -17,6 +17,7 @@ export default defineConfig({ }, baseUrl: "http://localhost:8080", experimentalStudio: true, + testIsolation: false }, viewportHeight: 900, viewportWidth: 1440, From 3fa31662d018b0cdb44377f980ba314ecee6bae2 Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Thu, 10 Oct 2024 23:34:02 +0200 Subject: [PATCH 12/14] chore: revert config --- cypress.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress.config.ts b/cypress.config.ts index 0d5b10d1..c83c686b 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -17,7 +17,6 @@ export default defineConfig({ }, baseUrl: "http://localhost:8080", experimentalStudio: true, - testIsolation: false }, viewportHeight: 900, viewportWidth: 1440, From e3c7a05355bd2f78fc2f10d848faf02b30e58cba Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Sat, 12 Oct 2024 05:59:32 +0200 Subject: [PATCH 13/14] fix: broken css --- src/home/rendering/display-github-user-information.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/home/rendering/display-github-user-information.ts b/src/home/rendering/display-github-user-information.ts index 27248620..b317ebf0 100644 --- a/src/home/rendering/display-github-user-information.ts +++ b/src/home/rendering/display-github-user-information.ts @@ -41,7 +41,7 @@ export async function displayGitHubUserInformation(gitHubUser: GitHubUser) { if (await isOrgMemberWithoutScope()) { const accessButton = renderAugmentAccessButton(); - containerDivElement.appendChild(accessButton); + authenticatedDivElement.appendChild(accessButton); } authenticationElement.appendChild(containerDivElement); From 7c256cb908aba35acea43fb4504ec689918c6f9d Mon Sep 17 00:00:00 2001 From: nick-dev123 <144809451+nick-dev123@users.noreply.github.com> Date: Sat, 19 Oct 2024 22:53:57 +0200 Subject: [PATCH 14/14] fix: use correct url --- cypress/e2e/devpool.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 451455e1..96e1f8c7 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -34,7 +34,7 @@ describe("DevPool", () => { beforeEach(() => { // Very important to make sure we don't store data between tests cy.clearLocalStorage(); - cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/__STORAGE__/devpool-issues.json", (req) => { req.reply({ statusCode: 200, body: [issue1, issue2], @@ -95,7 +95,7 @@ describe("DevPool", () => { }); it("Main page shouldn't display invalid issue", () => { - cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/__STORAGE__/devpool-issues.json", (req) => { req.reply({ statusCode: 200, body: [issue1, issue2, invalidIssue],