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: updated communityIssues spec by replacing 3rd party APIs #36599

Open
wants to merge 10 commits into
base: release
Choose a base branch
from

Conversation

NandanAnantharamu
Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu commented Sep 29, 2024

updated test steps in community spec and common method.
/ok-to-test tags="@tag.All"

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11209285609
Commit: 44b3782
Cypress dashboard.
Tags: @tag.All
Spec:


Mon, 07 Oct 2024 06:41:42 UTC

Summary by CodeRabbit

  • Bug Fixes

    • Adjusted test logic in the Community Issues page to enhance validation steps and ensure accurate processing of table rows.
    • Updated the CloseFilter method to improve functionality when closing filters.
  • New Features

    • Modified the limited tests to run CommunityIssues_Spec.ts, changing the scope of tests executed.
  • Documentation

    • Updated comments in test specifications to reflect recent changes and clarify execution flow.

Copy link
Contributor

coderabbitai bot commented Sep 29, 2024

Walkthrough

The pull request introduces several modifications primarily focused on the test specifications within the CommunityIssues_Spec.ts file. Key changes include updates to assertions, alterations in iteration counts for loops, and adjustments to input URLs. Additionally, the limited-tests.txt file has been updated to reflect the new test file, while the CloseFilter method in the Table class has been modified to include additional parameters in its function call.

Changes

File Path Change Summary
app/client/cypress/e2e/Regression/Apps/CommunityIssues_Spec.ts Adjusted assertions, modified loop iterations, changed input URL, commented out certain checks, and added issue deletion handling.
app/client/cypress/limited-tests.txt Updated test specification from Fork_Template_spec.js to CommunityIssues_Spec.ts.
app/client/cypress/support/Pages/Table.ts Modified CloseFilter method to include additional parameters in the GetNClick function call.

Possibly related PRs

Suggested labels

Bug, Task, ok-to-test

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007
  • brayn003

🌟 In the land of code where tests do play,
Assertions and loops dance in a new way.
A filter now closes with parameters neat,
Community Issues, you’re now quite the feat!
So let’s run those tests, let’s see what they say,
With changes in place, we’re ready today! 🌟


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>, 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.

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Test labels Sep 29, 2024
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: 5

🧹 Outside diff range and nitpick comments (1)
app/client/cypress/support/Pages/Table.ts (1)

531-531: Well done on updating the CloseFilter method, but let's add some clarity!

The change looks good, class! You've updated the GetNClick method call with additional parameters, which should improve its functionality. However, to help your fellow students understand the reasoning behind this change, could you please add a comment explaining why these parameters were necessary? Remember, clear communication is key in coding!

Consider adding a comment above this line to explain the purpose of the 0 and true parameters. For example:

+// Added index and force parameters to ensure reliable clicking of the filter close button
 this.agHelper.GetNClick(this._filterCloseBtn, 0, true);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5995e42 and 730a134.

📒 Files selected for processing (3)
  • app/client/cypress/e2e/Regression/Apps/CommunityIssues_Spec.ts (7 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/support/Pages/Table.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
app/client/cypress/e2e/Regression/Apps/CommunityIssues_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.
app/client/cypress/support/Pages/Table.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 (4)
app/client/cypress/limited-tests.txt (1)

2-2: Well done, class! This change looks good.

I'm pleased to see you've updated the test specification from 'Fork_Template_spec.js' to 'CommunityIssues_Spec.ts'. This aligns perfectly with our lesson plan of updating the community specification test steps.

Remember, children, while we're focusing on this particular test today, it's crucial not to forget about our other tests. They're like the other subjects in our curriculum - all important for a well-rounded education!

app/client/cypress/e2e/Regression/Apps/CommunityIssues_Spec.ts (3)

Line range hint 260-271: Let's discuss the changes in our loop iterations, shall we?

I've noticed that we've adjusted the number of times we're checking our data:

  1. On line 260, we've changed from 5 to 4 iterations.
  2. On line 271, we've changed from 7 to 6 iterations.

Can someone explain to the class why we made these changes? Remember, when we change our experiment parameters, we need to understand and document the reasons. This helps us learn and ensures our tests remain thorough and accurate.

Could you please add a comment explaining the reasoning behind these changes? For example:

// Reduced iterations to 4 because [your reason here]
for (let i = 0; i < 4; i++) {
  // ...
}

// Reduced iterations to 6 because [your reason here]
for (let i = 0; i < 6; i++) {
  // ...
}

This way, future students (I mean, developers) will understand our scientific method!


393-397: Class, let's examine our data collection method!

I've noticed we've changed which row we're looking at in our table. We used to look at row 0, but now we're checking row 1:

table.ReadTableRowColumnData(1, 0, "v2", 2000).then((cellData) => {
  // ...
});

table.ReadTableRowColumnData(1, 1, "v2").then((cellData) => {
  // ...
});

Can someone explain to the class why we've shifted our focus? When we change which data we're examining, we need to understand and document the reasons.

Let's add a comment to explain this change. For example:

// Changed to row 1 because [your reason here]
table.ReadTableRowColumnData(1, 0, "v2", 2000).then((cellData) => {
  // ...
});

Remember, good scientists always explain their methodology!


Line range hint 1-430: Class, let's summarize our lesson on writing good tests!

Today, we've examined several changes to our Community Issues test suite. While we've made some excellent additions, like testing the deletion of issues, we've also found areas where we can improve:

  1. Remember to break down long assertions into smaller, more manageable parts.
  2. Always deploy our app consistently in each test to ensure reliable results.
  3. Document the reasons for changing test parameters, like loop iterations or row indices.
  4. Use environment variables for configurable values like URLs to make our tests more portable.
  5. Be careful about commenting out assertions - if they're not needed, remove them; if they are, keep them active.

For homework, I'd like everyone to review their changes and apply these principles. Remember, clear, consistent, and well-documented tests are the foundation of good software development!

Keep up the good work, and don't forget to raise your hand (or open a discussion) if you have any questions!

Comment on lines 91 to 92
// "TypeTitleStatus+1CommentorsVotesAnswerUpVote",
"TypeTitleStatus+1CommentorsVotesAnswerUpVoteStatesupvote_ididgithub_issue_idauthorcreated_atdescriptionlabelsstatelinkupdated_at",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Class, let's break down this long assertion into smaller parts!

Children, while it's commendable that you've updated the assertion to include all columns, we need to make our code more readable. Remember our lesson on keeping things simple?

Let's break this long string into multiple assertions:

table.AssertTableHeaderOrder("Type");
table.AssertTableHeaderOrder("Title");
table.AssertTableHeaderOrder("Status");
// ... and so on for each column

This way, if a test fails, we'll know exactly which column is causing the issue. It's like solving a big math problem step by step!

@@ -226,7 +227,7 @@
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget);
propPane.TogglePropertyState("Client side search", "Off");

deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
// deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Oh dear, why have we skipped a step in our experiment?

Class, I noticed that we've commented out the app deployment step. This is like trying to bake a cake without preheating the oven! We need to ensure our test environment is consistent for every experiment.

Let's uncomment this line:

deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));

Remember, in science (and in testing), we need to follow all the steps in our procedure to get accurate results!

@@ -309,7 +310,7 @@
.type("Adding Description Suggestion via script");
cy.get(locators._inputWidgetv1InDeployed)
.eq(4)
.type("https://github.com/appsmithorg/appsmith/issues/12532");
.type("http://host.docker.internal:5001");
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Attention class! We need to discuss our choice of URL.

I see we've changed our URL to http://host.docker.internal:5001. While this might work on our local machines, it's like assuming everyone has the same textbook as you. What happens when someone tries to run this test on a different computer?

Let's make our experiment more adaptable. We could use an environment variable or a configuration file to set this URL. For example:

.type(Cypress.env('TEST_URL') || 'http://localhost:5001');

This way, we can easily change the URL for different environments without modifying our test code. It's like having a variable in our equation that we can easily adjust!

Remember, good scientists make their experiments reproducible in any lab!

Comment on lines 343 to 345
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
table.SelectTableRow(0, 1, true, "v2");
agHelper.AssertElementVisibility(
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Let's talk about our observation skills, class!

I've noticed that we've put on blinders for some of our checks:

// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));

And then we're immediately checking if it's visible:

agHelper.AssertElementVisibility(
  locators._widgetInDeployed("tabswidget"),
);

This is like closing our eyes and then trying to see if something is there! We need to decide what we're actually testing for.

If the first assertion is no longer needed, let's remove it entirely. If it's still important, we should uncomment it. Remember, in science, every observation is important!

Let's clean this up to make our experiment clear and concise. What are we really trying to test here?

Comment on lines 405 to 415
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
agHelper.GetNClick(".cross-icon");
table.SearchTable("Suggestion");
table.WaitUntilTableLoad(0, 0, "v2");
table.SelectTableRow(0, 0, true, "v2");
agHelper.AssertElementVisibility(
locators._widgetInDeployed("tabswidget"),
);
cy.get(table._trashIcon).closest("div").click({ force: true });
agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
// agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Excellent addition to our experiment, class! But let's tidy up a bit.

I'm thrilled to see we've added steps to test deleting a newly created issue. This is like checking if we can erase what we've written - very important!

However, I've noticed we've left some of our checkpoints commented out:

// agHelper.WaitUntilEleDisappear(locators._widgetInDeployed("tabswidget"));
// agHelper.AssertElementAbsence(locators._widgetInDeployed("tabswidget"));

Remember, in science, we need to be thorough with our observations. If these checks are no longer needed, let's remove them entirely. If they're still important, we should uncomment them.

Let's decide which observations are crucial for our experiment and keep our lab notebook (code) clean and clear. What do you think, class? Which checks do we need to keep?

Copy link

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

***** Repeat Run Summary ***** Total Tests with repeat: 250 Total Passed: 126 Total Failed: 124 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

Copy link

Copy link

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

***** Repeat Run Summary ***** Total Tests with repeat: 250 Total Passed: 126 Total Failed: 124 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Oct 3, 2024

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Oct 3, 2024

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Oct 3, 2024

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit

Copy link

github-actions bot commented Oct 4, 2024

Copy link

github-actions bot commented Oct 4, 2024

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

@NandanAnantharamu NandanAnantharamu added the ok-to-test Required label for CI label Oct 4, 2024
@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Oct 4, 2024

Copy link

github-actions bot commented Oct 4, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11179028326.
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: 250 Total Passed: 125 Total Failed: 0 Total Skipped: 0 *****************************

@NandanAnantharamu
Copy link
Collaborator Author

/ci-test-limit-count run_count=25

Copy link

github-actions bot commented Oct 7, 2024

Copy link

github-actions bot commented Oct 7, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11209296033.
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: 250 Total Passed: 125 Total Failed: 0 Total Skipped: 0 *****************************

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.

1 participant