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

fix: Fix shareapp case due to load issue #36627

Merged
merged 7 commits into from
Oct 4, 2024
Merged

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Oct 1, 2024

Description

Fixes #36626

Issue: Script was clicking on share button without full page load.
Solution: Waited for page load with api.

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

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11174778224
Commit: 80be7e1
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Fri, 04 Oct 2024 07:01:59 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced test coverage for workspace sharing and public access functionalities.
    • Added assertions to validate visibility of the Git sync bottom bar during application editing.
  • Bug Fixes

    • Updated specification for limited tests to point to the correct test file, ensuring accurate execution of tests.

Copy link
Contributor

coderabbitai bot commented Oct 1, 2024

Walkthrough

The pull request introduces changes primarily to the ShareAppTests_Spec.ts file, enhancing the test suite for workspace sharing and public access functionalities. It adds an import for gitSyncLocators and incorporates assertions to validate the visibility of the Git sync bottom bar and user access rights. Additionally, the limited-tests.txt file is updated to reflect the new testing focus on ShareAppTests_Spec.ts, replacing a previous specification.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts Added import for gitSyncLocators, enhanced assertions for workspace sharing, public access, and visibility of Git sync bottom bar during editing.
app/client/cypress/limited-tests.txt Updated specification for limited tests from Fork_Template_spec.js to ShareAppTests_Spec.ts, clarifying the use of the file for running limited tests.

Assessment against linked issues

Objective Addressed Explanation
Fix share app test case flaky (Task #36626)

Possibly related PRs

Suggested labels

Task, Query & JS Pod, Integrations Product, Integrations Pod General, Stability Pod, Needs Triaging, High

Suggested reviewers

  • ApekshaBhosale
  • brayn003

In the land of code where tests do play,
New assertions shine bright, lighting the way.
With Git sync now clear, and access in sight,
Sharing workspaces feels oh-so-right!
So let’s cheer for the changes, both bold and true,
For stability and testing, we’ll always pursue! 🎉


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 565dc30 and 80be7e1.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts

🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@github-actions github-actions bot added the Bug Something isn't working label Oct 1, 2024
@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Oct 1, 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: 0

🧹 Outside diff range and nitpick comments (1)
app/client/cypress/limited-tests.txt (1)

Line range hint 1-7: Class, let's discuss the importance of this configuration file.

Students, this file plays a crucial role in our testing strategy. It allows us to run a subset of tests, which is particularly useful for quick checks and our CI/CD pipeline. Remember, as good developers, we should:

  1. Use this file responsibly, running only the necessary tests for each scenario.
  2. Keep the comments up-to-date to guide future developers.
  3. Be cautious when modifying this file, as it directly impacts our continuous integration process.

As we progress in our development journey, we might want to consider automating the process of updating this file based on recent changes or test priorities. This could enhance our testing efficiency and ensure we're always testing the most critical parts of our application.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bb11bf5 and 635002e.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (2 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/limited-tests.txt (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (3)
app/client/cypress/limited-tests.txt (1)

2-2: Class, let's examine this change closely.

Now, students, we've updated our test specification from a JavaScript file to a TypeScript file. This is a positive step towards more robust type checking in our tests. However, we must ensure that all developers are aware of this transition.

Let's verify if this change is consistent across our testing suite:

Class, this script will help us understand if this change is part of a larger migration or an isolated update.

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

12-12: Excellent work on importing the gitSyncLocators module!

By importing gitSyncLocators, you're promoting code reusability and maintainability. This approach centralizes your locators, making it easier to manage and update them across your tests.


117-117: Let's ensure we're using data- attributes for selectors*

In your assertion agHelper.AssertElementVisibility(gitSyncLocators.connectGitBottomBar);, it's important to verify that the locator connectGitBottomBar utilizes data-* attributes. Following this practice enhances the stability and reliability of your tests.

To confirm that connectGitBottomBar uses a data-* attribute, let's run the following script:

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11121106106.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 175 Total Passed: 175 Total Failed: 0 Total Skipped: 0 *****************************

@brayn003
Copy link
Contributor

brayn003 commented Oct 2, 2024

Don't think it is a good idea to use a git element in a test that is not related to git. Probably use other indicators like canvas element appearing or consolidated-api returning 200

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Oct 3, 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: 0

🧹 Outside diff range and nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (2)

117-117: Excellent addition to our test suite!

I'm pleased to see you've added an assertion to check the network status. This is a great way to ensure our application is behaving correctly. However, let's make it even better. Instead of using a hard-coded status code, we could use a constant. This would make our test more maintainable. Here's how we could improve it:

const HTTP_OK_STATUS = 200;
assertHelper.AssertNetworkStatus("@getConsolidatedData", HTTP_OK_STATUS, true);

This way, if we ever need to change the expected status code, we only need to update it in one place. What do you think about this suggestion?


Line range hint 1-150: Let's review our test practices, class.

While our test suite is well-structured, there are a few areas where we can improve to align better with our coding guidelines:

  1. I noticed we're using cy.wait in several places. Remember, we want to avoid using cy.wait as it can make our tests flaky. Instead, let's use Cypress's built-in retry-ability and wait for specific elements or network requests to resolve.

  2. We're using string selectors directly in some places. It's better to use locator variables for our selectors. This makes our tests more maintainable and easier to update if our UI changes.

  3. Great job on using assertHelper.AssertNetworkStatus! This is a good practice for checking network responses.

  4. I don't see any use of cy.pause, agHelper.sleep(), or it.only, which is excellent!

  5. We're correctly using LoginFromAPI and LogOutviaAPI, which aligns with our guidelines.

Here's an example of how we could improve one of our selectors:

// Instead of this:
agHelper.GetNClick(homePage._sharePublicToggle, 0, true);

// We could define a locator variable:
const sharePublicToggle = '[data-cy="share-public-toggle"]';
agHelper.GetNClick(sharePublicToggle, 0, true);

Let's work on refactoring our selectors and removing cy.wait calls. This will make our tests more robust and easier to maintain. What do you think about these suggestions?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 635002e and 565dc30.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (1)
app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts (1)

12-12: Class, let's discuss the new import statement.

I see you've added a new import for gitSyncLocators. While it's good to keep our imports organized, I don't see where these locators are being used in our test suite. Remember, it's important to only import what we need. Can you show me where you're using these locators, or if they're not being used, could you explain why we're importing them?

Let's run a quick check to see if these locators are being used:

✅ Verification successful

Great observation!

I've checked the usage of gitSyncLocators in ShareAppTests_Spec.ts and found that it's imported but not utilized anywhere in the file. It's a good practice to remove any unused imports to keep the codebase clean and maintainable.

  • File: app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts
  • Line: 12
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of gitSyncLocators in the file
rg 'gitSyncLocators' app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts

Length of output: 165

Copy link

github-actions bot commented Oct 3, 2024

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

***** Repeat Run Summary ***** Total Tests with repeat: 175 Total Passed: 174 Total Failed: 1 Total Skipped: 0 *****************************

@sagar-qa007 sagar-qa007 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Oct 3, 2024
@sagar-qa007
Copy link
Contributor Author

sagar-qa007 commented Oct 3, 2024

@brayn003 Please check and approve now. Have updated the code. Seems like application page got blank in one instance. Kindly ignore that failure.

Screenshot 2024-10-03 at 9 47 48 PM

@sagar-qa007 sagar-qa007 removed the ok-to-test Required label for CI label Oct 3, 2024
@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=25 runId=11162710118

Copy link

github-actions bot commented Oct 3, 2024

Copy link

github-actions bot commented Oct 3, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11166070561.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 175 Total Passed: 175 Total Failed: 0 Total Skipped: 0 *****************************

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Oct 4, 2024
@sagar-qa007 sagar-qa007 removed the ok-to-test Required label for CI label Oct 4, 2024
@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Oct 4, 2024
Copy link
Contributor

@brayn003 brayn003 left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants