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

feat: remove generate new page button from datasource preview pages #38182

Closed
wants to merge 35 commits into from

Conversation

jacquesikot
Copy link
Contributor

@jacquesikot jacquesikot commented Dec 16, 2024

Description

Problem
The generate new page button was previously hidden only when the drag_drop_building_blocks feature flag is turned off. This was the expected behaviour when trying to launch building blocks earlier. Now, building blocks are not been used on the platform and we still want to hide the generate new page button.

Solution
Instead of removing the whole generate a pge functionality, or adding another redundant feature flag, we have decided to remove all instance of the generate new page button in the datasource preview pages. The generate page functionality remains untouched.

Fixes #38178

Automation

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

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12747890502
Commit: 9e4cfaf
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/Github/EnableGithub_spec.ts
  2. cypress/e2e/Regression/ClientSide/PropertyPane/PropertyPane_Search_spec.ts
  3. cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
List of identified flaky tests.
Mon, 13 Jan 2025 14:25:30 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Simplified header actions in the Data Source Editor, improving button visibility based on user permissions.
  • Bug Fixes

    • Removed unnecessary complexity related to permissions and feature flags in multiple components, enhancing user experience.
    • Eliminated redundant test cases in the CRUD operation validation, streamlining the testing process.
  • Refactor

    • Streamlined the DatasourceViewModeSchema and GoogleSheetSchema components by removing obsolete imports and functions, focusing on core functionalities.
    • Consolidated test cases in various CRUD test suites for improved clarity and efficiency.
    • Adjusted test suites for MongoDB and PostgreSQL to remove redundant tests and simplify the testing strategy.
    • Reduced the number of tests and assertions in the S3 CRUD operations, focusing on core functionalities.
    • Removed unit tests for the "generate page" button, ensuring better alignment with current feature flags.

@jacquesikot jacquesikot self-assigned this Dec 16, 2024
@jacquesikot jacquesikot added the ok-to-test Required label for CI label Dec 16, 2024
Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Walkthrough

The pull request focuses on removing the generate page button functionality from various components in the datasource preview page. The changes simplify the codebase by eliminating feature flag dependencies and removing conditional rendering logic related to page generation. The modifications span multiple files in the client-side application, primarily targeting the datasource editor and information components.

Changes

File Change Summary
app/client/src/ce/hooks/datasourceEditorHooks.tsx Removed releaseDragDropBuildingBlocks feature flag check, simplified shouldShowSecondaryGenerateButton logic.
app/client/src/pages/Editor/DataSourceEditor/DSFormHeader.tsx Removed conditional rendering of generatePageButton from header actions.
app/client/src/pages/Editor/DatasourceInfo/DatasourceViewModeSchema.tsx Eliminated permission and feature flag-related imports and logic for generate page functionality.
app/client/src/pages/Editor/DatasourceInfo/GoogleSheetSchema.tsx Removed onGsheetGeneratePage function and associated button rendering logic.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Mongo_Spec.ts Removed test case for generating CRUD page from ACTIVE section.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts Removed test cases for generating CRUD page from ACTIVE datasource and verifying new table CRUD.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts Removed multiple test cases related to CRUD operations on "Stores" table.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts Removed test case for generating CRUD page from ACTIVE section and renamed another.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts Removed several test cases and imports, simplifying the test suite.
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js Removed test cases for generating CRUD pages and updated signatures of existing tests.
app/client/cypress/e2e/Regression/ServerSide/QueryPane/Mongo1_spec.ts Removed tests related to generating CRUD operations and updated remaining tests.
app/client/cypress/e2e/Regression/ServerSide/QueryPane/QueryPane_Postgres_Spec.js Updated imports and commented out tests related to UI interactions.
app/client/cypress/e2e/Regression/ServerSide/QueryPane/Querypane_Mongo_Spec.js Removed multiple tests and reordered existing tests.
app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_1_spec.js Removed test case for creating a new text file in the S3 bucket.
app/client/cypress/e2e/Regression/ServerSide/QueryPane/S3_2_spec.ts Removed multiple test cases related to file operations and simplified assertions.
app/client/src/pages/Editor/DatasourceInfo/HideGeneratePageButton.test.tsx Deleted unit tests for components related to the generate page button.

Assessment against linked issues

Objective Addressed Explanation
Remove release_drag_drop_building_blocks_enabled dependency
Hide generate new page button
Update test cases All relevant test cases have been updated or removed as necessary.

Suggested labels

IDE Product, IDE Pod, Datasources

Suggested reviewers

  • ApekshaBhosale
  • sagar-qa007

Poem

Code flows like water, clean and bright
Generate buttons fade from sight
Simplicity wins the coding fight
Datasources dance in pure delight
🚀 Refactoring takes its flight! 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc4bac6 and c13934c.

📒 Files selected for processing (7)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Mongo_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js (0 hunks)
💤 Files with no reviewable changes (7)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Mongo_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MongoURI_Spec.ts
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check

Finishing Touches

  • 📝 Generate Docstrings

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Task A simple Todo Enhancement New feature or request labels Dec 16, 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 comments (6)
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts (2)

Line range hint 77-78: Remove or fix the commented verification

The comment indicates a flaky test. Either fix the verification or remove the commented code entirely.


Line range hint 89-91: Use constants for assertion values

Replace hardcoded values with constants to improve maintainability and follow coding guidelines.

+const EXPECTED_SHIP_ID = "371681";
+const EXPECTED_VESSEL_TYPE = "Passenger";
-dataSources.AssertQueryTableResponse(0, "371681");
-dataSources.AssertQueryTableResponse(6, "Passenger");
+dataSources.AssertQueryTableResponse(0, EXPECTED_SHIP_ID);
+dataSources.AssertQueryTableResponse(6, EXPECTED_VESSEL_TYPE);
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js (1)

Line range hint 82-182: Multiple test practices need improvement

The test case violates several Cypress best practices:

  1. Replace explicit waits with proper assertions or intercepts
  2. Remove force clicks and use proper element visibility handling
  3. Clean up commented code
  4. Use constants for selector strings

Here's how to improve the code:

- cy.get(datasourceEditor.AmazonS3).click({ force: true }).wait(1000);
+ cy.get(datasourceEditor.AmazonS3).should('be.visible').click();

- cy.wait(2000);
+ cy.get(generatePage.selectTableDropdown).should('be.visible');

- //Post Execute call not happening.. hence commenting it for this case
- //cy.wait("@post_Execute").should("have.nested.property", "response.body.responseMeta.status", 200,);

- // cy.get("@saveDatasource").then((httpResponse) => {
- //   datasourceName = httpResponse.response.body.data.name;
- // });

- cy.get("span:contains('Got it')").click();
+ cy.get(commonlocators.gotItButton).click();
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts (1)

Line range hint 89-91: Replace Sleep with Cypress's built-in retry-ability

Using agHelper.Sleep(3000) is not recommended in Cypress tests. Instead, use Cypress's automatic retry and wait mechanisms.

-      agHelper.Sleep(3000);
+      cy.waitUntil(() => table.WaitUntilTableLoad(0, 0, "v2"));
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts (2)

Line range hint 31-82: Move SQL data to fixtures

Large SQL statements should be moved to fixture files for better maintainability and reusability.

Consider creating a new fixture file cypress/fixtures/stores.sql and importing it in the test.


Line range hint 92-127: Replace hardcoded waits with Cypress commands

Multiple instances of agHelper.Sleep(3000) should be replaced with Cypress's built-in waiting mechanisms.

-      agHelper.Sleep(3000); //wait for table navigation to take effect!
+      cy.waitUntil(() => table.WaitUntilTableLoad(0, 0, "v2"));
🧹 Nitpick comments (5)
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts (1)

11-11: Consider using a more specific type instead of any

Replace any with a more specific type like string to improve type safety.

-let dsName: any;
+let dsName: string;
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js (1)

Line range hint 1-30: Consider architectural improvements

While the test structure is generally good, consider these improvements:

  1. Move all selectors to locator files
  2. Add type definitions for the test data
  3. Consider using custom commands for repetitive operations

Example improvements:

+ // In GeneratePage.json
+ {
+   "gotItButton": "[data-cy='got-it-button']",
+   "generatePageTitle": "[data-cy='generate-page-title']"
+ }

+ // In commands.js
+ Cypress.Commands.add('fillS3Form', (formData) => {
+   // Common S3 form filling logic
+ });
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts (2)

Line range hint 16-24: Remove commented code blocks

Remove commented code blocks that are no longer needed. If they're for reference, consider moving them to documentation.

-    // beforeEach(function() {
-    //   if (INTERCEPT.MYSQL) {
-    //     cy.log("MySQL DB is not found. Using intercept");
-    //     //dataSources.StartInterceptRoutesForMySQL();
-    //   } else cy.log("MySQL DB is found, hence using actual DB");
-    // });

Line range hint 207-219: Improve error handling test case

The error handling test case could be more comprehensive. Consider adding more assertions for different error scenarios.

 cy.wait("@postExecute").then(({ response }) => {
   expect(response?.body.data.isExecutionSuccess).to.eq(false);
   expect(
     response?.body.data.pluginErrorDetails.downstreamErrorMessage,
   ).to.contains("Unknown table 'fakeapi.productlines'");
+  // Add more assertions for error details
+  expect(response?.body.data.pluginErrorDetails.error).to.exist;
+  expect(response?.body.data.pluginErrorDetails.errorType).to.exist;
 });
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts (1)

89-91: Track skipped test with issue number

The skipped test is properly documented with issue #29870, but consider adding more context about the failure condition.

-    it.skip("3. Verify Refresh table from Deploy page - on Stores & verify all updates persists : Skipped till #29870 gets fixed", () => {
+    it.skip("3. Verify Refresh table from Deploy page - on Stores & verify all updates persists : Skipped due to table v2 selection issues (#29870)", () => {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa42e7 and 4534f65.

📒 Files selected for processing (6)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Mongo_Spec.ts (0 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_Spec.ts (3 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts (2 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts (2 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts (1 hunks)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js (1 hunks)
💤 Files with no reviewable changes (1)
  • app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Mongo_Spec.ts
🧰 Additional context used
📓 Path-based instructions (5)
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL1_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/e2e/Regression/ServerSide/GenerateCRUD/S3_Spec.js (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/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_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/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_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/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_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 (2)
app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres2_Spec.ts (1)

Line range hint 13-103: LGTM! Changes align with PR objectives

The removal of generate page button related tests while maintaining core CRUD validation aligns well with the PR objectives. The remaining test cases provide good coverage of essential functionality.

app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/Postgres1_Spec.ts (1)

Line range hint 1-14: Verify test coverage for remaining CRUD operations

With the removal of the generate page test case, ensure that the remaining test cases adequately cover CRUD operations through other means.

✅ Verification successful

Based on the search results, I can see comprehensive test coverage for CRUD operations across multiple test files (Postgres1_Spec.ts, Postgres2_Spec.ts, Mongo_Spec.ts, MongoURI_Spec.ts, MySQL2_Spec.ts). Each file contains tests for:

  1. Create operations (e.g., "Create new CRUD Table", "Insert document(s)")
  2. Read operations (e.g., "Select record", "Find document(s)")
  3. Update operations (e.g., "Verify Update data", "updateNVerify")
  4. Delete operations (e.g., "Verify Delete", "DeleteDatasource")

Test coverage for CRUD operations is well maintained across different database types

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check coverage of CRUD operations in remaining tests
rg -A 5 "describe\(.*CRUD" app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/

Length of output: 87


Script:

#!/bin/bash
# Let's search for CRUD operation test cases with a broader pattern
rg -i "crud|create|read|update|delete" app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/ -A 5

# Also check for test descriptions that might indicate CRUD operations
rg "describe\(.*[\"'].*(?i)(crud|create|read|update|delete)" app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/ -A 5

# Search for specific Cypress test patterns that might indicate CRUD operations
rg "it\(.*[\"'].*(?i)(crud|create|read|update|delete)" app/client/cypress/e2e/Regression/ServerSide/GenerateCRUD/ -A 5

Length of output: 70911

@jacquesikot jacquesikot removed the ok-to-test Required label for CI label Dec 18, 2024
@rahulbarwal
Copy link
Contributor

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12432240679.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38182.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38182.dp.appsmith.com

@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 20, 2024
@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 31, 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 comments (1)
app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts (1)

Line range hint 248-264: Improve test reliability with better assertions

The test lacks proper assertions between page navigation steps. Consider:

  1. Adding wait conditions for page load
  2. Verifying the active tab state
  3. Using data-cy attributes instead of class selectors
 it.skip("9. Verify selecting JSObject does not change the page", () => {
   PageList.AddNewPage("New blank page");
+  cy.url().should('include', '/page');
   PageLeftPane.switchSegment(PagePaneSegment.JS);
   agHelper.GetNClick(locators._createNew);
   agHelper.AssertContains("JSObject1", "exist", entityExplorer._entityName);
   agHelper.GetNClick(jsEditor._addJSObj);
   agHelper.AssertContains("JSObject2", "exist", entityExplorer._entityName);
   EditorNavigation.NavigateToPage("Page1", true);
+  cy.url().should('include', '/page1');
   PageLeftPane.switchSegment(PagePaneSegment.JS);
   agHelper.GetNClick(locators._editorTab);
   PageList.VerifyIsCurrentPage("Page1");
   EditorNavigation.NavigateToPage("Page2", true);
+  cy.url().should('include', '/page2');
   agHelper.AssertContains("JSObject1", "exist", entityExplorer._entityName);
   agHelper.GetNClick(locators._editorTab);
   PageList.VerifyIsCurrentPage("Page2");
 });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1aeda9 and 7be89cc.

📒 Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_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.
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check

Comment on lines +240 to 245
it.skip("8. Verify JSObject with identical name should not exist Bug: #35385", () => {
for (let i = 0; i < 10; i++) {
agHelper.GetNClick(locators._createNew, 0, true, 0);
}
agHelper.AssertElementAbsence(locators._toastMsg);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace hardcoded sleep with proper assertions

The test uses a loop to create objects but lacks proper assertions between actions. Consider:

  1. Using cy.intercept() to wait for network requests
  2. Adding assertions to verify each object creation
 it.skip("8. Verify JSObject with identical name should not exist Bug: #35385", () => {
+  cy.intercept('POST', '/api/v1/collections/actions').as('createJSObject');
   for (let i = 0; i < 10; i++) {
     agHelper.GetNClick(locators._createNew, 0, true, 0);
+    cy.wait('@createJSObject');
+    agHelper.AssertElementExist(`${locators._entityName}:contains("JSObject${i + 1}")`);
   }
   agHelper.AssertElementAbsence(locators._toastMsg);
 });

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Contributor

@ayushpahwa ayushpahwa left a comment

Choose a reason for hiding this comment

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

Seems like PR is still WIP, commenting to remove notifications in the meantime

@jacquesikot jacquesikot added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request ok-to-test Required label for CI Task A simple Todo Widgets & Accelerators Pod Issues related to widgets & Accelerators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Hide generate new page button in datasource preview page
4 participants