diff --git a/cypress/e2e/devpool.cy.ts b/cypress/e2e/devpool.cy.ts index 4bf22d79..96e1f8c7 100644 --- a/cypress/e2e/devpool.cy.ts +++ b/cypress/e2e/devpool.cy.ts @@ -4,23 +4,19 @@ 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)); }); 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 +30,100 @@ 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/__STORAGE__/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); + 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); + }); - // 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); + 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("Main page shouldn't display invalid issue", () => { + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/__STORAGE__/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); }); - 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 +136,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 +153,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, @@ -234,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) => { @@ -249,31 +190,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://api.github.com/repos/ubiquity/devpool-directory/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, @@ -288,7 +204,7 @@ describe("DevPool", () => { user: userWithoutName, }) ); - cy.intercept("https://api.github.com/repos/*/*/issues**", (req) => { + cy.intercept("https://raw.githubusercontent.com/ubiquity/devpool-directory/refs/heads/development/devpool-issues.json", (req) => { req.reply({ statusCode: 200, body: [issue1, issue2], @@ -306,13 +222,20 @@ 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/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: 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/", (req) => { + cy.intercept("https://api.github.com/orgs/*/members/**", (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"); 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 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 diff --git a/src/home/rendering/display-github-user-information.ts b/src/home/rendering/display-github-user-information.ts index 36053524..b317ebf0 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); + authenticatedDivElement.appendChild(accessButton); } - authenticationElement.appendChild(authenticatedDivElement); + authenticationElement.appendChild(containerDivElement); toolbar.setAttribute("data-authenticated", "true"); toolbar.classList.add("ready"); }