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: Cypress | Replace static with Dynamic waits - Part II #29557

Merged
merged 26 commits into from
Dec 13, 2023

Conversation

Aishwarya-U-R
Copy link
Contributor

@Aishwarya-U-R Aishwarya-U-R commented Dec 12, 2023

Description

  • This PR removes hard wait from - cypress/e2e/Regression/Apps/ folder specs & fix as needed:
    - /Apps/CommunityIssues_Spec.ts
    - /Apps/[EchoApiCMS_spec.js
    - /Apps/ImportExportForkApplication_spec.js
    - /Apps/MongoDBShoppingCart_spec.ts
    - /Apps/PgAdmin_spec.js
    - /Apps/PromisesApp_spec.js
  • This PR also removes Users mock ds dependency from below specs (using TED instead)
    - ClientSide/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js
    - ClientSide/Widgets/ListV2/Listv2_BasicServerSideData_spec.js
  • Fixes Sanity/Datasources/MockDBs_Spec.ts - for record count validation

Type of change

  • Script fix (non-breaking change which fixes an issue)

Testing

How Has This Been Tested?

  • Cypress CI runs

Checklist:

QA activity:

  • Added Test Plan Approved label after Cypress tests were reviewed

Summary by CodeRabbit

  • Tests
    • Enhanced test reliability by removing hardcoded delays and utilizing dynamic waits.
    • Improved test maintainability by centralizing element interactions through a custom helper.
    • Streamlined test setup for database interactions, removing environment-specific conditions.
    • Updated test file paths to reflect the new structure and focus areas.

Copy link
Contributor

coderabbitai bot commented Dec 12, 2023

Walkthrough

Walkthrough

The changes across various Cypress end-to-end test files reflect a shift towards more reliable and efficient test execution. Explicit sleep commands have been removed in favor of better asynchronous handling, and direct calls to Cypress commands have been replaced with custom helper methods. Additionally, there's a restructuring of data source creation and query execution logic, particularly for Postgres databases, and updates to file paths for test specs.

Changes

Files Change Summary
.../MongoDBShoppingCart_spec.ts Removed explicit sleep commands for better async handling.
.../PgAdmin_spec.js, .../PromisesApp_spec.js Replaced direct cy.xpath calls with custom agHelper methods; replaced explicit waits with assertions for element presence.
.../ListV2_PageNo_PageSize_spec.js, .../Listv2_BasicServerSideData_spec.js Restructured data source creation and query execution logic for Postgres; removed conditional blocks based on environment variables.
.../MockDBs_Spec.ts Updated file paths for test specs and included new paths for ListV2 and PromisesApp tests.

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 X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Tests Test issues labels Dec 12, 2023
@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186022282.
Workflow: ci-test-limited.
PR: 29557.

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7186022282.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js

To know the list of identified flaky tests - Refer here

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186406622.
Workflow: ci-test-limited.
PR: 29557.

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186512678.
Workflow: ci-test-limited.
PR: 29557.

Copy link

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

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186678241.
Workflow: ci-test-limited.
PR: 29557.

Copy link

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

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186768697.
Workflow: ci-test-limited.
PR: 29557.

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186819081.
Workflow: ci-test-limited.
PR: 29557.

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7186918274.
Workflow: ci-test-limited.
PR: 29557.

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/7186678241.
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

Copy link

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

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7193831006.
Workflow: ci-test-limited.
PR: 29557.

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7193897067.
Workflow: ci-test-limited.
PR: 29557.

Copy link

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

Copy link

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

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7194209121.
Workflow: ci-test-limited.
PR: 29557.

Copy link

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

@Aishwarya-U-R
Copy link
Contributor Author

/ci-test-limit

Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/7194488281.
Workflow: ci-test-limited.
PR: 29557.

Copy link

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

Copy link
Contributor

@sarojsarab sarojsarab left a comment

Choose a reason for hiding this comment

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

LGTM

@Aishwarya-U-R Aishwarya-U-R merged commit 6343e56 into release Dec 13, 2023
@Aishwarya-U-R Aishwarya-U-R deleted the test/dynamicwaitremove branch December 13, 2023 12:50
_.dataSources.EnterQuery("SELECT * FROM users LIMIT 20;");
it("6. no of items rendered should be equal to page size", () => {
_.dataSources.CreateDataSource("Postgres");
cy.wait(1000);
Copy link
Member

Choose a reason for hiding this comment

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

@Aishwarya-U-R @sarojsarab Any reason we left the static wait in this test case even though we refactored it to remove external dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This spec was only targeted for removing 'Users' table dependency in this PR. Static wait removal will be done when the spec is picked for wait removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its also mentioned in PR desc.

Copy link
Member

@mohanarpit mohanarpit Dec 14, 2023

Choose a reason for hiding this comment

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

I did read the PR description, but I didn't completely understand why we didn't just remove the "static wait" when we were already editing the test case. This way, we wouldn't have to re-visit this particular spec, right? Was there a lot of added complexity in removing the wait here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will do it from next PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Adding this label to a PR prevents it from being listed in the changelog Tests Test issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants