Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added complete oauth #160

Merged
merged 19 commits into from
Dec 5, 2023
Merged

added complete oauth #160

merged 19 commits into from
Dec 5, 2023

Conversation

Moneexa
Copy link
Collaborator

@Moneexa Moneexa commented Nov 19, 2023

No description provided.

@xJREB
Copy link
Collaborator

xJREB commented Nov 27, 2023

Thank you, @Moneexa ! I had a brief first look and this seems very promising and close to mergeable. A few things I noticed:

  • The README needs to be updated to reflect the changes with running the E2E tests locally and the backend setup
  • package.json and src/plugins/api.js still contain references to Pizzly. This PR should completely remove Pizzly from the project without losing any functionality. But maybe it's as simple as deleting the references by now?
  • package.json also contains the dependencies @auth0/auth0-spa-js and @octokit/rest in addition to firebase. Are these two really necessary, especially since most HTTP requests seem to be sent with axios?
  • Parts of the new code, e.g., ConnectToGitHubButton.vue, don't seem to follow the style conventions of the project (see .editorconfig and .prettierrc.json or best use IDE support to automatically format and fix the code according to the conventions). There also seems to be code that is commented out in some places. Best remove this if it is no longer required for testing.
  • In the E2E tests, I would extract the URL (https://api.github.com/graphql) to a variable in a single location, e.g., in cypress\support\e2e.js. The same is true for the API base path (https://api.github.com/) in api.js, but this one should probably be extracted to something like src\config.js.
  • Regarding the API requests in api.js, it looks like basically every request explicitly adds the Bearer token in the header. This is fairly brittle if we want to change this in the future. I would probably use a central request interceptor for this that adds the token for the right conditions (see, e.g., https://axios-http.com/docs/interceptors)
  • It looks like the test repo in the E2E tests has been changed. We specifically created https://github.com/adr/adr-test-repository-empty for this, so it would be best to keep this. I will give you access.

Copy link
Collaborator

@xJREB xJREB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I had another look and made more detailed comments on certain lines. In general, this has improved, but there is also still a lot of commented code and style guide violations (e.g., single quotes instead of double quotes, missing semicolons, etc.).


cy.intercept("GET", "**/user/repos**").as("getRepos");
// cy.intercept("GET", "**/user/repos**").as("getRepos");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out? If it is not needed, please delete it.

cy.get("[data-cy=addRepo]").click();
cy.wait("@getRepos").its("response.statusCode").should("eq", 200);
cy.get("[data-cy=listRepo]").contains("ADR-Manager").click();
cy.get("[data-cy=addRepoDialog]").click();
cy.intercept("GET", "**/repos**").as("showRepos");
// cy.intercept('POST', 'https://api.github.com/graphql').as("showRepos");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

@@ -30,7 +34,8 @@ context("Deleting an ADR from a repo", () => {
const addedRepos = JSON.parse(localStorage.getItem("addedRepositories"));
expect(addedRepos[0].adrs.length).to.eq(adrCount - 1);
expect(addedRepos[0].deletedAdrs.length).to.eq(1);
// });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

cy.visit(TEST_BASE_URL);

// add ADR Manager repo
cy.intercept("GET", "**/user/repos**").as("getRepos");
// cy.intercept("GET", "**/user/repos**").as("getRepos");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines 65 to 74
// cy.wait("@getCommitSha");
// cy.wait("@commitRequest")

// .then((val) => {
// cy.log(val.request);
// for (let item in val.request) {
// cy.log(item);
// }
// cy.log(val.request.body.author);
// });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this part? Was this only for debugging? If it is generally useful for this test, then it probably should not be commented out. If it is not needed, then delete it.

searchResults.push(repo);
}
});
console.log("#### search results ####", searchResults)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? Looks like temporary logging for debugging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file is just too excessively long with so much test data. I would reduce this, as it doesn't add much value after a certain length, but makes everything less maintainable and efficient.

@@ -7,18 +7,360 @@ global.localStorage = {
return "abc....";
}
};
console.log("###### print local storage #######", localStorage.getItem("authId"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?


test("Test Searching Repos with list in parameter. Searching for " + searchTerm, async () => {
console.log(localStorage.getItem("authId"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

"data": {
"user": {
"repositories": {
"nodes": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are probably also too many entries. I would reduce this as well to keep it manageable.

Copy link
Collaborator

@xJREB xJREB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: if host is changed to localhost instead of 127.0.0.1 in vite.config.js, we prevent the problem with the 401 if someone follows the displayed link from vite after starting the project.

package.json Outdated
@@ -17,6 +17,7 @@
"antlr4": "^4.13.0",
"axios": "^1.4.0",
"core-js": "^3.31.1",
"firebase": "^10.7.0",
"marked": "^5.1.1",
"pizzly-js": "^0.2.8",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't Pizzly be gone by now?

@xJREB xJREB merged commit 2717d3d into main Dec 5, 2023
2 checks passed
@xJREB xJREB deleted the Issue-#156 branch December 5, 2023 10:40
@xJREB xJREB mentioned this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants