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

test: replace LogintoApp with LoginFromAPI #34040

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Jun 6, 2024

This replaces LogintoApp with LoginFromAPI

/ok-to-test tags="@tag.All"

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/4440

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced login functionality in multiple test scripts by shifting from user-based login to API-based login.
  • Chores

    • Updated the spec names in the limited Cypress tests to align with new test locations and names.
    • Added new logout API call in the LoginFromAPI custom command to improve test reliability.

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9517666274
Commit: a42a585
Cypress dashboard url: Click here!

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Jun 6, 2024
Copy link
Contributor

coderabbitai bot commented Jun 6, 2024

Walkthrough

This update primarily involves renaming a Cypress command from LogintoApp to LoginFromAPI across various test files. This shift standardizes the login process to use an API-based approach. Additionally, adjustments were made to remove or streamline parameters in affected functions, enhancing login handling across different test scenarios.

Changes

Files/Path(s) Change Summary
.../Fork/ForkApplicationInDeployedMode_spec.ts, ...ForkApplication_spec.ts Renamed cy.LogintoApp to cy.LoginFromAPI
.../OtherUIFeatures/ExportApplication_spec.js Renamed LogintoApp to LoginFromAPI for multiple user access tests
.../ProductRamps/PrivateEmbedRamp_spec.ts Replaced _.homePage.LogintoApp with cy.LoginFromAPI in private embed tests
.../Regression/ClientSide/Workspace/DeleteWorkspace_spec.ts, .../Workspace/LeaveWorkspaceTest_spec.js Replaced homePage.LogintoApp with cy.LoginFromAPI and removed "App Viewer" parameter
.../Workspace/MemberRoles_Spec.ts Replaced calls to _.homePage.LogintoApp with cy.LoginFromAPI for various user roles
.../Workspace/ShareAppTests_Spec.ts Replaced homePage.LogintoApp with cy.LoginFromAPI and removed "App Viewer" parameter
.../Github/EnableGithub_spec.ts Renamed homePage.LogintoApp to cy.LoginFromAPI for Github settings tests
.../ServerSide/LoginTests/LoginFailure_spec.js Changed cy.LoginUser to cy.LoginFromAPI
app/client/cypress/limited-tests.txt Updated spec names for limited tests in the Cypress test suite
app/client/cypress/support/commands.js Added call to homePageTS.LogOutviaAPI() within LoginFromAPI custom command

Sequence Diagram(s)

Old Flow vs New Flow

Old Flow: Using LogintoApp

sequenceDiagram
    participant Test as Test File
    participant Cypress as Cypress
    participant GUI as UI
    Test->>Cypress: cy.LogintoApp(username, password, role)
    Cypress->>GUI: Interact with UI for login
    GUI->>Cypress: Return response
    Cypress->>Test: Proceed with test
Loading

New Flow: Using LoginFromAPI

sequenceDiagram
    participant Test as Test File
    participant Cypress as Cypress
    participant API as API
    Test->>Cypress: cy.LoginFromAPI(username, password)
    Cypress->>API: Call login API
    API->>Cypress: Return response
    Cypress->>Test: Proceed with test
Loading

Poem

In lines of code, we make the change,
With LoginFromAPI, our tests arrange.
No more GUI, just swift API flair,
Through each command, refinements we share.
Cypress and API, hand in hand,
Ensuring our app tests ever grand.
⏩🔄 на ценный вклад!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (4)
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationInDeployedMode_spec.ts (1)

Line range hint 12-37: Consider refactoring function expressions to arrow functions for consistency and improved readability.

- function () {
+ () => {
app/client/cypress/e2e/Regression/ClientSide/Workspace/LeaveWorkspaceTest_spec.js (1)

Line range hint 13-51: Consider refactoring function expressions to arrow functions for consistency and improved readability.

- function () {
+ () => {
app/client/cypress/e2e/Regression/ClientSide/Workspace/DeleteWorkspace_spec.ts (1)

Line range hint 14-55: Consider refactoring function expressions to arrow functions for consistency and improved readability.

- function () {
+ () => {
app/client/cypress/e2e/Regression/ClientSide/ProductRamps/PrivateEmbedRamp_spec.ts (1)

Line range hint 1-100: Consider refactoring function expressions to arrow functions for consistency and improved readability.

- function () {
+ () => {
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1e8a962 and c90ba5f.

Files selected for processing (8)
  • app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationInDeployedMode_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (3 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js (5 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/ProductRamps/PrivateEmbedRamp_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/DeleteWorkspace_spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/LeaveWorkspaceTest_spec.js (1 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/MemberRoles_Spec.ts (9 hunks)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (5 hunks)
Additional context used
Learnings (1)
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (1)
User: dipyamanbiswas07
PR: appsmithorg/appsmith#29282
File: app/client/cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js:11-17
Timestamp: 2024-01-09T08:39:59.723Z
Learning: The user has clarified that intercepts are called in end-to-end tests, and therefore resetting the feature flag in an `afterEach` hook is not required in their test setup.
Biome
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationInDeployedMode_spec.ts

[error] 13-36: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 12-37: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Workspace/LeaveWorkspaceTest_spec.js

[error] 16-31: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 33-50: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 13-51: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Workspace/DeleteWorkspace_spec.ts

[error] 17-27: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 29-54: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 14-55: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js

[error] 19-52: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 54-90: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 92-120: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 12-121: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts

[error] 20-37: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 39-60: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 62-76: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 78-89: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 91-104: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 106-119: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 121-132: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 17-133: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts

[error] 62-95: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 114-114: Unsafe usage of optional chaining. (lint/correctness/noUnsafeOptionalChaining)

If it short-circuits with 'undefined' the evaluation will throw TypeError here:


[error] 97-147: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 30-148: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Workspace/MemberRoles_Spec.ts

[error] 48-68: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 70-80: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 82-111: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 113-123: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 125-164: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 178-183: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 166-186: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

Additional comments not posted (25)
app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationInDeployedMode_spec.ts (1)

23-23: Change from LogintoApp to LoginFromAPI aligns with PR objectives.

app/client/cypress/e2e/Regression/ClientSide/Workspace/LeaveWorkspaceTest_spec.js (1)

43-43: Change from LogintoApp to LoginFromAPI aligns with PR objectives.

app/client/cypress/e2e/Regression/ClientSide/Workspace/DeleteWorkspace_spec.ts (1)

43-43: Change from LogintoApp to LoginFromAPI aligns with PR objectives.

app/client/cypress/e2e/Regression/ClientSide/ProductRamps/PrivateEmbedRamp_spec.ts (1)

96-96: Change from LogintoApp to LoginFromAPI aligns with PR objectives.

app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ExportApplication_spec.js (4)

34-34: LGTM! The replacement of cy.LogintoApp with cy.LoginFromAPI aligns with the PR objectives.


55-55: LGTM! Consistent replacement of the login function as per the PR objectives.


71-71: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.


93-93: LGTM! The consistent use of cy.LoginFromAPI across different user roles is noted and aligns with the PR objectives.

app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (5)

40-40: LGTM! The replacement of cy.LogintoApp with cy.LoginFromAPI is consistent with the PR objectives.


63-63: LGTM! Consistent replacement of the login function as per the PR objectives.


92-92: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.


107-107: LGTM! The consistent use of cy.LoginFromAPI across different user roles is noted and aligns with the PR objectives.


122-122: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.

app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts (3)

32-32: LGTM! The replacement of cy.LogintoApp with cy.LoginFromAPI is consistent with the PR objectives.


53-53: LGTM! Consistent replacement of the login function as per the PR objectives.


63-63: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.

app/client/cypress/e2e/Regression/ClientSide/Workspace/MemberRoles_Spec.ts (9)

33-33: LGTM! The replacement of cy.LogintoApp with cy.LoginFromAPI is consistent with the PR objectives.


49-49: LGTM! Consistent replacement of the login function as per the PR objectives.


71-71: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.


83-83: LGTM! The consistent use of cy.LoginFromAPI across different user roles is noted and aligns with the PR objectives.


114-114: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.


126-126: LGTM! The consistent use of cy.LoginFromAPI across different user roles is noted and aligns with the PR objectives.


167-167: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.


189-189: LGTM! The consistent use of cy.LoginFromAPI across different user roles is noted and aligns with the PR objectives.


199-199: LGTM! The function cy.LoginFromAPI is used correctly, maintaining consistency across the test suite.

@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (2)
app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js (1)

Line range hint 9-45: Consider converting function expressions to arrow functions for better readability and to adhere to modern JavaScript practices.

- describe("Login failure", function () {
+ describe("Login failure", () => {

Also applies to: 8-46

app/client/cypress/e2e/Regression/ClientSide/Github/EnableGithub_spec.ts (1)

Line range hint 14-34: Consider converting function expressions to arrow functions for better readability and to adhere to modern JavaScript practices.

- describe("SSO with Github test functionality", function () {
+ describe("SSO with Github test functionality", () => {

Also applies to: 36-71, 73-117, 13-118

Tools
Biome

[error] 13-118: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c90ba5f and 7aa97f1.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Github/EnableGithub_spec.ts (3 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js (2 hunks)
Additional context used
Biome
app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js

[error] 40-40: The comma operator is disallowed. (lint/style/noCommaOperator)

Its use is often confusing and obscures side effects.


[error] 9-45: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 8-46: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

app/client/cypress/e2e/Regression/ClientSide/Github/EnableGithub_spec.ts

[error] 14-34: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 36-71: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 73-117: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 13-118: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.

Additional comments not posted (2)
app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js (1)

27-27: Replace cy.LoginUser with cy.LoginFromAPI aligns with the PR's objectives and improves the login mechanism by using API-based authentication.

Also applies to: 39-39

app/client/cypress/e2e/Regression/ClientSide/Github/EnableGithub_spec.ts (1)

16-16: Replace homePage.LogintoApp with cy.LoginFromAPI aligns with the PR's objectives and improves the login mechanism by using API-based authentication.

Also applies to: 38-38, 74-74

@@ -36,7 +36,7 @@ describe("Login failure", function () {
true,
),
);
cy.LoginUser(Cypress.env("USERNAME"), Cypress.env("PASSWORD"), false);
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the comma operator to avoid potential confusion and obscure side effects.

-    }),
+    });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
}),
});
Tools
Biome

[error] 40-40: The comma operator is disallowed. (lint/style/noCommaOperator)

Its use is often confusing and obscures side effects.

@NandanAnantharamu NandanAnantharamu removed the request for review from ApekshaBhosale June 11, 2024 05:59
@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 11, 2024
@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 11, 2024
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7aa97f1 and a781146.

Files selected for processing (1)
  • app/client/cypress/limited-tests.txt (1 hunks)
Additional context used
LanguageTool
app/client/cypress/limited-tests.txt

[uncategorized] ~1-~1: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ... limited tests - give the spec names in below format: cypress/e2e/Regression/ClientSi...


[uncategorized] ~14-~14: Possible missing article found. (AI_HYDRA_LEO_MISSING_THE)
Context: ...ile to run minimum of specs. Do not run entire suite with this command.

Additional comments not posted (1)
app/client/cypress/limited-tests.txt (1)

2-9: The updated test spec paths are consistent with the changes described in the PR. Ensure these paths are correctly referenced in the test configurations.

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478636149.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

6 similar comments
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit runId=9478636149

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478978748.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478974898.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478976529.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478979849.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478984186.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478979192.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478971691.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478978025.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478976737.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478977161.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478976881.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478975272.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9478979476.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a781146 and 9f444e2.

Files selected for processing (1)
  • app/client/cypress/support/commands.js (1 hunks)
Additional context used
Biome
app/client/cypress/support/commands.js

[error] 145-149: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 1088-1116: This function expression can be turned into an arrow function. (lint/complexity/useArrowFunction)

Function expressions that don't use this can be turned into arrow functions.
Safe fix: Use an arrow function instead.


[error] 1430-1430: This default parameter should follow the last required parameter or should be a required parameter. (lint/style/useDefaultParameterLast)

The last required parameter is here:

A default parameter that precedes a required parameter cannot be omitted at call site.
Unsafe fix: Turn the parameter into a required parameter.

Additional comments not posted (1)
app/client/cypress/support/commands.js (1)

186-186: Verify the necessity of clearing cookies before login.

This will help ensure that the approach to handling cookies is consistent across different authentication methods in the test suite.

Verification successful

The output indicates that cy.clearCookie("SESSION") is used to clear cookies to avoid stale cookies on Cypress CI, specifically before making a POST request to the login API. This suggests that clearing the SESSION cookie is necessary to ensure a clean state before logging in.

  • app/client/cypress/support/commands.js:191: cy.clearCookie("SESSION"); is used right after logging out via API and before visiting the login endpoint.

This aligns with the necessity of clearing cookies to prevent stale sessions from interfering with the login process.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check if other authentication methods also clear cookies.

# Test: Search for cookie clearing in other authentication methods. Expect: Consistent usage across methods.
rg --type js 'cy.clearCookie'

Length of output: 97



Script:

#!/bin/bash
# Description: Check where cy.clearCookie("SESSION") is used in the context of authentication.

# Search for cy.clearCookie("SESSION") in the context of login or authentication methods.
rg --type js 'cy.clearCookie\("SESSION"\)' -A 5 -B 5

Length of output: 782

@@ -183,6 +183,7 @@ Cypress.Commands.add("LogintoApp", (uname, pword) => {
});

Cypress.Commands.add("LoginFromAPI", (uname, pword) => {
homePageTS.LogOutviaAPI();
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for the logout operation.

Consider adding error handling around homePageTS.LogOutviaAPI() to manage cases where the logout fails, which could impact the subsequent login process.


Refactor to improve logout reliability before login.

- homePageTS.LogOutviaAPI();
+ if (CURRENT_REPO === REPO.EE) {
+   homePageTS.LogOutviaAPI();
+ }

This change ensures that the logout via API is only called in the Enterprise Edition, which might have specific requirements or configurations that differ from the Community Edition.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
homePageTS.LogOutviaAPI();
if (CURRENT_REPO === REPO.EE) {
homePageTS.LogOutviaAPI();
}

Consider improving the login check logic for better reliability.

- cy.location().should((loc) => {
-   expect(loc.href).to.eq(loc.origin + "/applications");
- });
+ cy.location('pathname').should('eq', '/applications');

This change uses Cypress's built-in command for pathname comparison, which is less error-prone and more readable.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
homePageTS.LogOutviaAPI();
homePageTS.LogOutviaAPI();
cy.location('pathname').should('eq', '/applications');

@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 13, 2024
@NandanAnantharamu NandanAnantharamu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 13, 2024
@ApekshaBhosale ApekshaBhosale added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 14, 2024
@NandanAnantharamu NandanAnantharamu merged commit 1007c23 into release Jun 14, 2024
83 checks passed
@NandanAnantharamu NandanAnantharamu deleted the test/replaceLogintoApp branch June 14, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants