2024-03-22 02:49:46 +00:00
|
|
|
import { CURRENT_REPO, REPO } from "../../fixtures/REPO";
|
2023-04-05 11:52:43 +00:00
|
|
|
import HomePageLocators from "../../locators/HomePage";
|
2023-10-16 12:07:06 +00:00
|
|
|
import SignupPageLocators from "../../locators/SignupPage.json";
|
2024-03-22 02:49:46 +00:00
|
|
|
import { ObjectsRegistry } from "../Objects/Registry";
|
2024-01-12 14:43:58 +00:00
|
|
|
import { AppSidebar, PageLeftPane } from "./EditorNavigation";
|
2022-03-02 16:54:43 +00:00
|
|
|
export class HomePage {
|
2022-06-15 15:37:41 +00:00
|
|
|
private agHelper = ObjectsRegistry.AggregateHelper;
|
|
|
|
|
private locator = ObjectsRegistry.CommonLocators;
|
2023-05-02 09:52:05 +00:00
|
|
|
private onboarding = ObjectsRegistry.Onboarding;
|
2023-06-18 04:55:16 +00:00
|
|
|
private assertHelper = ObjectsRegistry.AssertHelper;
|
2024-01-25 13:41:48 +00:00
|
|
|
private deployHelper = ObjectsRegistry.DeployMode;
|
2023-06-15 13:21:11 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
private _inviteButton = ".t--invite-user-btn";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _username = "input[name='username']";
|
|
|
|
|
private _password = "input[name='password']";
|
|
|
|
|
private _submitBtn = "button[type='submit']";
|
|
|
|
|
private _workspaceCompleteSection = ".t--workspace-section";
|
|
|
|
|
private _workspaceName = ".t--workspace-name";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _workspaceNameText = ".t--workspace-name-text";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _optionsIcon = ".t--options-icon";
|
2024-01-25 13:41:48 +00:00
|
|
|
public _newIcon = ".createnew";
|
2023-06-15 13:21:11 +00:00
|
|
|
private _renameWorkspaceContainer = ".editable-text-container";
|
2024-02-27 08:55:33 +00:00
|
|
|
private _renameWorkspaceParent = ".t--workspace-rename-input";
|
|
|
|
|
private _renameWorkspaceInput = this._renameWorkspaceParent + " input";
|
2024-07-05 08:27:59 +00:00
|
|
|
/* I'm not sure if asserting the copy of our app is a good idea. This seems like extra complexity when making changes to the copy */
|
2022-06-15 15:37:41 +00:00
|
|
|
private _workspaceList = (workspaceName: string) =>
|
|
|
|
|
".t--workspace-section:contains(" + workspaceName + ")";
|
test: Cypress | Flaky fixes + Replacing static waits (#30067)
## Description
- This PR includes the flaky fixes of the below specs:
- jsEditor.NavigateToNewJSEditor() using TS helpers (Addressing
flakyness in specs /BugTests/JS_Bug29131_spec.ts,
BugTests/invalidLintError_Spec.ts,
ClientSide/BugTests/JS_Bug28764_Spec.ts,
/ClientSide/BugTests/Bug29566_Spec.ts,
ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts)
- /Widgets/ListV2/Listv2_onItemClick_spec.js (toast validation updated
to ts helper)
- /Apps/MongoDBShoppingCart_spec.ts (Flaky fix 2nd case)
- /Regression/Apps/PromisesApp_spec.js (1st test)
- /ClientSide/OtherUIFeatures/ApplicationURL_spec.js (whole spec for
static wait removal + flaky fixes)
- /ClientSide/Templates/Fork_Template_spec.js (complete spec fixes,
cypress exception fix)
- /Sanity/Datasources/Arango_Basic_Spec.ts (3rd test)
- /ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (8th case flaky fix)
- /ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts (2nd
testcase, flow update)
- /ClientSide/OtherUIFeatures/Resize_spec.js (import update)
- /ClientSide/Templates/Fork_Template_spec.js (1st & 3rd for flaky fix,
removed 2nd - redundant check)
- /Git/GitSync/RepoLimitExceededErrorModal_spec.js flaky fix for EE repo
failure
- /ServerSide/ApiTests/API_Bugs_Spec.js (3rd case, removed waits, moved
to TED Api)
- /Apps/EchoApiCMS_spec.js (removed redundant action)
- /AppNavigation/Sidebar_spec.ts, /AppNavigation/TopInline_spec.ts,
/AppNavigation/TopStacked_spec.ts - added refresh calls for CI flakyness
- homePage.RenameWorkspace() & homePage.NavigateToHome() &
homePage.Signout() - removed static wait, added dynamic check
- homePage.CreateNewApplication() - removed static wait
- homePage.CreateAppInWorkspace() - removed commented code
- homePage.CreateNewWorkspace() - logic improved
- agHelper.AssertURL() - added timeout, removed static wait, calling
assertHelper.AssertDocumentReady()
- Few of agHelper methods timeout & error mesg text update
- cy.Signup() - updated validations
- agHelper.CheckForErrorToast() to agHelper.FailIfErrorToast() - method
name
- /ClientSide/BugTests/DSDiscardBugs_spec.ts - removed unnecessary
method call
#### 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 all changes were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Enhanced timeout handling across various helper methods for improved
stability.
- Streamlined interactions with UI elements using updated helper
methods.
- Adjusted test suites to utilize configuration values for consistency.
- **Tests**
- Temporarily disabled specific test suites to address current issues.
- Updated test assertions and interaction patterns for clarity and
reliability.
- Added new test cases and assertions to cover additional
functionalities.
- **Chores**
- Updated workflow variables for more efficient CI processes.
- Curated the list of limited tests to focus on critical test scenarios.
- **Documentation**
- Clarified test descriptions and intentions for better understanding.
- **Bug Fixes**
- Fixed UI element interactions to prevent test flakiness and improve
user experience.
- Implemented page refresh before application imports to ensure clean
state for tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-12 06:30:12 +00:00
|
|
|
private _workspaceNoApps = (workspaceName: string) =>
|
|
|
|
|
this._workspaceList(workspaceName) +
|
2024-07-05 08:27:59 +00:00
|
|
|
":contains('applications in this workspace')";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _workspaceShareUsersIcon = (workspaceName: string) =>
|
2023-05-19 18:37:06 +00:00
|
|
|
".t--workspace-section:contains(" + workspaceName + ") .ads-v2-avatar";
|
2023-02-22 06:01:25 +00:00
|
|
|
_shareWorkspace = (workspaceName: string) =>
|
2022-06-15 15:37:41 +00:00
|
|
|
".t--workspace-section:contains(" +
|
|
|
|
|
workspaceName +
|
|
|
|
|
") button:contains('Share')";
|
2022-09-02 17:15:08 +00:00
|
|
|
private _email =
|
2023-03-16 04:44:32 +00:00
|
|
|
CURRENT_REPO === REPO.CE
|
2022-12-22 17:40:56 +00:00
|
|
|
? "//input[@type='email' and contains(@class,'bp3-input-ghost')]"
|
|
|
|
|
: "//input[@type='text' and contains(@class,'bp3-input-ghost')]";
|
2022-06-15 15:37:41 +00:00
|
|
|
_visibleTextSpan = (spanText: string) => "//span[text()='" + spanText + "']";
|
2024-01-25 13:41:48 +00:00
|
|
|
_newWorkSpaceLink = "[data-testid=t--workspace-new-workspace-auto-create]";
|
2022-12-10 08:30:28 +00:00
|
|
|
private _userRole = (role: string) =>
|
2023-05-19 18:37:06 +00:00
|
|
|
"//div[contains(@class, 'rc-select-item-option-content')]//span[1][text()='" +
|
2022-09-02 17:15:08 +00:00
|
|
|
role +
|
|
|
|
|
"']";
|
2023-07-19 09:05:31 +00:00
|
|
|
_profileMenu = ".t--profile-menu-icon";
|
2023-05-04 05:56:17 +00:00
|
|
|
private _editProfileMenu = ".t--edit-profile";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _signout = ".t--sign-out";
|
2023-08-21 07:49:28 +00:00
|
|
|
_searchUsersInput = ".search-input input";
|
2024-01-25 13:41:48 +00:00
|
|
|
private _leftPanel = "[data-testid=t--left-panel]";
|
2022-08-24 14:23:41 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
private _manageUsers = ".manageUsers";
|
2023-05-19 18:37:06 +00:00
|
|
|
public _closeBtn = ".ads-v2-modal__content-header-close-button";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _appHome = "//a[@href='/applications']";
|
|
|
|
|
_applicationCard = ".t--application-card";
|
2023-05-30 09:24:38 +00:00
|
|
|
_appEditIcon = ".t--application-edit-link";
|
2023-04-12 17:08:55 +00:00
|
|
|
_homeIcon = ".t--appsmith-logo";
|
2023-02-22 06:01:25 +00:00
|
|
|
private _homeAppsmithImage = "a.t--appsmith-logo";
|
2023-07-25 05:33:58 +00:00
|
|
|
_appContainer = ".t--applications-container";
|
2024-01-25 13:41:48 +00:00
|
|
|
_homePageAppCreateBtn = " .createnew";
|
|
|
|
|
_newButtonCreateApplication = "[data-testid=t--workspace-action-create-app]";
|
2024-02-28 09:12:35 +00:00
|
|
|
_newButtonCreateApplicationFromTemplates =
|
|
|
|
|
"[data-testid=t--workspace-action-create-app-from-template]";
|
|
|
|
|
_createAppFromTemplatesDialog =
|
|
|
|
|
"[data-testid=t--create-app-from-templates-dialog-component]";
|
2023-09-13 10:09:34 +00:00
|
|
|
_existingWorkspaceCreateNewApp = (existingWorkspaceName: string) =>
|
2022-07-29 08:48:25 +00:00
|
|
|
`//span[text()='${existingWorkspaceName}']/ancestor::div[contains(@class, 't--workspace-section')]//button[contains(@class, 't--new-button')]`;
|
2023-05-30 09:24:38 +00:00
|
|
|
_applicationName = ".t--application-name";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _editAppName = "bp3-editable-text-editing";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _appMenu = ".ads-v2-menu__menu-item-children";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _selectRole = "//span[text()='Select a role']/ancestor::div";
|
|
|
|
|
private _searchInput = "input[type='text']";
|
|
|
|
|
_appHoverIcon = (action: string) => ".t--application-" + action + "-link";
|
|
|
|
|
private _deleteUser = (email: string) =>
|
|
|
|
|
"//td[text()='" +
|
|
|
|
|
email +
|
|
|
|
|
"']/following-sibling::td//span[contains(@class, 't--deleteUser')]";
|
2022-12-10 08:30:28 +00:00
|
|
|
private _userRoleDropDown = (role: string) => "//span[text()='" + role + "']";
|
2022-06-15 15:37:41 +00:00
|
|
|
//private _userRoleDropDown = (email: string) => "//td[text()='" + email + "']/following-sibling::td"
|
|
|
|
|
private _leaveWorkspaceConfirmModal = ".t--member-delete-confirmation-modal";
|
|
|
|
|
private _workspaceImportAppModal = ".t--import-application-modal";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _leaveWorkspaceConfirmButton =
|
|
|
|
|
"[data-testid=t--workspace-leave-button]";
|
|
|
|
|
private _leaveWorkspace = "//span[text()='Leave workspace']";
|
2022-12-02 05:49:51 +00:00
|
|
|
private _leaveWorkspaceConfirm = "//span[text()='Are you sure?']";
|
2022-06-15 15:37:41 +00:00
|
|
|
_editPageLanding = "//h2[text()='Drag and drop a widget here']";
|
2022-08-22 17:57:07 +00:00
|
|
|
_usersEmailList = "[data-colindex='0']";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _workspaceImport = "[data-testid=t--workspace-import-app]";
|
chore: Add cypress specs for partial import and export functionality (#30166)
## Description
This pull request adds partial import and export tests to the
application. It includes the following changes:
- Adds exported file to be used in partial import export tests
- Add export and import options to EntityExplorer
- Adds spec to test export functionality.
- Add PartialImportExportLocators.ts, EntityCheckboxSelector.tsx,
JSExportedOnly.json, and index.tsx
- Add test for partial export functionality for selected datasources
- Adds test to check all exported sections one by one
- Refactor partial export functionality tests
- Refactor export and import locators
- Add test for partial import functionality
#### PR fixes following issue(s)
Fixes #30029
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] 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
- [ ] 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
- [ ] 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:
- [ ] [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
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced partial export and import functionality for components such
as JavaScript objects, queries, widgets, and data sources.
- Enhanced Entity Explorer with new "Export" and "Import" actions.
- **Tests**
- Added test cases for validating partial export and import features.
- Updated test suite to include direct app level import with data
sources.
- **Refactor**
- Modified access level for the `uploadFile` property in the HomePage
class to facilitate testing.
- **Style**
- Updated UI components with test identifiers to improve testability.
- **Chores**
- Updated the list of tests for running limited test scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2024-01-17 05:50:01 +00:00
|
|
|
public _uploadFile = "//div/form/input";
|
2022-07-29 08:48:25 +00:00
|
|
|
private _importSuccessModal = ".t--import-app-success-modal";
|
|
|
|
|
private _forkModal = ".fork-modal";
|
2023-09-13 10:09:34 +00:00
|
|
|
public _appCard = (applicationName: string) =>
|
2022-07-29 08:48:25 +00:00
|
|
|
"//span[text()='" +
|
|
|
|
|
applicationName +
|
2023-07-04 16:33:31 +00:00
|
|
|
"']/ancestor::div[contains(@class, 't--application-card')]";
|
|
|
|
|
private _applicationContextMenu = (applicationName: string) =>
|
|
|
|
|
this._appCard(applicationName) + "//button[@aria-haspopup='menu']";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _forkApp = '[data-testid="t--fork-app"]';
|
|
|
|
|
private _deleteApp = '[data-testid="t--delete-confirm"]';
|
|
|
|
|
private _deleteAppConfirm = '[data-testid="t--delete"]';
|
2022-07-29 08:48:25 +00:00
|
|
|
private _wsAction = (action: string) =>
|
2024-05-06 12:06:12 +00:00
|
|
|
".workspace-menu-item:contains('" + action + "')";
|
2022-12-29 11:31:10 +00:00
|
|
|
private _homeTab = ".t--apps-tab";
|
2024-01-25 13:41:48 +00:00
|
|
|
private adsV2Text = ".ads-v2-text";
|
2023-06-28 10:16:17 +00:00
|
|
|
private _forkWorkspaceDropdownOption = "div.rc-select-selector";
|
|
|
|
|
private _forkWorkspaceSelectOptions = (option: string) =>
|
|
|
|
|
"div[title='" + option + "']";
|
2023-04-12 17:08:55 +00:00
|
|
|
_welcomeTour = ".t--welcome-tour";
|
|
|
|
|
_welcomeTourBuildingButton = ".t--start-building";
|
2023-05-19 18:37:06 +00:00
|
|
|
_reconnectDataSourceModal = "[data-testid='reconnect-datasource-modal']";
|
2023-05-11 18:45:06 +00:00
|
|
|
_skiptoApplicationBtn = "//span[text()='Skip to Application']/parent::a";
|
2023-05-19 18:37:06 +00:00
|
|
|
_workspaceSettingOption = "[data-testid=t--workspace-setting]";
|
|
|
|
|
_inviteUserMembersPage = "[data-testid=t--page-header-input]";
|
2023-06-15 13:21:11 +00:00
|
|
|
// _appRenameTooltip =
|
|
|
|
|
// '//span[text()="Rename application"]/ancestor::div[contains(@class,"rc-tooltip")]';
|
|
|
|
|
_appRenameTooltip = "span:contains('Rename application')";
|
2023-07-25 05:33:58 +00:00
|
|
|
_sharePublicToggle =
|
|
|
|
|
"//div[contains(@class, 't--share-public-toggle')]//input[@role='switch']";
|
|
|
|
|
_modeSwitchToggle = ".t--comment-mode-switch-toggle";
|
2023-07-11 16:39:13 +00:00
|
|
|
_importFromGitBtn = "div.t--import-json-card + div";
|
2024-01-25 13:41:48 +00:00
|
|
|
_helpButton = ".t--help-menu-option";
|
2023-07-21 05:53:17 +00:00
|
|
|
private signupUsername = "input[name='email']";
|
2023-09-13 10:09:34 +00:00
|
|
|
private _applicationEditedText = (applicationName: string) =>
|
|
|
|
|
this._appCard(applicationName) +
|
|
|
|
|
"//div[contains(@class, 't--application-edited-text')]";
|
2024-01-25 13:41:48 +00:00
|
|
|
public _homePageContainer =
|
|
|
|
|
"div.t--applications-container div.t--workspace-section:not(:empty)";
|
|
|
|
|
private _backToEditor = ".t--back-to-editor";
|
|
|
|
|
private _editorSidebar = ".t--sidebar-Editor";
|
2024-02-01 11:12:53 +00:00
|
|
|
private _membersTab = "[data-testid=t--tab-members]";
|
2024-01-25 13:41:48 +00:00
|
|
|
|
|
|
|
|
public _searchWorkspaceLocator = (workspaceName: string) =>
|
|
|
|
|
`[data-testid="${workspaceName}"]`;
|
2022-12-29 11:31:10 +00:00
|
|
|
public SwitchToAppsTab() {
|
|
|
|
|
this.agHelper.GetNClick(this._homeTab);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 14:03:07 +00:00
|
|
|
//trying to wrap multiple values, not used
|
|
|
|
|
public WrapAndAliasMultipleValues(
|
|
|
|
|
values: Record<string, string>,
|
|
|
|
|
): Record<string, string> {
|
|
|
|
|
const aliases: Record<string, string> = {};
|
|
|
|
|
Object.keys(values).forEach((key) => {
|
|
|
|
|
aliases[key] = values[key];
|
|
|
|
|
cy.wrap(values[key]).as(key);
|
|
|
|
|
});
|
|
|
|
|
return aliases;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-20 02:15:47 +00:00
|
|
|
public CreateNewWorkspace(workspaceNewName = "", toNavigateToHome = false) {
|
2023-07-25 12:27:16 +00:00
|
|
|
if (toNavigateToHome) this.NavigateToHome();
|
2022-12-02 05:49:51 +00:00
|
|
|
let oldName = "";
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.GetNClick(this._newWorkSpaceLink);
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("createWorkspace", 201);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.RemoveUIElement("Tooltip", "Create a new workspace");
|
2023-10-20 02:15:47 +00:00
|
|
|
cy.get("@createWorkspace").then((interception: any) => {
|
|
|
|
|
localStorage.setItem("workspaceId", interception.response.body.data.id);
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
"workspaceName",
|
|
|
|
|
interception.response.body.data.name,
|
|
|
|
|
);
|
2023-10-25 14:03:07 +00:00
|
|
|
cy.wrap(interception.response.body.data.name).as("workspaceName");
|
2023-10-20 02:15:47 +00:00
|
|
|
});
|
2024-01-25 13:41:48 +00:00
|
|
|
cy.get("@workspaceName").then((workspaceName: any) => {
|
|
|
|
|
this.agHelper.AssertElementVisibility(
|
|
|
|
|
this._workspaceNoApps(workspaceName),
|
|
|
|
|
);
|
|
|
|
|
});
|
2023-10-20 02:15:47 +00:00
|
|
|
|
|
|
|
|
workspaceNewName &&
|
2024-01-25 13:41:48 +00:00
|
|
|
cy
|
|
|
|
|
.get(this._workspaceNameText)
|
|
|
|
|
.find(this.adsV2Text)
|
|
|
|
|
.then(($ele) => {
|
|
|
|
|
oldName = $ele.text();
|
|
|
|
|
this.RenameWorkspace(oldName, workspaceNewName, false);
|
|
|
|
|
});
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2024-01-25 13:41:48 +00:00
|
|
|
public OpenWorkspaceOptions(workspaceName: string, networkCallAlias = true) {
|
|
|
|
|
this.SelectWorkspace(workspaceName, networkCallAlias);
|
2024-02-27 08:55:33 +00:00
|
|
|
this.agHelper.GetNClick(this._optionsIcon, 0, true);
|
2023-05-19 18:37:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OpenWorkspaceSettings(workspaceName: string) {
|
|
|
|
|
this.OpenWorkspaceOptions(workspaceName);
|
|
|
|
|
this.agHelper.GetNClick(this._workspaceSettingOption);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-25 13:41:48 +00:00
|
|
|
public RenameWorkspace(
|
|
|
|
|
oldName: string,
|
|
|
|
|
newWorkspaceName: string,
|
|
|
|
|
networkCallAlias = true,
|
|
|
|
|
) {
|
|
|
|
|
this.OpenWorkspaceOptions(oldName, networkCallAlias);
|
2024-02-27 08:55:33 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._renameWorkspaceContainer);
|
|
|
|
|
Cypress._.times(2, () => {
|
|
|
|
|
this.agHelper.GetNClick(this._renameWorkspaceParent, 0, true);
|
|
|
|
|
});
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.WaitUntilEleAppear(this._renameWorkspaceInput);
|
2024-02-27 08:55:33 +00:00
|
|
|
this.agHelper
|
|
|
|
|
.ClearNType(this._renameWorkspaceInput, newWorkspaceName)
|
|
|
|
|
.blur();
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@updateWorkspace");
|
2023-03-10 06:55:13 +00:00
|
|
|
this.agHelper.AssertContains(newWorkspaceName);
|
test: Cypress | Flaky fixes + Replacing static waits (#30067)
## Description
- This PR includes the flaky fixes of the below specs:
- jsEditor.NavigateToNewJSEditor() using TS helpers (Addressing
flakyness in specs /BugTests/JS_Bug29131_spec.ts,
BugTests/invalidLintError_Spec.ts,
ClientSide/BugTests/JS_Bug28764_Spec.ts,
/ClientSide/BugTests/Bug29566_Spec.ts,
ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts)
- /Widgets/ListV2/Listv2_onItemClick_spec.js (toast validation updated
to ts helper)
- /Apps/MongoDBShoppingCart_spec.ts (Flaky fix 2nd case)
- /Regression/Apps/PromisesApp_spec.js (1st test)
- /ClientSide/OtherUIFeatures/ApplicationURL_spec.js (whole spec for
static wait removal + flaky fixes)
- /ClientSide/Templates/Fork_Template_spec.js (complete spec fixes,
cypress exception fix)
- /Sanity/Datasources/Arango_Basic_Spec.ts (3rd test)
- /ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (8th case flaky fix)
- /ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts (2nd
testcase, flow update)
- /ClientSide/OtherUIFeatures/Resize_spec.js (import update)
- /ClientSide/Templates/Fork_Template_spec.js (1st & 3rd for flaky fix,
removed 2nd - redundant check)
- /Git/GitSync/RepoLimitExceededErrorModal_spec.js flaky fix for EE repo
failure
- /ServerSide/ApiTests/API_Bugs_Spec.js (3rd case, removed waits, moved
to TED Api)
- /Apps/EchoApiCMS_spec.js (removed redundant action)
- /AppNavigation/Sidebar_spec.ts, /AppNavigation/TopInline_spec.ts,
/AppNavigation/TopStacked_spec.ts - added refresh calls for CI flakyness
- homePage.RenameWorkspace() & homePage.NavigateToHome() &
homePage.Signout() - removed static wait, added dynamic check
- homePage.CreateNewApplication() - removed static wait
- homePage.CreateAppInWorkspace() - removed commented code
- homePage.CreateNewWorkspace() - logic improved
- agHelper.AssertURL() - added timeout, removed static wait, calling
assertHelper.AssertDocumentReady()
- Few of agHelper methods timeout & error mesg text update
- cy.Signup() - updated validations
- agHelper.CheckForErrorToast() to agHelper.FailIfErrorToast() - method
name
- /ClientSide/BugTests/DSDiscardBugs_spec.ts - removed unnecessary
method call
#### 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 all changes were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Enhanced timeout handling across various helper methods for improved
stability.
- Streamlined interactions with UI elements using updated helper
methods.
- Adjusted test suites to utilize configuration values for consistency.
- **Tests**
- Temporarily disabled specific test suites to address current issues.
- Updated test assertions and interaction patterns for clarity and
reliability.
- Added new test cases and assertions to cover additional
functionalities.
- **Chores**
- Updated workflow variables for more efficient CI processes.
- Curated the list of limited tests to focus on critical test scenarios.
- **Documentation**
- Clarified test descriptions and intentions for better understanding.
- **Bug Fixes**
- Fixed UI element interactions to prevent test flakiness and improve
user experience.
- Implemented page refresh before application imports to ensure clean
state for tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-12 06:30:12 +00:00
|
|
|
this.agHelper.AssertElementVisibility(
|
|
|
|
|
this._workspaceList(newWorkspaceName),
|
|
|
|
|
);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to CheckShareIcon in command.js
|
|
|
|
|
public CheckWorkspaceShareUsersCount(workspaceName: string, count: number) {
|
2024-01-25 13:41:48 +00:00
|
|
|
this.SelectWorkspace(workspaceName);
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this._workspaceShareUsersIcon(workspaceName)).should(
|
|
|
|
|
"have.length",
|
|
|
|
|
count,
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to inviteUserForWorkspace in command.js
|
|
|
|
|
public InviteUserToWorkspace(
|
|
|
|
|
workspaceName: string,
|
|
|
|
|
email: string,
|
|
|
|
|
role: string,
|
2024-01-25 13:41:48 +00:00
|
|
|
networkCallAlias = true,
|
2022-06-15 15:37:41 +00:00
|
|
|
) {
|
2024-01-25 13:41:48 +00:00
|
|
|
this.SelectWorkspace(workspaceName, networkCallAlias);
|
2023-03-31 11:37:09 +00:00
|
|
|
const successMessage =
|
|
|
|
|
CURRENT_REPO === REPO.CE
|
|
|
|
|
? "The user has been invited successfully"
|
|
|
|
|
: "The user/group have been invited successfully";
|
2022-06-17 06:12:18 +00:00
|
|
|
this.StubPostHeaderReq();
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._workspaceList(workspaceName));
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.GetNClick(this._shareWorkspace(workspaceName), 0, true);
|
2023-04-05 11:52:43 +00:00
|
|
|
this.agHelper.AssertElementExist(
|
|
|
|
|
"//span[text()='Users will have access to all applications in this workspace']",
|
|
|
|
|
);
|
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
|
|
|
cy.xpath(this._email).click({ force: true }).type(email);
|
|
|
|
|
cy.xpath(this._selectRole).first().click({ force: true });
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep(500);
|
2022-12-10 08:30:28 +00:00
|
|
|
cy.xpath(this._userRole(role)).click({ force: true });
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.GetNClick(this._inviteButton, 0, true);
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.wait("@mockPostInvite")
|
|
|
|
|
.its("request.headers")
|
|
|
|
|
.should("have.property", "origin", "Cypress");
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.ValidateToastMessage(successMessage);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-12-22 17:40:56 +00:00
|
|
|
public InviteUserToWorkspaceErrorMessage(
|
|
|
|
|
workspaceName: string,
|
|
|
|
|
text: string,
|
|
|
|
|
) {
|
|
|
|
|
const errorMessage =
|
2023-03-16 04:44:32 +00:00
|
|
|
CURRENT_REPO === REPO.CE
|
2022-12-22 17:40:56 +00:00
|
|
|
? "Invalid email address(es) found"
|
|
|
|
|
: "Invalid email address(es) or group(s) found";
|
|
|
|
|
this.StubPostHeaderReq();
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._workspaceList(workspaceName));
|
2022-12-22 17:40:56 +00:00
|
|
|
this.agHelper.GetNClick(this._shareWorkspace(workspaceName), 0, true);
|
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
|
|
|
cy.xpath(this._email).click({ force: true }).type(text);
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.GetNClick(this._inviteButton, 0, true);
|
2022-12-22 17:40:56 +00:00
|
|
|
cy.contains(text, { matchCase: false });
|
|
|
|
|
cy.contains(errorMessage, { matchCase: false });
|
2023-05-19 18:37:06 +00:00
|
|
|
cy.get(".ads-v2-modal__content-header-close-button").click({ force: true });
|
2022-12-22 17:40:56 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-17 06:12:18 +00:00
|
|
|
public StubPostHeaderReq() {
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.intercept("POST", "/api/v1/users/invite", (req) => {
|
|
|
|
|
req.headers["origin"] = "Cypress";
|
|
|
|
|
}).as("mockPostInvite");
|
2023-03-31 11:37:09 +00:00
|
|
|
cy.intercept("POST", "/api/v1/applications/invite", (req) => {
|
|
|
|
|
req.headers["origin"] = "Cypress";
|
|
|
|
|
}).as("mockPostAppInvite");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
public NavigateToHome() {
|
test: Cypress | Flaky fixes + Replacing static waits (#30067)
## Description
- This PR includes the flaky fixes of the below specs:
- jsEditor.NavigateToNewJSEditor() using TS helpers (Addressing
flakyness in specs /BugTests/JS_Bug29131_spec.ts,
BugTests/invalidLintError_Spec.ts,
ClientSide/BugTests/JS_Bug28764_Spec.ts,
/ClientSide/BugTests/Bug29566_Spec.ts,
ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts)
- /Widgets/ListV2/Listv2_onItemClick_spec.js (toast validation updated
to ts helper)
- /Apps/MongoDBShoppingCart_spec.ts (Flaky fix 2nd case)
- /Regression/Apps/PromisesApp_spec.js (1st test)
- /ClientSide/OtherUIFeatures/ApplicationURL_spec.js (whole spec for
static wait removal + flaky fixes)
- /ClientSide/Templates/Fork_Template_spec.js (complete spec fixes,
cypress exception fix)
- /Sanity/Datasources/Arango_Basic_Spec.ts (3rd test)
- /ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (8th case flaky fix)
- /ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts (2nd
testcase, flow update)
- /ClientSide/OtherUIFeatures/Resize_spec.js (import update)
- /ClientSide/Templates/Fork_Template_spec.js (1st & 3rd for flaky fix,
removed 2nd - redundant check)
- /Git/GitSync/RepoLimitExceededErrorModal_spec.js flaky fix for EE repo
failure
- /ServerSide/ApiTests/API_Bugs_Spec.js (3rd case, removed waits, moved
to TED Api)
- /Apps/EchoApiCMS_spec.js (removed redundant action)
- /AppNavigation/Sidebar_spec.ts, /AppNavigation/TopInline_spec.ts,
/AppNavigation/TopStacked_spec.ts - added refresh calls for CI flakyness
- homePage.RenameWorkspace() & homePage.NavigateToHome() &
homePage.Signout() - removed static wait, added dynamic check
- homePage.CreateNewApplication() - removed static wait
- homePage.CreateAppInWorkspace() - removed commented code
- homePage.CreateNewWorkspace() - logic improved
- agHelper.AssertURL() - added timeout, removed static wait, calling
assertHelper.AssertDocumentReady()
- Few of agHelper methods timeout & error mesg text update
- cy.Signup() - updated validations
- agHelper.CheckForErrorToast() to agHelper.FailIfErrorToast() - method
name
- /ClientSide/BugTests/DSDiscardBugs_spec.ts - removed unnecessary
method call
#### 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 all changes were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Enhanced timeout handling across various helper methods for improved
stability.
- Streamlined interactions with UI elements using updated helper
methods.
- Adjusted test suites to utilize configuration values for consistency.
- **Tests**
- Temporarily disabled specific test suites to address current issues.
- Updated test assertions and interaction patterns for clarity and
reliability.
- Added new test cases and assertions to cover additional
functionalities.
- **Chores**
- Updated workflow variables for more efficient CI processes.
- Curated the list of limited tests to focus on critical test scenarios.
- **Documentation**
- Clarified test descriptions and intentions for better understanding.
- **Bug Fixes**
- Fixed UI element interactions to prevent test flakiness and improve
user experience.
- Implemented page refresh before application imports to ensure clean
state for tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-12 06:30:12 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._homeIcon);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.GetNClick(this._homeIcon, 0, true, 2500);
|
2023-06-15 13:21:11 +00:00
|
|
|
if (!Cypress.env("AIRGAPPED")) {
|
2024-01-25 13:41:48 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@getAllWorkspaces");
|
|
|
|
|
} else {
|
|
|
|
|
this.agHelper.Sleep(2000);
|
2023-06-15 13:21:11 +00:00
|
|
|
}
|
test: Cypress | Flaky fixes + Replacing static waits (#30067)
## Description
- This PR includes the flaky fixes of the below specs:
- jsEditor.NavigateToNewJSEditor() using TS helpers (Addressing
flakyness in specs /BugTests/JS_Bug29131_spec.ts,
BugTests/invalidLintError_Spec.ts,
ClientSide/BugTests/JS_Bug28764_Spec.ts,
/ClientSide/BugTests/Bug29566_Spec.ts,
ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts)
- /Widgets/ListV2/Listv2_onItemClick_spec.js (toast validation updated
to ts helper)
- /Apps/MongoDBShoppingCart_spec.ts (Flaky fix 2nd case)
- /Regression/Apps/PromisesApp_spec.js (1st test)
- /ClientSide/OtherUIFeatures/ApplicationURL_spec.js (whole spec for
static wait removal + flaky fixes)
- /ClientSide/Templates/Fork_Template_spec.js (complete spec fixes,
cypress exception fix)
- /Sanity/Datasources/Arango_Basic_Spec.ts (3rd test)
- /ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (8th case flaky fix)
- /ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts (2nd
testcase, flow update)
- /ClientSide/OtherUIFeatures/Resize_spec.js (import update)
- /ClientSide/Templates/Fork_Template_spec.js (1st & 3rd for flaky fix,
removed 2nd - redundant check)
- /Git/GitSync/RepoLimitExceededErrorModal_spec.js flaky fix for EE repo
failure
- /ServerSide/ApiTests/API_Bugs_Spec.js (3rd case, removed waits, moved
to TED Api)
- /Apps/EchoApiCMS_spec.js (removed redundant action)
- /AppNavigation/Sidebar_spec.ts, /AppNavigation/TopInline_spec.ts,
/AppNavigation/TopStacked_spec.ts - added refresh calls for CI flakyness
- homePage.RenameWorkspace() & homePage.NavigateToHome() &
homePage.Signout() - removed static wait, added dynamic check
- homePage.CreateNewApplication() - removed static wait
- homePage.CreateAppInWorkspace() - removed commented code
- homePage.CreateNewWorkspace() - logic improved
- agHelper.AssertURL() - added timeout, removed static wait, calling
assertHelper.AssertDocumentReady()
- Few of agHelper methods timeout & error mesg text update
- cy.Signup() - updated validations
- agHelper.CheckForErrorToast() to agHelper.FailIfErrorToast() - method
name
- /ClientSide/BugTests/DSDiscardBugs_spec.ts - removed unnecessary
method call
#### 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 all changes were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Enhanced timeout handling across various helper methods for improved
stability.
- Streamlined interactions with UI elements using updated helper
methods.
- Adjusted test suites to utilize configuration values for consistency.
- **Tests**
- Temporarily disabled specific test suites to address current issues.
- Updated test assertions and interaction patterns for clarity and
reliability.
- Added new test cases and assertions to cover additional
functionalities.
- **Chores**
- Updated workflow variables for more efficient CI processes.
- Curated the list of limited tests to focus on critical test scenarios.
- **Documentation**
- Clarified test descriptions and intentions for better understanding.
- **Bug Fixes**
- Fixed UI element interactions to prevent test flakiness and improve
user experience.
- Implemented page refresh before application imports to ensure clean
state for tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-12 06:30:12 +00:00
|
|
|
this.agHelper.WaitUntilEleAppear(this._homeAppsmithImage);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._newWorkSpaceLink);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.AssertElementExist(this._homePageContainer);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._homePageContainer);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-10-25 14:03:07 +00:00
|
|
|
public AssertApplicationCreated() {
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@createNewApplication", 201);
|
2023-10-25 14:03:07 +00:00
|
|
|
cy.get("@createNewApplication").then((interception: any) => {
|
|
|
|
|
localStorage.setItem("applicationId", interception.response.body.data.id);
|
|
|
|
|
localStorage.setItem("appName", interception.response.body.data.name);
|
|
|
|
|
cy.wrap(interception.response.body.data.name).as("appName");
|
|
|
|
|
cy.wrap(interception.response.body.data.id).as("applicationId");
|
|
|
|
|
});
|
2024-01-24 06:44:16 +00:00
|
|
|
// should resolve auditlog test case
|
|
|
|
|
cy.wait("@getConsolidatedData");
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.AssertElementAbsence(this.locator._loading);
|
|
|
|
|
}
|
2023-05-02 09:52:05 +00:00
|
|
|
|
2023-10-25 14:03:07 +00:00
|
|
|
public CreateNewApplication(skipSignposting = true) {
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.GetNClick(this._homePageAppCreateBtn, 0, true);
|
|
|
|
|
this.agHelper.GetNClick(this._newButtonCreateApplication, 0, true);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.AssertApplicationCreated();
|
2023-05-02 09:52:05 +00:00
|
|
|
if (skipSignposting) {
|
2024-08-28 06:10:24 +00:00
|
|
|
this.agHelper.WaitUntilEleDisappear(this.locator._btnSpinner);
|
2024-01-12 14:43:58 +00:00
|
|
|
AppSidebar.assertVisible();
|
|
|
|
|
this.agHelper.AssertElementVisibility(PageLeftPane.locators.selector);
|
2023-08-31 09:04:35 +00:00
|
|
|
this.onboarding.skipSignposting();
|
2023-05-02 09:52:05 +00:00
|
|
|
}
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("getWorkspace");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to CreateAppForWorkspace in command.js
|
2022-12-02 05:49:51 +00:00
|
|
|
public CreateAppInWorkspace(workspaceName: string, appname = "") {
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._existingWorkspaceCreateNewApp(workspaceName))
|
2023-07-25 12:27:16 +00:00
|
|
|
.last()
|
2022-06-15 15:37:41 +00:00
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.GetNClick(this._newButtonCreateApplication);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.AssertApplicationCreated();
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this.locator._sidebar);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.AssertElementAbsence(this.locator._loading);
|
2022-09-02 17:15:08 +00:00
|
|
|
if (appname) this.RenameApplication(appname);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2024-02-28 09:12:35 +00:00
|
|
|
public OpenTemplatesDialogInStartFromTemplates() {
|
|
|
|
|
this.agHelper.GetNClick(this._homePageAppCreateBtn, 0, true);
|
|
|
|
|
this.agHelper.GetNClick(this._newButtonCreateApplicationFromTemplates);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._createAppFromTemplatesDialog);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to AppSetupForRename in command.js
|
|
|
|
|
public RenameApplication(appName: string) {
|
2023-06-21 08:09:14 +00:00
|
|
|
this.onboarding.closeIntroModal();
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this._applicationName).then(($appName) => {
|
|
|
|
|
if (!$appName.hasClass(this._editAppName)) {
|
2023-07-12 13:31:17 +00:00
|
|
|
this.agHelper.GetNClick(this._applicationName);
|
2024-02-01 11:12:53 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._appMenu);
|
2023-11-30 00:41:59 +00:00
|
|
|
this.agHelper.GetNClickByContains(this._appMenu, "Rename");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
|
|
|
|
});
|
2023-07-12 20:11:11 +00:00
|
|
|
cy.get(this._applicationName).type(appName);
|
2023-07-12 13:31:17 +00:00
|
|
|
this.agHelper.PressEnter();
|
2024-02-01 11:12:53 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("updateApplication");
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.RemoveUIElement("Tooltip", "Rename application");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-12-02 05:49:51 +00:00
|
|
|
public GetAppName() {
|
|
|
|
|
return this.agHelper.GetText(this._applicationName, "text");
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to LogOut in command.js
|
|
|
|
|
public LogOutviaAPI() {
|
2023-11-20 11:14:18 +00:00
|
|
|
let httpMethod = "POST";
|
|
|
|
|
if (CURRENT_REPO === REPO.EE) {
|
|
|
|
|
httpMethod = "GET";
|
|
|
|
|
}
|
2023-03-15 10:02:24 +00:00
|
|
|
cy.request({
|
2023-11-20 11:14:18 +00:00
|
|
|
method: httpMethod,
|
2023-03-15 10:02:24 +00:00
|
|
|
url: "/api/v1/logout",
|
|
|
|
|
headers: {
|
|
|
|
|
"X-Requested-By": "Appsmith",
|
|
|
|
|
},
|
2023-08-10 07:06:03 +00:00
|
|
|
}).then((response) => {
|
|
|
|
|
expect(response.status).equal(200); //Verifying logout is success
|
2023-03-15 10:02:24 +00:00
|
|
|
});
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-02-22 06:01:25 +00:00
|
|
|
public Signout(toNavigateToHome = true) {
|
|
|
|
|
if (toNavigateToHome) this.NavigateToHome();
|
2023-02-14 19:42:45 +00:00
|
|
|
this.agHelper.GetNClick(this._profileMenu);
|
|
|
|
|
this.agHelper.GetNClick(this._signout);
|
2023-11-20 11:14:18 +00:00
|
|
|
//Logout is still a POST request in CE
|
|
|
|
|
if (CURRENT_REPO === REPO.CE) {
|
|
|
|
|
this.assertHelper.AssertNetworkStatus("@postLogout");
|
|
|
|
|
}
|
test: Cypress | Flaky fixes + Replacing static waits (#30067)
## Description
- This PR includes the flaky fixes of the below specs:
- jsEditor.NavigateToNewJSEditor() using TS helpers (Addressing
flakyness in specs /BugTests/JS_Bug29131_spec.ts,
BugTests/invalidLintError_Spec.ts,
ClientSide/BugTests/JS_Bug28764_Spec.ts,
/ClientSide/BugTests/Bug29566_Spec.ts,
ServerSide/JsFunctionExecution/JSFunctionExecution_spec.ts)
- /Widgets/ListV2/Listv2_onItemClick_spec.js (toast validation updated
to ts helper)
- /Apps/MongoDBShoppingCart_spec.ts (Flaky fix 2nd case)
- /Regression/Apps/PromisesApp_spec.js (1st test)
- /ClientSide/OtherUIFeatures/ApplicationURL_spec.js (whole spec for
static wait removal + flaky fixes)
- /ClientSide/Templates/Fork_Template_spec.js (complete spec fixes,
cypress exception fix)
- /Sanity/Datasources/Arango_Basic_Spec.ts (3rd test)
- /ServerSide/OnLoadTests/JSOnLoad2_Spec.ts (8th case flaky fix)
- /ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts (2nd
testcase, flow update)
- /ClientSide/OtherUIFeatures/Resize_spec.js (import update)
- /ClientSide/Templates/Fork_Template_spec.js (1st & 3rd for flaky fix,
removed 2nd - redundant check)
- /Git/GitSync/RepoLimitExceededErrorModal_spec.js flaky fix for EE repo
failure
- /ServerSide/ApiTests/API_Bugs_Spec.js (3rd case, removed waits, moved
to TED Api)
- /Apps/EchoApiCMS_spec.js (removed redundant action)
- /AppNavigation/Sidebar_spec.ts, /AppNavigation/TopInline_spec.ts,
/AppNavigation/TopStacked_spec.ts - added refresh calls for CI flakyness
- homePage.RenameWorkspace() & homePage.NavigateToHome() &
homePage.Signout() - removed static wait, added dynamic check
- homePage.CreateNewApplication() - removed static wait
- homePage.CreateAppInWorkspace() - removed commented code
- homePage.CreateNewWorkspace() - logic improved
- agHelper.AssertURL() - added timeout, removed static wait, calling
assertHelper.AssertDocumentReady()
- Few of agHelper methods timeout & error mesg text update
- cy.Signup() - updated validations
- agHelper.CheckForErrorToast() to agHelper.FailIfErrorToast() - method
name
- /ClientSide/BugTests/DSDiscardBugs_spec.ts - removed unnecessary
method call
#### 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 all changes were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Enhanced timeout handling across various helper methods for improved
stability.
- Streamlined interactions with UI elements using updated helper
methods.
- Adjusted test suites to utilize configuration values for consistency.
- **Tests**
- Temporarily disabled specific test suites to address current issues.
- Updated test assertions and interaction patterns for clarity and
reliability.
- Added new test cases and assertions to cover additional
functionalities.
- **Chores**
- Updated workflow variables for more efficient CI processes.
- Curated the list of limited tests to focus on critical test scenarios.
- **Documentation**
- Clarified test descriptions and intentions for better understanding.
- **Bug Fixes**
- Fixed UI element interactions to prevent test flakiness and improve
user experience.
- Implemented page refresh before application imports to ensure clean
state for tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-12 06:30:12 +00:00
|
|
|
this.agHelper.AssertURL("/login");
|
2024-02-01 11:12:53 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._username);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._submitBtn);
|
2023-02-14 19:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
2023-05-04 05:56:17 +00:00
|
|
|
public GotoProfileMenu() {
|
|
|
|
|
this.agHelper.GetNClick(this._profileMenu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public GotoEditProfile() {
|
|
|
|
|
cy.location().then((loc) => {
|
|
|
|
|
if (loc.pathname !== "/profile") {
|
|
|
|
|
this.NavigateToHome();
|
|
|
|
|
this.GotoProfileMenu();
|
|
|
|
|
this.agHelper.GetNClick(this._editProfileMenu);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-17 14:56:24 +00:00
|
|
|
public InvokeDispatchOnStore() {
|
|
|
|
|
cy.window().then((win: any) => {
|
|
|
|
|
if (win && win.store) {
|
|
|
|
|
cy.window()
|
|
|
|
|
.its("store")
|
|
|
|
|
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
|
|
|
|
|
} else {
|
|
|
|
|
// Handle the case where "store" is not present, or simply ignore and continue.
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
public LogintoApp(
|
|
|
|
|
uname: string,
|
|
|
|
|
pswd: string,
|
|
|
|
|
role: "App Viewer" | "Developer" | "Administrator" = "Administrator",
|
|
|
|
|
) {
|
|
|
|
|
this.agHelper.Sleep(); //waiting for window to load
|
2023-10-17 14:56:24 +00:00
|
|
|
this.InvokeDispatchOnStore();
|
2024-02-01 11:12:53 +00:00
|
|
|
this.assertHelper.WaitForNetworkCall("@postLogout");
|
2024-01-24 06:44:16 +00:00
|
|
|
this.agHelper.VisitNAssert("/user/login", "getConsolidatedData");
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._username);
|
2023-07-21 16:33:15 +00:00
|
|
|
this.agHelper.TypeText(this._username, uname);
|
|
|
|
|
this.agHelper.TypeText(this._password, pswd);
|
|
|
|
|
this.agHelper.GetNClick(this._submitBtn);
|
2024-01-24 06:44:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep(3000);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.AssertElementExist(this._homePageContainer);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._homePageContainer);
|
2023-07-21 16:33:15 +00:00
|
|
|
if (role != "App Viewer") {
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._homePageAppCreateBtn);
|
2023-07-21 16:33:15 +00:00
|
|
|
this.agHelper.AssertElementEnabledDisabled(
|
|
|
|
|
this._homePageAppCreateBtn,
|
|
|
|
|
undefined,
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2024-03-15 05:43:14 +00:00
|
|
|
public SignUp(
|
|
|
|
|
uname: string,
|
|
|
|
|
pswd: string,
|
|
|
|
|
skipToApplication: boolean = true,
|
|
|
|
|
) {
|
2024-02-08 11:25:58 +00:00
|
|
|
this.agHelper.VisitNAssert("/user/signup");
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this.signupUsername);
|
2024-02-01 11:12:53 +00:00
|
|
|
this.agHelper.AssertAttribute(this._submitBtn, "data-disabled", "true");
|
2023-07-21 16:33:15 +00:00
|
|
|
this.agHelper.TypeText(this.signupUsername, uname);
|
|
|
|
|
this.agHelper.TypeText(this._password, pswd);
|
2024-02-01 11:12:53 +00:00
|
|
|
this.agHelper.AssertAttribute(this._submitBtn, "data-disabled", "false");
|
|
|
|
|
this.agHelper.ClickButton("Sign up");
|
|
|
|
|
this.agHelper.WaitForCondition(() =>
|
|
|
|
|
cy.url().should("include", "signup-success"),
|
|
|
|
|
);
|
|
|
|
|
this.agHelper.WaitUntilEleAppear(SignupPageLocators.proficiencyGroupButton);
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElementLength(SignupPageLocators.proficiencyGroupButton)
|
|
|
|
|
.then(($len) => {
|
|
|
|
|
if ($len > 0) {
|
|
|
|
|
this.agHelper.GetNClick(SignupPageLocators.proficiencyGroupButton);
|
|
|
|
|
this.agHelper.GetNClick(SignupPageLocators.useCaseGroupButton);
|
|
|
|
|
this.agHelper.ClickButton("Get started");
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-03-15 05:43:14 +00:00
|
|
|
|
2024-04-03 05:31:05 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@getApplicationsOfWorkspace");
|
|
|
|
|
|
2024-03-15 05:43:14 +00:00
|
|
|
if (skipToApplication) {
|
|
|
|
|
this.agHelper.WaitUntilEleAppear(
|
|
|
|
|
this.onboarding.locators.skipStartFromData,
|
|
|
|
|
);
|
|
|
|
|
this.agHelper.GetNClick(this.onboarding.locators.skipStartFromData);
|
|
|
|
|
}
|
2024-01-24 06:44:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@getConsolidatedData");
|
2023-07-21 05:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-25 12:26:49 +00:00
|
|
|
public FilterApplication(
|
|
|
|
|
appName: string,
|
|
|
|
|
workspaceId?: string,
|
|
|
|
|
checkForShareButton = true,
|
|
|
|
|
) {
|
2023-05-11 18:45:06 +00:00
|
|
|
cy.get(this._searchInput).type(appName, { force: true });
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep(2000);
|
2024-01-25 13:41:48 +00:00
|
|
|
if (workspaceId) {
|
|
|
|
|
this.SelectWorkspace(workspaceId);
|
|
|
|
|
cy.get(this._appContainer).contains(workspaceId);
|
|
|
|
|
}
|
2023-07-25 12:26:49 +00:00
|
|
|
if (checkForShareButton) {
|
2023-08-21 07:49:28 +00:00
|
|
|
cy.xpath(this.locator._buttonByText("Share"))
|
|
|
|
|
.first()
|
|
|
|
|
.should("be.visible");
|
2023-07-25 12:26:49 +00:00
|
|
|
}
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-07-24 08:54:17 +00:00
|
|
|
/**
|
|
|
|
|
* Searches for given app name and clicks edit icon
|
|
|
|
|
* @param appName
|
|
|
|
|
*/
|
2024-01-25 13:41:48 +00:00
|
|
|
public SearchAndOpenApp(appName: string, ele?: string) {
|
|
|
|
|
this.agHelper.WaitUntilEleAppear(this._searchInput);
|
2023-07-24 08:54:17 +00:00
|
|
|
this.agHelper.TypeText(this._searchInput, appName);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.EditAppFromSearch(appName, ele);
|
2023-07-24 08:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to launchApp in command.js
|
2024-02-01 11:12:53 +00:00
|
|
|
public LaunchAppFromAppHover(element?: string) {
|
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
|
|
|
cy.get(this._appHoverIcon("view")).should("be.visible").first().click();
|
2023-07-04 16:33:31 +00:00
|
|
|
this.agHelper.AssertElementAbsence(this.locator._loading);
|
2024-01-24 06:44:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("getConsolidatedData");
|
2024-02-01 11:12:53 +00:00
|
|
|
this.AssertViewPageLoad(element);
|
2023-07-04 16:33:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-01-25 13:41:48 +00:00
|
|
|
public EditAppFromSearch(appName: string, element?: string) {
|
|
|
|
|
this.agHelper.WaitUntilEleAppear(`[data-testid="${appName}"]`);
|
|
|
|
|
this.agHelper.GetNClick(`[data-testid="${appName}"]`);
|
2024-04-23 05:05:57 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("getConsolidatedData");
|
2024-02-01 11:12:53 +00:00
|
|
|
this.AssertViewPageLoad(element);
|
|
|
|
|
this.deployHelper.NavigateBacktoEditor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AssertViewPageLoad(element?: string) {
|
2024-01-25 13:41:48 +00:00
|
|
|
cy.url({ timeout: Cypress.config().pageLoadTimeout }).should(
|
|
|
|
|
"not.include",
|
|
|
|
|
"edit",
|
|
|
|
|
);
|
2024-07-08 05:58:49 +00:00
|
|
|
this.agHelper.WaitUntilEleAppear(element ?? this.locator._backToEditor);
|
2024-02-02 10:31:59 +00:00
|
|
|
this.agHelper.AssertElementExist(this.deployHelper._deployPageWidgets);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this.deployHelper._deployPageWidgets);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this.deployHelper._appViewPageName);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.assertHelper.AssertDocumentReady();
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-17 14:56:24 +00:00
|
|
|
public EditAppFromAppHover(appName = "") {
|
|
|
|
|
if (appName)
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._appCard(appName))
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover");
|
2023-10-20 02:15:47 +00:00
|
|
|
else
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._applicationCard)
|
|
|
|
|
.first()
|
|
|
|
|
.trigger("mouseover");
|
2023-07-04 16:33:31 +00:00
|
|
|
this.agHelper.GetNClick(this._appHoverIcon("edit"));
|
|
|
|
|
this.agHelper.AssertElementAbsence(this.locator._loading);
|
|
|
|
|
this.assertHelper.AssertNetworkStatus("getWorkspace");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
//Maps to deleteUserFromWorkspace in command.js
|
2023-04-05 11:52:43 +00:00
|
|
|
public DeleteUserFromWorkspace(
|
|
|
|
|
appName: string,
|
|
|
|
|
workspaceName: string,
|
|
|
|
|
email: string,
|
|
|
|
|
) {
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this._workspaceList(workspaceName))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
2023-04-05 11:52:43 +00:00
|
|
|
this.FilterApplication(appName, workspaceName);
|
|
|
|
|
this.agHelper.GetNClick(this._optionsIcon).click({ force: true });
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.xpath(this._visibleTextSpan("Members")).click({ force: true });
|
|
|
|
|
cy.wait("@getMembers").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
2023-08-21 07:49:28 +00:00
|
|
|
this.agHelper.TypeText(this._searchUsersInput, email);
|
2023-04-05 11:52:43 +00:00
|
|
|
cy.wait(2000);
|
|
|
|
|
cy.get(HomePageLocators.DeleteBtn).first().click({ force: true });
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this._leaveWorkspaceConfirmModal).should("be.visible");
|
|
|
|
|
cy.get(this._leaveWorkspaceConfirmButton).click({ force: true });
|
2023-04-05 11:52:43 +00:00
|
|
|
cy.wait(4000);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
public OpenMembersPageForWorkspace(workspaceName: string) {
|
|
|
|
|
cy.get(this._appContainer)
|
|
|
|
|
.contains(workspaceName)
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
cy.get(this._appContainer)
|
|
|
|
|
.contains(workspaceName)
|
|
|
|
|
.closest(this._workspaceCompleteSection)
|
|
|
|
|
.find(this._optionsIcon)
|
|
|
|
|
.click({ force: true });
|
2022-08-22 17:57:07 +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
|
|
|
cy.xpath(this._visibleTextSpan("Members")).last().click({ force: true });
|
2024-02-01 11:12:53 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("getMembers");
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._membersTab);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
public UpdateUserRoleInWorkspace(
|
|
|
|
|
workspaceName: string,
|
|
|
|
|
email: string,
|
|
|
|
|
currentRole: string,
|
|
|
|
|
newRole: string,
|
|
|
|
|
) {
|
|
|
|
|
this.OpenMembersPageForWorkspace(workspaceName);
|
2023-08-21 07:49:28 +00:00
|
|
|
this.agHelper.TypeText(this._searchUsersInput, email);
|
2023-04-21 13:23:05 +00:00
|
|
|
cy.get(".search-highlight").should("exist").contains(email);
|
2023-02-22 06:01:25 +00:00
|
|
|
this.agHelper.Sleep(2000);
|
2022-12-10 08:30:28 +00:00
|
|
|
cy.xpath(this._userRoleDropDown(currentRole))
|
2022-06-15 15:37:41 +00:00
|
|
|
.first()
|
2022-09-02 17:15:08 +00:00
|
|
|
.click({ force: true });
|
2023-02-20 20:51:16 +00:00
|
|
|
this.agHelper.Sleep();
|
2022-06-15 15:37:41 +00:00
|
|
|
//cy.xpath(this._userRoleDropDown(email)).first().click({force: true});
|
2023-04-21 13:23:05 +00:00
|
|
|
if (CURRENT_REPO === REPO.EE) {
|
|
|
|
|
this.agHelper.AssertElementExist(
|
|
|
|
|
this._visibleTextSpan("Assign Custom Role"),
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-12-10 08:30:28 +00:00
|
|
|
cy.xpath(this._visibleTextSpan(`${newRole}`))
|
2022-06-15 15:37:41 +00:00
|
|
|
.last()
|
2023-02-22 06:01:25 +00:00
|
|
|
.parent("div")
|
|
|
|
|
.click();
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep();
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._userRoleDropDown(newRole));
|
2022-08-24 14:23:41 +00:00
|
|
|
this.NavigateToHome();
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-09-28 12:15:21 +00:00
|
|
|
public ImportApp(
|
|
|
|
|
fixtureJson: string,
|
|
|
|
|
intoWorkspaceName = "",
|
|
|
|
|
onlyImport = false,
|
|
|
|
|
) {
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.Sleep(3000); //for new workspace to settle for CI
|
2023-09-28 12:15:21 +00:00
|
|
|
if (onlyImport === false) {
|
|
|
|
|
cy.get(this._homeIcon).click({ force: true });
|
2024-01-25 13:41:48 +00:00
|
|
|
if (intoWorkspaceName) {
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._leftPanel)
|
|
|
|
|
.contains("span", intoWorkspaceName)
|
|
|
|
|
.click();
|
|
|
|
|
this.agHelper.GetNClick(this._newIcon);
|
|
|
|
|
} else this.agHelper.GetNClick(this._newIcon);
|
2023-09-28 12:15:21 +00:00
|
|
|
this.agHelper.GetNClick(this._workspaceImport, 0, true);
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._workspaceImportAppModal);
|
|
|
|
|
}
|
2023-05-24 12:30:39 +00:00
|
|
|
cy.xpath(this._uploadFile).selectFile("cypress/fixtures/" + fixtureJson, {
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
2024-05-10 13:50:40 +00:00
|
|
|
this.agHelper.WaitUntilEleDisappear(
|
|
|
|
|
HomePageLocators.workspaceImportAppModal,
|
|
|
|
|
);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.AssertElementAbsence(
|
2024-05-27 13:34:45 +00:00
|
|
|
this.locator._specificToast(
|
|
|
|
|
Cypress.env("MESSAGES").UNABLE_TO_IMPORT_APP(),
|
|
|
|
|
),
|
2023-10-25 14:03:07 +00:00
|
|
|
);
|
2022-07-29 08:48:25 +00:00
|
|
|
}
|
2023-05-24 14:01:33 +00:00
|
|
|
|
2023-07-11 16:39:13 +00:00
|
|
|
public ImportGitApp(intoWorkspaceName = "") {
|
|
|
|
|
this.NavigateToHome();
|
2024-01-25 13:41:48 +00:00
|
|
|
if (intoWorkspaceName) {
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._leftPanel)
|
|
|
|
|
.contains("span", intoWorkspaceName)
|
|
|
|
|
.click();
|
2024-02-09 04:52:47 +00:00
|
|
|
}
|
|
|
|
|
this.agHelper.GetNClick(this._newIcon);
|
2023-07-11 16:39:13 +00:00
|
|
|
this.agHelper.GetNClick(this._workspaceImport, 0, true);
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._workspaceImportAppModal);
|
2023-07-11 16:39:13 +00:00
|
|
|
this.agHelper.GetNClick(this._importFromGitBtn);
|
|
|
|
|
this.agHelper.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-24 14:01:33 +00:00
|
|
|
// Do not use this directly, it will fail on EE. Use `InviteUserToApplication` instead
|
2023-06-15 13:21:11 +00:00
|
|
|
private InviteUserToWorkspaceFromApp(
|
2023-05-23 11:09:05 +00:00
|
|
|
email: string,
|
|
|
|
|
role: string,
|
|
|
|
|
validate = true,
|
|
|
|
|
) {
|
2023-03-31 11:37:09 +00:00
|
|
|
const successMessage =
|
|
|
|
|
CURRENT_REPO === REPO.CE
|
|
|
|
|
? "The user has been invited successfully"
|
|
|
|
|
: "The user/group have been invited successfully";
|
2022-08-22 17:57:07 +00:00
|
|
|
this.StubPostHeaderReq();
|
2023-04-05 11:52:43 +00:00
|
|
|
this.agHelper.AssertElementExist(
|
2023-05-30 05:29:01 +00:00
|
|
|
"//span[text()='Users will have access to all applications in the workspace. For application-level access, try out our ']",
|
2023-04-05 11:52:43 +00:00
|
|
|
);
|
2024-05-17 07:49:32 +00:00
|
|
|
this.agHelper.AssertElementExist("//span[text()='business plan']");
|
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
|
|
|
cy.xpath(this._email).click({ force: true }).type(email);
|
|
|
|
|
cy.xpath(this._selectRole).first().click({ force: true });
|
2022-08-22 17:57:07 +00:00
|
|
|
this.agHelper.Sleep(500);
|
2022-12-10 08:30:28 +00:00
|
|
|
cy.xpath(this._userRole(role)).click({ force: true });
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.GetNClick(this._inviteButton, 0, true);
|
2022-08-22 17:57:07 +00:00
|
|
|
cy.wait("@mockPostInvite")
|
|
|
|
|
.its("request.headers")
|
|
|
|
|
.should("have.property", "origin", "Cypress");
|
2023-05-19 18:37:06 +00:00
|
|
|
// cy.contains(email, { matchCase: false });
|
2023-05-23 11:09:05 +00:00
|
|
|
if (validate) {
|
|
|
|
|
cy.contains(successMessage);
|
|
|
|
|
}
|
2022-08-22 17:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-31 11:37:09 +00:00
|
|
|
public InviteUserToApplicationFromApp(email: string, role: string) {
|
|
|
|
|
const successMessage = "The user/group have been invited successfully";
|
|
|
|
|
this.StubPostHeaderReq();
|
2023-04-05 11:52:43 +00:00
|
|
|
this.agHelper.AssertElementExist(
|
|
|
|
|
"//span[text()='Users will only have access to this application']",
|
|
|
|
|
);
|
2023-03-31 11:37:09 +00:00
|
|
|
cy.xpath(this._email).click({ force: true }).type(email);
|
|
|
|
|
cy.xpath(this._selectRole).first().click({ force: true });
|
|
|
|
|
this.agHelper.Sleep(500);
|
|
|
|
|
cy.xpath(this._userRole(role)).click({ force: true });
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.GetNClick(this._inviteButton, 0, true);
|
2023-03-31 11:37:09 +00:00
|
|
|
cy.wait("@mockPostAppInvite")
|
|
|
|
|
.its("request.headers")
|
|
|
|
|
.should("have.property", "origin", "Cypress");
|
2023-05-19 18:37:06 +00:00
|
|
|
// cy.contains(email, { matchCase: false });
|
2023-03-31 11:37:09 +00:00
|
|
|
cy.contains(successMessage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InviteUserToApplication(email: string, role: string) {
|
|
|
|
|
if (CURRENT_REPO === REPO.CE) {
|
|
|
|
|
this.InviteUserToWorkspaceFromApp(email, role);
|
|
|
|
|
} else {
|
|
|
|
|
this.InviteUserToApplicationFromApp(email, role);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-29 08:48:25 +00:00
|
|
|
public DeleteWorkspace(workspaceNameToDelete: string) {
|
2023-05-19 18:37:06 +00:00
|
|
|
cy.get(this._homeIcon).click({ force: true });
|
2024-01-25 13:41:48 +00:00
|
|
|
this.SelectWorkspace(workspaceNameToDelete);
|
|
|
|
|
this.agHelper.GetNClick(this._optionsIcon);
|
|
|
|
|
this.agHelper.GetNClick(this._wsAction("Delete workspace"));
|
|
|
|
|
this.agHelper.GetNClick(this._wsAction("Are you sure?"));
|
|
|
|
|
this.assertHelper.AssertNetworkStatus("deleteWorkspaceApiCall");
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-31 11:51:08 +00:00
|
|
|
|
2022-07-29 08:48:25 +00:00
|
|
|
public AssertNCloseImport() {
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._importSuccessModal);
|
|
|
|
|
this.agHelper.AssertElementVisibility(
|
2023-07-06 20:10:02 +00:00
|
|
|
this.locator._visibleTextSpan("Your application is ready to use."),
|
|
|
|
|
);
|
2023-08-30 10:54:37 +00:00
|
|
|
this.agHelper.ClickButton("Got it");
|
2022-07-29 08:48:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
public AssertImportToast(timeout = 5000) {
|
2024-05-27 13:34:45 +00:00
|
|
|
this.agHelper.AssertContains(
|
|
|
|
|
Cypress.env("MESSAGES").IMPORT_APP_SUCCESSFUL(),
|
|
|
|
|
);
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.Sleep(timeout); //for imported app to settle!
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this.locator._loading).should("not.exist");
|
|
|
|
|
}
|
2022-07-29 08:48:25 +00:00
|
|
|
|
2023-06-28 10:16:17 +00:00
|
|
|
public ForkApplication(appliName: string, forkWorkspaceName = "") {
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.GetNClick(this._applicationContextMenu(appliName));
|
|
|
|
|
this.agHelper.GetNClick(this._forkApp);
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._forkModal);
|
2023-06-28 10:16:17 +00:00
|
|
|
if (forkWorkspaceName) {
|
|
|
|
|
this.agHelper.GetNClick(this._forkWorkspaceDropdownOption);
|
|
|
|
|
this.agHelper.GetNClick(
|
|
|
|
|
this._forkWorkspaceSelectOptions(forkWorkspaceName),
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.ClickButton("Fork");
|
2023-06-21 19:33:36 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("getWorkspace");
|
2024-07-15 12:02:17 +00:00
|
|
|
this.agHelper.WaitUntilEleDisappear(this._forkModal);
|
2022-07-29 08:48:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DeleteApplication(appliName: string) {
|
|
|
|
|
this.agHelper.GetNClick(this._applicationContextMenu(appliName));
|
|
|
|
|
this.agHelper.GetNClick(this._deleteApp);
|
|
|
|
|
this.agHelper.GetNClick(this._deleteAppConfirm);
|
2024-01-22 11:52:01 +00:00
|
|
|
// Toast has been removed
|
|
|
|
|
// this.agHelper.WaitUntilToastDisappear("Deleting application...");
|
|
|
|
|
this.assertHelper.AssertNetworkStatus("@deleteApp", 200);
|
2022-07-29 08:48:25 +00:00
|
|
|
}
|
2022-10-13 12:14:39 +00:00
|
|
|
|
2023-10-10 12:33:51 +00:00
|
|
|
public DeleteAppviaAPI(appId: any) {
|
|
|
|
|
cy.request({
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
url: "api/v1/applications/" + appId,
|
|
|
|
|
failOnStatusCode: false,
|
|
|
|
|
headers: {
|
|
|
|
|
"X-Requested-By": "Appsmith",
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-13 12:14:39 +00:00
|
|
|
//Maps to leaveworkspace in command.js
|
2023-02-22 06:01:25 +00:00
|
|
|
public LeaveWorkspace(workspaceName: string) {
|
2023-05-19 18:37:06 +00:00
|
|
|
this.OpenWorkspaceOptions(workspaceName);
|
2024-01-25 13:41:48 +00:00
|
|
|
this.agHelper.GetNClick(this._leaveWorkspace, 0, true);
|
|
|
|
|
this.agHelper.GetNClick(this._leaveWorkspaceConfirm, 0, true);
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@leaveWorkspaceApiCall");
|
2023-06-15 13:21:11 +00:00
|
|
|
|
2022-12-02 05:49:51 +00:00
|
|
|
this.agHelper.ValidateToastMessage(
|
|
|
|
|
"You have successfully left the workspace",
|
|
|
|
|
);
|
2022-10-13 12:14:39 +00:00
|
|
|
}
|
2023-05-11 18:45:06 +00:00
|
|
|
|
|
|
|
|
public CloseReconnectDataSourceModal() {
|
|
|
|
|
cy.get("body").then(($ele) => {
|
|
|
|
|
if ($ele.find(this._reconnectDataSourceModal).length) {
|
|
|
|
|
this.agHelper.GetNClick(this._skiptoApplicationBtn);
|
|
|
|
|
this.NavigateToHome();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-01-25 13:41:48 +00:00
|
|
|
public SelectWorkspace(workspaceName: string, networkCallAlias = true) {
|
|
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._leftPanel)
|
|
|
|
|
.contains("span", workspaceName)
|
|
|
|
|
.click({ force: true });
|
|
|
|
|
networkCallAlias &&
|
|
|
|
|
this.assertHelper.AssertNetworkStatus("@getApplicationsOfWorkspace");
|
|
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
}
|