PromucFlow_constructor/app/client/cypress/support/e2e.js

175 lines
5.0 KiB
JavaScript
Raw Normal View History

2019-12-12 07:50:53 +00:00
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
/// <reference types="Cypress" />
feat: ci changes & cypress tests with cypress tags (#22989) ## Description This includes > Building a new image for airgapped instances > Running ci-tests on airgapped image > Running cypress tests selectively ignoring non supported features for airgap like Templates, Custom JS lib and also alternating test behaviours for some tests like tests using mock db, since it doesn't work on airgap we have to create a ds. So this selective testing was done using cypress-tags > Having a new client build for airgapped images which bundles all the assets. > And changes in the workflow files to account for all the above. With airgap, we can ignore certain tests and also need to account for tests using mock datasources and such by creating new datasources instead of mock datasources. Since those are blocked. So to perform a selective testing we are using a plugin called `cypress-tags` and to perform conditional testing when required we use the `AIRGAPPED` cypress env. This PR introduces both and also modified the codebase to support this new way of running cypress. Since we can't trigger `/ok-to-test` on this because ci-test needs the CYPRESS_EXCLUDE_TAGS and slash command doesn't dispatch from current branch, I manually triggered the `TBP` workflow to run ci-test on this branch. And the new `TBP airgap` workflow to run ci-test on airgapped docker image on this branch. Here is the link to the run https://github.com/appsmithorg/appsmith/actions/runs/4882041416 Fixes #22007 Fixes #22814 ## Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? - Manual - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-05-11 18:45:06 +00:00
/// <reference types='cypress-tags' />
import "cypress-real-events";
import "cypress-real-events/support";
import "cypress-wait-until";
import "cypress-network-idle";
import "cypress-xpath";
chore: cypress snapshot types (#34722) ## Description 1. Add scripts for local e2e testing in the docker container. 2. Add types for cypress-image-snapshot In this PR, I also added the following PRS as they affect screenshot tests as well. I did this to speed up the process and unblock the team. #34528 #34546 #34676 #34729 #34638 #34639 #34511 To run E2E tests locally in docker, you need to do the following: 1. Run FE locally and prepare the tests for local launch. See the instructions [here](https://github.com/appsmithorg/appsmith/blob/release/contributions/ClientSetup.md). 2. Run `yarn cypress:snapshot:docker:build` — this will create a docker container with the necessary environment. 3. Run `yarn cypress:snapshot:docker "./cypress/e2e/Regression/ClientSide/Anvil/Widgets/*_spec.ts" updateSnapshots=false`. Here we can use the path to a specific file, or set `updateSnapshots=true` flag to update the screenshots. ## Automation /ok-to-test tags="@tag.Anvil" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9844579277> > Commit: 75f26599b149f831051fbd631aaa059084b226dd > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9844579277&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Anvil` > Spec: > <hr>Mon, 08 Jul 2024 18:37:36 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for image snapshot testing with the `@types/cypress-image-snapshot` dependency. - **Refactor** - Updated test specifications by removing unnecessary `triggerInputInvalidState()` calls. - Reorganized and improved efficiency of image snapshot methods for various devices. - **Chores** - Updated `Dockerfile` to configure the Cypress environment with specific versions for dependencies. - Changed import paths in `e2e.js` for better module resolution. - **Style** - Fixed a comment typo in Cypress plugin configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local> Co-authored-by: unknown <vadim@appsmith.com>
2024-07-09 09:06:59 +00:00
import * as MESSAGES from "../../src/ce/constants/messages.ts";
import "./ApiCommands";
import "./commands";
import { initLocalstorage, addIndexedDBKey } from "./commands";
import "./dataSourceCommands";
import "./gitSync";
import { initLocalstorageRegistry } from "./Objects/Registry";
import RapidMode from "./RapidMode.ts";
import "cypress-mochawesome-reporter/register";
import installLogsCollector from "cypress-terminal-report/src/installLogsCollector";
import { CURRENT_REPO, REPO } from "../fixtures/REPO";
chore: change snapshot package (#35867) /ok-to-test tags="@tag.All" ## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10815637874> > Commit: 54937a7a64e755959e3420a0a20abcc30ee10d78 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10815637874&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 11 Sep 2024 17:30:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for visual regression testing through new tagging in various test suites. - Integrated a new image snapshot plugin to enhance testing capabilities. - **Bug Fixes** - Removed outdated image snapshot assertions to streamline testing processes. - **Documentation** - Updated tags in multiple test suites to improve organization and clarity regarding visual testing. - **Chores** - Upgraded Node.js version in the Cypress Dockerfile for improved performance and compatibility. - Simplified Cypress plugin configuration by removing unnecessary functions and enhancing browser compatibility. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
2024-09-12 08:09:42 +00:00
import { addMatchImageSnapshotCommand } from "@simonsmith/cypress-image-snapshot/command";
import "./WorkspaceCommands";
import "./queryCommands";
import "./widgetCommands";
import "./themeCommands";
2022-04-21 06:14:02 +00:00
import "./AdminSettingsCommands";
feat: Add support for tab in autocompletion (#22653) ## Description This adds the ability to select an option from the autocomplete suggestions list using the `Tab` key while writing code. Earlier, users could use only the `Enter` key to do so. All code editors support `Tab` for autocomplete. Fixes #20448 ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Cypress ### Test Plan [Test Plan](https://github.com/appsmithorg/TestSmith/issues/2377) ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-04-28 10:02:40 +00:00
import "cypress-plugin-tab";
import {
FEATURE_WALKTHROUGH_INDEX_KEY,
WALKTHROUGH_TEST_PAGE,
} from "./Constants.js";
test: Cypress - Added cypress grep library (#29259) Leveraging the library [cypress-grep](https://github.com/cypress-io/cypress/tree/develop/npm/grep). Using this we can tag testcases with relevant tags and use it to run specific testcases. **Command to run in local:** `CYPRESS_grepTags=@tag.Binding,@tag.Git npx cypress run ` Pass the tags to CYPRESS_grepTags argument and only the test cases which has the tags passed will be picked to run. ex `@tag.Binding and @tag.Git` are the tag names here. **Tags can be added in the description on the test case like** `{ tags: ["@tag.Datasource"] }` for a single tag `{ tags: ["@tag.Datasource", "@tag.Git"] }` for multiple tags **How to run In CI** Single Tag - `/ok-to-test tags=@tag.Binding` Multiple tag - `/ok-to-test tags=@tag.Binding,@tag.Git` **TODOs in the next release:** - [ ] Add tags.ts file with all needed tags - [ ] Add tags to remaining spec files. - [ ] Fail the PR run if tags added are not from tag.ts and post the message on the same #### Type of change - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [x] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [x] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a search functionality to the app. - **Enhancements** - Integrated search bar at the top of the `Hero` component and a `Search` component to the `App` component. - Added styles for the search bar. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2023-12-07 12:53:27 +00:00
const registerCypressGrep = require("@cypress/grep");
/// <reference types="cypress-xpath" />
test: Cypress - Added cypress grep library (#29259) Leveraging the library [cypress-grep](https://github.com/cypress-io/cypress/tree/develop/npm/grep). Using this we can tag testcases with relevant tags and use it to run specific testcases. **Command to run in local:** `CYPRESS_grepTags=@tag.Binding,@tag.Git npx cypress run ` Pass the tags to CYPRESS_grepTags argument and only the test cases which has the tags passed will be picked to run. ex `@tag.Binding and @tag.Git` are the tag names here. **Tags can be added in the description on the test case like** `{ tags: ["@tag.Datasource"] }` for a single tag `{ tags: ["@tag.Datasource", "@tag.Git"] }` for multiple tags **How to run In CI** Single Tag - `/ok-to-test tags=@tag.Binding` Multiple tag - `/ok-to-test tags=@tag.Binding,@tag.Git` **TODOs in the next release:** - [ ] Add tags.ts file with all needed tags - [ ] Add tags to remaining spec files. - [ ] Fail the PR run if tags added are not from tag.ts and post the message on the same #### Type of change - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [x] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [x] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a search functionality to the app. - **Enhancements** - Integrated search bar at the top of the `Hero` component and a `Search` component to the `App` component. - Added styles for the search bar. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2023-12-07 12:53:27 +00:00
registerCypressGrep();
installLogsCollector();
chore: change snapshot package (#35867) /ok-to-test tags="@tag.All" ## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10815637874> > Commit: 54937a7a64e755959e3420a0a20abcc30ee10d78 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10815637874&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 11 Sep 2024 17:30:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for visual regression testing through new tagging in various test suites. - Integrated a new image snapshot plugin to enhance testing capabilities. - **Bug Fixes** - Removed outdated image snapshot assertions to streamline testing processes. - **Documentation** - Updated tags in multiple test suites to improve organization and clarity regarding visual testing. - **Chores** - Upgraded Node.js version in the Cypress Dockerfile for improved performance and compatibility. - Simplified Cypress plugin configuration by removing unnecessary functions and enhancing browser compatibility. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
2024-09-12 08:09:42 +00:00
addMatchImageSnapshotCommand({
comparisonMethod: "ssim",
failureThreshold: 0.01,
failureThresholdType: "percent",
});
Cypress.on("uncaught:exception", (error) => {
return false; // returning false here prevents Cypress from failing the test
});
Cypress.on("fail", (error) => {
cy.log(error.message);
test: Cypress | CI Stabilize + Other test improvements (#28172) ## Description - **This PR flaky fixes below specs:** - GenerateCRUD/MySQL2_Spec.ts script fix - ServerSide/ApiTests/API_All_Verb_spec.js - Regression/Apps/PromisesApp_spec.js - TableV2_Property_ToggleJs_With_Binding_spec.js - GSheet cases failures due to EditApponHover method fix - Radio/Radio2_spec.ts, using `GetHeight` instead of `GetWidgetCSSHeight` - Select/Select3_Spec.ts - Widgets/Text/Text_new_feature_spec.js - Binding/API_with_List_Widget_spec.js - Workspace/LoginFromUIApp_spec.js - removed redundant code - QueryPane/DSDocs_Spec.ts - ServerSide/QueryPane/GoogleSheets_spec.ts - TableV2/Date_column_editing_1_spec.ts - Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts - script flow corrected - ServerSide/QueryPane/Mongo_Spec.js - **Added validation for form plugin response data, which addresses the Empty toast issue** - **Below specs are fixed for new appName localStorage changes:** - /SettingsPane/PageSettings_spec.ts - BugTests/Moment_Spec.ts - /Fork/ForkAppWithMultipleDS_Spec.ts - Fork/ForkApplicationWithinAppEditor_spec.ts - Fork/ForkApplication_spec.ts - /ClientSide/OtherUIFeatures/Analytics_spec.js - OtherUIFeatures/ApplicationURL_spec.js - OtherUIFeatures/ExportApplication_spec.js - Duplicate case removed - OtherUIFeatures/UpdateApplication_spec.js - VisualTests/JSEditorIndent_spec.js - Workspace/WorkspaceImportApplication_spec.js - **Improvemnets:** - deployMode.StubWindowNAssert() improved to validate `getPluginForm` instead of `getWorkspace` - agHelper.AddDsl() improved, removed wait times - appSettings.CheckUrl() - appName url updated - assertHelper.AssertDocumentReady() -removed wait times - assertHelper.AssertNetworkResponseData() - added for `getPluginForm` validation for Page loads - deployMode.DeployApp() -removed wait times - homePage.CreateNewWorkspace() - improved to set localStorage for workspaceName, workspaceId & create new workspace without new name - homePage.CreateNewApplication() - - improved to set localStorage for appName - jsEditor.NavigateToNewJSEditor() - improved to remove tooltip - cy.CreateAppInFirstListedWorkspace() - improved to set localStorage for appName, removed waitTimes, Removed rename of every app for every spec, calling AssertNetworkResponseData(getPluginForm) - cy.DeleteWorkspaceByApi() added - e2e.js - removed guid generation for first app, added cy.DeleteWorkspaceByApi() in after() #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-10-20 02:15:47 +00:00
throw error; // throw error to have test fail
});
Cypress.env("MESSAGES", MESSAGES);
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
before(function () {
if (RapidMode.config.enabled) {
cy.startServerAndRoutes();
cy.getCookie("SESSION").then((cookie) => {
if (!cookie) {
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
}
});
if (!RapidMode.config.usesDSL) {
cy.visit(RapidMode.url());
cy.wait("@getWorkspace");
}
}
});
before(function () {
if (RapidMode.config.enabled) {
return;
}
2021-07-02 06:04:36 +00:00
initLocalstorage();
initLocalstorageRegistry();
cy.startServerAndRoutes();
// Clear indexedDB
cy.window().then((window) => {
window.indexedDB.deleteDatabase("Appsmith");
});
cy.visit("/setup/welcome", { timeout: 60000 });
cy.wait("@getConsolidatedData");
cy.wait(2000);
test: Cypress | CI Stablize + Other improvements (#28254) ## Description **This PR does the below improvements:** - Handles initial empty error toast- with cy.LogOut() - Calling cy.LoginFromAPI() per need only - to improve execution time - Update agHelper.UpdateCodeInput() - Added waitForNetworkCall for AsserHelper methods to only get api call & validate - Added gitSync.AuthorizeKeyToGitea() - to validate keyGenerate success - Adding validationg for 'Unable to import application in workspace' - cy.CreateNewAppInNewWorkspace() improved - agHelper.RemoveUIElement() created to handle tooltip, toast, evaluatedpopup & removed duplicates - cy.merge() improved to call assertHelper - assertHelper.AssertNetworkStatus() to handle both array & individual status checks & return actual responseCode - createBranch & generatedKey intercepts added to git operation validations - homePage.AssertApplication() created - Removed cy.Logout() & Login improved - brings down total run time to less than 1 hr from 1+ hrs - entityExplorer.NavigateToSwitcher() improved to check status - dataSources.ValidateDSDeletion() improved to handle one of array toast for array value also - assertHelper.WaitForNetworkCall() improved to wait & return latest request - Private methods processNetworkStatus() & processNetworkResponseData() created **Also flaky fixes below:** - ServerSide/QueryPane/S3_2_spec.ts - Adding sleep for CI flaky behaviour - Trial fix for cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts - GitWithJSLibrary/GitwithCustomJSLibrary_spec.js - Handling Import failure at various points in the flow - ExplorerTests/Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js - ClientSide/JSLibrary/Library_spec.ts - asserting success import - /OtherUIFeatures/ApplicationURL_spec.js - using cy.url() - /ClientSide/Templates/Fork_Template_spec.js - ServerSide/Postgres_DataTypes/Binary_Spec.ts & /Postgres_DataTypes/Json_Spec.ts - Adding sleep for CI flaky behaviour - ClientSide/Widgets/List/List4_2_spec.js - /Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-10-25 14:03:07 +00:00
const username = Cypress.env("USERNAME");
const password = Cypress.env("PASSWORD");
cy.url().then((url) => {
if (url.indexOf("setup/welcome") > -1) {
cy.createSuperUser();
cy.SignupFromAPI(
Cypress.env("TESTUSERNAME1"),
Cypress.env("TESTPASSWORD1"),
);
cy.LogOut();
cy.SignupFromAPI(
Cypress.env("TESTUSERNAME2"),
Cypress.env("TESTPASSWORD2"),
);
cy.LogOut();
cy.SignupFromAPI(
Cypress.env("TESTUSERNAME3"),
Cypress.env("TESTPASSWORD3"),
);
cy.LogOut();
cy.SignupFromAPI(
Cypress.env("TESTUSERNAME4"),
Cypress.env("TESTPASSWORD4"),
);
cy.LogOut();
test: Cypress | CI Stablize + Other improvements (#28254) ## Description **This PR does the below improvements:** - Handles initial empty error toast- with cy.LogOut() - Calling cy.LoginFromAPI() per need only - to improve execution time - Update agHelper.UpdateCodeInput() - Added waitForNetworkCall for AsserHelper methods to only get api call & validate - Added gitSync.AuthorizeKeyToGitea() - to validate keyGenerate success - Adding validationg for 'Unable to import application in workspace' - cy.CreateNewAppInNewWorkspace() improved - agHelper.RemoveUIElement() created to handle tooltip, toast, evaluatedpopup & removed duplicates - cy.merge() improved to call assertHelper - assertHelper.AssertNetworkStatus() to handle both array & individual status checks & return actual responseCode - createBranch & generatedKey intercepts added to git operation validations - homePage.AssertApplication() created - Removed cy.Logout() & Login improved - brings down total run time to less than 1 hr from 1+ hrs - entityExplorer.NavigateToSwitcher() improved to check status - dataSources.ValidateDSDeletion() improved to handle one of array toast for array value also - assertHelper.WaitForNetworkCall() improved to wait & return latest request - Private methods processNetworkStatus() & processNetworkResponseData() created **Also flaky fixes below:** - ServerSide/QueryPane/S3_2_spec.ts - Adding sleep for CI flaky behaviour - Trial fix for cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts - GitWithJSLibrary/GitwithCustomJSLibrary_spec.js - Handling Import failure at various points in the flow - ExplorerTests/Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js - ClientSide/JSLibrary/Library_spec.ts - asserting success import - /OtherUIFeatures/ApplicationURL_spec.js - using cy.url() - /ClientSide/Templates/Fork_Template_spec.js - ServerSide/Postgres_DataTypes/Binary_Spec.ts & /Postgres_DataTypes/Json_Spec.ts - Adding sleep for CI flaky behaviour - ClientSide/Widgets/List/List4_2_spec.js - /Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-10-25 14:03:07 +00:00
cy.LoginFromAPI(username, password);
} else if (url.indexOf("user/login") > -1) {
//Cypress.Cookies.preserveOnce("SESSION", "remember_token");
cy.LoginFromAPI(username, password);
cy.wait(3000);
}
});
chore: Updating validateLicense function call in cypress (#28448) ## Description Updating validateLicense function call in cypress #### PR fixes following issue(s) Fixes # (issue number) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-10-28 21:55:06 +00:00
if (CURRENT_REPO === REPO.EE) {
cy.wait(2000);
cy.url().then((url) => {
if (url.indexOf("/license") > -1) {
cy.validateLicense();
}
});
}
if (!Cypress.currentTest.titlePath[0].includes(WALKTHROUGH_TEST_PAGE)) {
// Adding key FEATURE_WALKTHROUGH (which is used to check if the walkthrough is already shown to the user or not) for non walkthrough cypress tests (to not show walkthrough)
addIndexedDBKey(FEATURE_WALKTHROUGH_INDEX_KEY, {
binding_widget: true,
});
}
test: Cypress | CI Stablize + Other improvements (#28254) ## Description **This PR does the below improvements:** - Handles initial empty error toast- with cy.LogOut() - Calling cy.LoginFromAPI() per need only - to improve execution time - Update agHelper.UpdateCodeInput() - Added waitForNetworkCall for AsserHelper methods to only get api call & validate - Added gitSync.AuthorizeKeyToGitea() - to validate keyGenerate success - Adding validationg for 'Unable to import application in workspace' - cy.CreateNewAppInNewWorkspace() improved - agHelper.RemoveUIElement() created to handle tooltip, toast, evaluatedpopup & removed duplicates - cy.merge() improved to call assertHelper - assertHelper.AssertNetworkStatus() to handle both array & individual status checks & return actual responseCode - createBranch & generatedKey intercepts added to git operation validations - homePage.AssertApplication() created - Removed cy.Logout() & Login improved - brings down total run time to less than 1 hr from 1+ hrs - entityExplorer.NavigateToSwitcher() improved to check status - dataSources.ValidateDSDeletion() improved to handle one of array toast for array value also - assertHelper.WaitForNetworkCall() improved to wait & return latest request - Private methods processNetworkStatus() & processNetworkResponseData() created **Also flaky fixes below:** - ServerSide/QueryPane/S3_2_spec.ts - Adding sleep for CI flaky behaviour - Trial fix for cypress/e2e/Regression/ClientSide/OtherUIFeatures/PageOnLoad_spec.ts - GitWithJSLibrary/GitwithCustomJSLibrary_spec.js - Handling Import failure at various points in the flow - ExplorerTests/Widgets_Copy_Paste_Delete_Undo_Keyboard_Event_spec.js - ClientSide/JSLibrary/Library_spec.ts - asserting success import - /OtherUIFeatures/ApplicationURL_spec.js - using cy.url() - /ClientSide/Templates/Fork_Template_spec.js - ServerSide/Postgres_DataTypes/Binary_Spec.ts & /Postgres_DataTypes/Json_Spec.ts - Adding sleep for CI flaky behaviour - ClientSide/Widgets/List/List4_2_spec.js - /Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-10-25 14:03:07 +00:00
cy.CreateNewAppInNewWorkspace(); //Creating new workspace and app
cy.fixture("TestDataSet1").then(function (data) {
this.dataSet = data;
2020-05-08 09:01:11 +00:00
});
});
2020-05-08 09:01:11 +00:00
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
beforeEach(function () {
if (!navigator.userAgent.includes("Cypress")) {
window.addEventListener("beforeunload", this.beforeunloadFunction);
}
2021-07-02 06:04:36 +00:00
initLocalstorage();
cy.startServerAndRoutes();
//-- Delete local storage data of entity explorer
cy.DeleteEntityStateLocalStorage();
cy.intercept("api/v1/admin/env", (req) => {
req.headers["origin"] = Cypress.config("baseUrl");
});
});
2019-12-12 07:50:53 +00:00
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> ## Description This PR upgrades Prettier to v2 + enforces TypeScript’s [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax where applicable. It’s submitted as a separate PR so we can merge it easily. As a part of this PR, we reformat the codebase heavily: - add `import type` everywhere where it’s required, and - re-format the code to account for Prettier 2’s breaking changes: https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes This PR is submitted against `release` to make sure all new code by team members will adhere to new formatting standards, and we’ll have fewer conflicts when merging `bundle-optimizations` into `release`. (I’ll merge `release` back into `bundle-optimizations` once this PR is merged.) ### Why is this needed? This PR is needed because, for the Lodash optimization from https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3, we need to use `import type`. Otherwise, `babel-plugin-lodash` complains that `LoDashStatic` is not a lodash function. However, just using `import type` in the current codebase will give you this: <img width="962" alt="Screenshot 2023-03-08 at 17 45 59" src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png"> That’s because Prettier 1 can’t parse `import type` at all. To parse it, we need to upgrade to Prettier 2. ### Why enforce `import type`? Apart from just enabling `import type` support, this PR enforces specifying `import type` everywhere it’s needed. (Developers will get immediate TypeScript and ESLint errors when they forget to do so.) I’m doing this because I believe `import type` improves DX and makes refactorings easier. Let’s say you had a few imports like below. Can you tell which of these imports will increase the bundle size? (Tip: it’s not all of them!) ```ts // app/client/src/workers/Linting/utils.ts import { Position } from "codemirror"; import { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` It’s pretty hard, right? What about now? ```ts // app/client/src/workers/Linting/utils.ts import type { Position } from "codemirror"; import type { LintError as JSHintError, LintOptions } from "jshint"; import { get, isEmpty, isNumber, keys, last, set } from "lodash"; ``` Now, it’s clear that only `lodash` will be bundled. This helps developers to see which imports are problematic, but it _also_ helps with refactorings. Now, if you want to see where `codemirror` is bundled, you can just grep for `import \{.*\} from "codemirror"` – and you won’t get any type-only imports. This also helps (some) bundlers. Upon transpiling, TypeScript erases type-only imports completely. In some environment (not ours), this makes the bundle smaller, as the bundler doesn’t need to bundle type-only imports anymore. ## Type of change - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? This was tested to not break the build. ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
after(function () {
if (RapidMode.config.enabled) {
return;
}
//-- Deleting the application by Api---//
cy.DeleteAppByApi();
test: Cypress | CI Stabilize + Other test improvements (#28172) ## Description - **This PR flaky fixes below specs:** - GenerateCRUD/MySQL2_Spec.ts script fix - ServerSide/ApiTests/API_All_Verb_spec.js - Regression/Apps/PromisesApp_spec.js - TableV2_Property_ToggleJs_With_Binding_spec.js - GSheet cases failures due to EditApponHover method fix - Radio/Radio2_spec.ts, using `GetHeight` instead of `GetWidgetCSSHeight` - Select/Select3_Spec.ts - Widgets/Text/Text_new_feature_spec.js - Binding/API_with_List_Widget_spec.js - Workspace/LoginFromUIApp_spec.js - removed redundant code - QueryPane/DSDocs_Spec.ts - ServerSide/QueryPane/GoogleSheets_spec.ts - TableV2/Date_column_editing_1_spec.ts - Git/ExistingApps/v1.9.24/DSCrudAndBindings_Spec.ts - script flow corrected - ServerSide/QueryPane/Mongo_Spec.js - **Added validation for form plugin response data, which addresses the Empty toast issue** - **Below specs are fixed for new appName localStorage changes:** - /SettingsPane/PageSettings_spec.ts - BugTests/Moment_Spec.ts - /Fork/ForkAppWithMultipleDS_Spec.ts - Fork/ForkApplicationWithinAppEditor_spec.ts - Fork/ForkApplication_spec.ts - /ClientSide/OtherUIFeatures/Analytics_spec.js - OtherUIFeatures/ApplicationURL_spec.js - OtherUIFeatures/ExportApplication_spec.js - Duplicate case removed - OtherUIFeatures/UpdateApplication_spec.js - VisualTests/JSEditorIndent_spec.js - Workspace/WorkspaceImportApplication_spec.js - **Improvemnets:** - deployMode.StubWindowNAssert() improved to validate `getPluginForm` instead of `getWorkspace` - agHelper.AddDsl() improved, removed wait times - appSettings.CheckUrl() - appName url updated - assertHelper.AssertDocumentReady() -removed wait times - assertHelper.AssertNetworkResponseData() - added for `getPluginForm` validation for Page loads - deployMode.DeployApp() -removed wait times - homePage.CreateNewWorkspace() - improved to set localStorage for workspaceName, workspaceId & create new workspace without new name - homePage.CreateNewApplication() - - improved to set localStorage for appName - jsEditor.NavigateToNewJSEditor() - improved to remove tooltip - cy.CreateAppInFirstListedWorkspace() - improved to set localStorage for appName, removed waitTimes, Removed rename of every app for every spec, calling AssertNetworkResponseData(getPluginForm) - cy.DeleteWorkspaceByApi() added - e2e.js - removed guid generation for first app, added cy.DeleteWorkspaceByApi() in after() #### Type of change - Script fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [X] Cypress CI runs ## Checklist: #### QA activity: - [X] Added `Test Plan Approved` label after Cypress tests were reviewed
2023-10-20 02:15:47 +00:00
cy.DeleteWorkspaceByApi();
});