-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
464db21
commit c73384f
Showing
15 changed files
with
1,154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { OAuthToken } from "../../static/scripts/onboarding/github-login-button"; | ||
|
||
describe("Homepage tests", () => { | ||
const ORG_NAME = "Ubiquity"; | ||
let loginToken: OAuthToken; | ||
|
||
beforeEach(() => { | ||
cy.fixture("get-user.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/users/${ORG_NAME}`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetUser"); | ||
}); | ||
cy.fixture("get-ubiquibot-config.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/repos/${ORG_NAME}/ubiquibot-config`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetUbiquibotConfig"); | ||
}); | ||
cy.fixture("get-repos.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/orgs/${ORG_NAME}/repos`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetRepos"); | ||
}); | ||
cy.fixture("get-installations.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/orgs/${ORG_NAME}/installations**`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetInstallations"); | ||
}); | ||
cy.fixture("get-installation-repositories.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/user/installations/47252474/repositories`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetInstallationRepositories"); | ||
}); | ||
cy.fixture("put-file.json").then((file) => { | ||
cy.intercept("PUT", `https://api.github.com/user/installations/47252474/repositories/641336624`, (req) => { | ||
req.reply(file); | ||
}).as("githubPutInstallation"); | ||
}); | ||
cy.fixture("put-file.json").then((file) => { | ||
cy.intercept("PUT", `https://api.github.com/repos/${ORG_NAME}/ubiquibot-config/contents/.github%2Fubiquibot-config.yml`, (req) => { | ||
req.reply(file); | ||
}).as("githubPutConfigFile"); | ||
}); | ||
cy.fixture("get-orgs.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/user/orgs**`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetUserOrgs"); | ||
}); | ||
cy.fixture("get-org-installations.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/orgs/${ORG_NAME.toLowerCase()}/installations**`, (req) => { | ||
req.reply(file); | ||
}).as("githubGetOrgInstallations"); | ||
}); | ||
cy.fixture("get-search.json").then((file) => { | ||
cy.intercept("GET", `https://api.github.com/search/repositories**`, (req) => { | ||
req.reply(file); | ||
}).as("githubSearch"); | ||
}); | ||
cy.fixture("put-config.json").then((file) => { | ||
cy.intercept("PUT", `https://api.github.com/repos/${ORG_NAME.toLowerCase()}/ubiquibot-config/contents/.github**`, (req) => { | ||
req.reply(file); | ||
}).as("githubPutContents"); | ||
}); | ||
cy.fixture("user-token.json").then((content) => { | ||
loginToken = content; | ||
}); | ||
}); | ||
|
||
it("Console is cleared of errors and warnings", () => { | ||
cy.visit("/", { | ||
onBeforeLoad(win) { | ||
cy.stub(win.console, "error").as("consoleError"); | ||
}, | ||
}); | ||
cy.get("@consoleError").should("not.be.called"); | ||
cy.get("body").should("exist"); | ||
}); | ||
|
||
it.only("Create onboarding repository", () => { | ||
cy.visit("/"); | ||
cy.intercept("https://github.com/login/oauth/authorize**", (req) => { | ||
req.reply({ | ||
statusCode: 200, | ||
}); | ||
// Simulate login token | ||
// cspell:ignore wfzpewmlyiozupulbuur | ||
window.localStorage.setItem("sb-wfzpewmlyiozupulbuur-auth-token", JSON.stringify(loginToken)); | ||
}).as("githubLogin"); | ||
cy.get("#github-login-button").click(); | ||
cy.visit("/"); | ||
cy.wait("@githubGetUserOrgs"); | ||
cy.get("#setBtn").click(); | ||
cy.log("Display warning on empty WALLET_PRIVATE_KEY"); | ||
cy.get(":nth-child(3) > .status-log.warn").contains(/.+/); | ||
cy.get("#orgName").select("ubiquity"); | ||
cy.get("#setBtn").click(); | ||
cy.get("#outKey").then((e) => { | ||
expect(e.val()).not.to.be.empty; | ||
}); | ||
cy.log("Expected to be a step 2 of the form"); | ||
cy.get("#stepper > :nth-child(2)").should("have.class", "active"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
"total_count": 1, | ||
"repositories": [ | ||
{ | ||
"id": 767829567, | ||
"node_id": "R_kgDOLcQmPw", | ||
"name": "ubiquibot-config", | ||
"full_name": "Ubiquity/ubiquibot-config", | ||
"private": true, | ||
"owner": { | ||
"login": "Ubiquity", | ||
"id": 159901852, | ||
"node_id": "O_kgDOCYfonA", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/159901852?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/Ubiquity", | ||
"html_url": "https://github.com/Ubiquity", | ||
"followers_url": "https://api.github.com/users/Ubiquity/followers", | ||
"following_url": "https://api.github.com/users/Ubiquity/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/Ubiquity/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/Ubiquity/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/Ubiquity/subscriptions", | ||
"organizations_url": "https://api.github.com/users/Ubiquity/orgs", | ||
"repos_url": "https://api.github.com/users/Ubiquity/repos", | ||
"events_url": "https://api.github.com/users/Ubiquity/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/Ubiquity/received_events", | ||
"type": "Organization", | ||
"site_admin": false | ||
}, | ||
"html_url": "https://github.com/Ubiquity/ubiquibot-config", | ||
"description": null, | ||
"fork": false, | ||
"url": "https://api.github.com/repos/Ubiquity/ubiquibot-config", | ||
"forks_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/forks", | ||
"keys_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/teams", | ||
"hooks_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/hooks", | ||
"issue_events_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/events", | ||
"assignees_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/tags", | ||
"blobs_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/languages", | ||
"stargazers_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/stargazers", | ||
"contributors_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/contributors", | ||
"subscribers_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/subscribers", | ||
"subscription_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/subscription", | ||
"commits_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/merges", | ||
"archive_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/downloads", | ||
"issues_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/pulls{/number}", | ||
"milestones_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/milestones{/number}", | ||
"notifications_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/notifications{?since,all,participating}", | ||
"labels_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/Ubiquity/ubiquibot-config/deployments", | ||
"created_at": "2024-03-06T01:00:06Z", | ||
"updated_at": "2024-03-06T01:00:07Z", | ||
"pushed_at": "2024-03-06T01:00:07Z", | ||
"git_url": "git://github.com/Ubiquity/ubiquibot-config.git", | ||
"ssh_url": "[email protected]:Ubiquity/ubiquibot-config.git", | ||
"clone_url": "https://github.com/Ubiquity/ubiquibot-config.git", | ||
"svn_url": "https://github.com/Ubiquity/ubiquibot-config", | ||
"homepage": null, | ||
"size": 0, | ||
"stargazers_count": 0, | ||
"watchers_count": 0, | ||
"language": null, | ||
"has_issues": true, | ||
"has_projects": true, | ||
"has_downloads": true, | ||
"has_wiki": false, | ||
"has_pages": false, | ||
"has_discussions": false, | ||
"forks_count": 0, | ||
"mirror_url": null, | ||
"archived": false, | ||
"disabled": false, | ||
"open_issues_count": 0, | ||
"license": null, | ||
"allow_forking": false, | ||
"is_template": false, | ||
"web_commit_signoff_required": false, | ||
"topics": [ | ||
|
||
], | ||
"visibility": "private", | ||
"forks": 0, | ||
"open_issues": 0, | ||
"watchers": 0, | ||
"default_branch": "main", | ||
"permissions": { | ||
"admin": true, | ||
"maintain": true, | ||
"push": true, | ||
"triage": true, | ||
"pull": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"total_count": 2, | ||
"installations": [ | ||
{ | ||
"id": 47252474, | ||
"account": { | ||
"login": "Ubiquity", | ||
"id": 159901852, | ||
"node_id": "O_kgDOCYfonA", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/159901852?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/Ubiquity", | ||
"html_url": "https://github.com/Ubiquity", | ||
"followers_url": "https://api.github.com/users/Ubiquity/followers", | ||
"following_url": "https://api.github.com/users/Ubiquity/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/Ubiquity/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/Ubiquity/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/Ubiquity/subscriptions", | ||
"organizations_url": "https://api.github.com/users/Ubiquity/orgs", | ||
"repos_url": "https://api.github.com/users/Ubiquity/repos", | ||
"events_url": "https://api.github.com/users/Ubiquity/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/Ubiquity/received_events", | ||
"type": "Organization", | ||
"site_admin": false | ||
}, | ||
"repository_selection": "all", | ||
"access_tokens_url": "https://api.github.com/app/installations/47252474/access_tokens", | ||
"repositories_url": "https://api.github.com/installation/repositories", | ||
"html_url": "https://github.com/organizations/Ubiquity/settings/installations/47252474", | ||
"app_id": 236521, | ||
"app_slug": "ubiquibot", | ||
"target_id": 159901852, | ||
"target_type": "Organization", | ||
"permissions": { | ||
"issues": "write", | ||
"actions": "write", | ||
"members": "read", | ||
"contents": "write", | ||
"metadata": "read", | ||
"pull_requests": "write" | ||
}, | ||
"events": [ | ||
"commit_comment", | ||
"create", | ||
"delete", | ||
"fork", | ||
"gollum", | ||
"issues", | ||
"issue_comment", | ||
"label", | ||
"member", | ||
"membership", | ||
"merge_queue_entry", | ||
"milestone", | ||
"organization", | ||
"public", | ||
"pull_request", | ||
"pull_request_review", | ||
"pull_request_review_comment", | ||
"pull_request_review_thread", | ||
"push", | ||
"release", | ||
"repository", | ||
"repository_dispatch", | ||
"star", | ||
"team", | ||
"team_add", | ||
"watch", | ||
"workflow_dispatch", | ||
"workflow_job", | ||
"workflow_run" | ||
], | ||
"created_at": "2024-02-13T19:37:30.000+09:00", | ||
"updated_at": "2024-02-13T19:37:31.000+09:00", | ||
"single_file_name": null, | ||
"has_multiple_single_files": false, | ||
"single_file_paths": [ | ||
|
||
], | ||
"suspended_by": null, | ||
"suspended_at": null | ||
}, | ||
{ | ||
"id": 47255717, | ||
"account": { | ||
"login": "Ubiquity", | ||
"id": 159901852, | ||
"node_id": "O_kgDOCYfonA", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/159901852?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/Ubiquity", | ||
"html_url": "https://github.com/Ubiquity", | ||
"followers_url": "https://api.github.com/users/Ubiquity/followers", | ||
"following_url": "https://api.github.com/users/Ubiquity/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/Ubiquity/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/Ubiquity/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/Ubiquity/subscriptions", | ||
"organizations_url": "https://api.github.com/users/Ubiquity/orgs", | ||
"repos_url": "https://api.github.com/users/Ubiquity/repos", | ||
"events_url": "https://api.github.com/users/Ubiquity/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/Ubiquity/received_events", | ||
"type": "Organization", | ||
"site_admin": false | ||
}, | ||
"repository_selection": "selected", | ||
"access_tokens_url": "https://api.github.com/app/installations/47255717/access_tokens", | ||
"repositories_url": "https://api.github.com/installation/repositories", | ||
"html_url": "https://github.com/organizations/Ubiquity/settings/installations/47255717", | ||
"app_id": 827286, | ||
"app_slug": "ubi", | ||
"target_id": 159901852, | ||
"target_type": "Organization", | ||
"permissions": { | ||
|
||
}, | ||
"events": [ | ||
|
||
], | ||
"created_at": "2024-02-13T21:12:10.000+09:00", | ||
"updated_at": "2024-02-13T21:12:10.000+09:00", | ||
"single_file_name": null, | ||
"has_multiple_single_files": false, | ||
"single_file_paths": [ | ||
|
||
], | ||
"suspended_by": null, | ||
"suspended_at": null | ||
} | ||
] | ||
} |
Oops, something went wrong.