2022-06-15 15:37:41 +00:00
|
|
|
import { ObjectsRegistry } from "../Objects/Registry";
|
2023-03-16 04:44:32 +00:00
|
|
|
import { REPO, CURRENT_REPO } from "../../fixtures/REPO";
|
2023-04-05 11:52:43 +00:00
|
|
|
import HomePageLocators from "../../locators/HomePage";
|
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 entityExplorer = ObjectsRegistry.EntityExplorer;
|
|
|
|
|
private onboarding = ObjectsRegistry.Onboarding;
|
2023-06-18 04:55:16 +00:00
|
|
|
private assertHelper = ObjectsRegistry.AssertHelper;
|
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";
|
2022-07-29 08:48:25 +00:00
|
|
|
private _optionsIconInWorkspace = (workspaceName: string) =>
|
|
|
|
|
"//span[text()='" +
|
|
|
|
|
workspaceName +
|
2023-05-19 18:37:06 +00:00
|
|
|
"']/ancestor::div[contains(@class, 't--workspace-section')]//button[contains(@class, 't--options-icon')]";
|
2023-06-15 13:21:11 +00:00
|
|
|
private _renameWorkspaceContainer = ".editable-text-container";
|
|
|
|
|
private _renameWorkspaceInput = ".t--workspace-rename-input input";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _workspaceList = (workspaceName: string) =>
|
|
|
|
|
".t--workspace-section:contains(" + workspaceName + ")";
|
|
|
|
|
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 + "']";
|
2023-06-15 13:21:11 +00:00
|
|
|
_newWorkSpaceLink = this._visibleTextSpan("New workspace") + "/ancestor::a";
|
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-05-19 18:37:06 +00:00
|
|
|
private _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-02-22 06:01:25 +00:00
|
|
|
_searchUsersInput = ".search-input";
|
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";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _appContainer = ".t--applications-container";
|
2023-04-12 17:08:55 +00:00
|
|
|
_homePageAppCreateBtn = this._appContainer + " .createnew";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _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";
|
|
|
|
|
_buildFromDataTableActionCard = "[data-testid='generate-app']";
|
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]";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _lastWorkspaceInHomePage =
|
|
|
|
|
"//div[contains(@class, 't--workspace-section')][last()]//span/span";
|
2023-05-19 18:37:06 +00:00
|
|
|
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]";
|
2022-06-15 15:37:41 +00:00
|
|
|
private _uploadFile = "//div/form/input";
|
2022-07-29 08:48:25 +00:00
|
|
|
private _importSuccessModal = ".t--import-app-success-modal";
|
|
|
|
|
private _forkModal = ".fork-modal";
|
|
|
|
|
private _importSuccessModalGotit = ".t--import-success-modal-got-it";
|
|
|
|
|
private _applicationContextMenu = (applicationName: string) =>
|
|
|
|
|
"//span[text()='" +
|
|
|
|
|
applicationName +
|
2023-05-19 18:37:06 +00:00
|
|
|
"']/ancestor::div[contains(@class, 't--application-card')]//button[@aria-haspopup='menu']";
|
|
|
|
|
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) =>
|
2023-05-19 18:37:06 +00:00
|
|
|
".ads-v2-menu__menu-item-children:contains('" + action + "')";
|
2022-12-29 11:31:10 +00:00
|
|
|
private _homeTab = ".t--apps-tab";
|
2023-03-10 06:55:13 +00:00
|
|
|
private _workSpaceByName = (wsName: string) =>
|
2023-06-15 13:21:11 +00:00
|
|
|
`//div[contains(@class, 't--applications-container')]//span[text()='${wsName}']`;
|
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')";
|
2022-12-29 11:31:10 +00:00
|
|
|
|
|
|
|
|
public SwitchToAppsTab() {
|
|
|
|
|
this.agHelper.GetNClick(this._homeTab);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
public CreateNewWorkspace(workspaceNewName: string) {
|
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);
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep(2000);
|
|
|
|
|
cy.xpath(this._lastWorkspaceInHomePage)
|
|
|
|
|
.first()
|
|
|
|
|
.then(($ele) => {
|
|
|
|
|
oldName = $ele.text();
|
|
|
|
|
cy.log("oldName is : " + oldName);
|
|
|
|
|
this.RenameWorkspace(oldName, workspaceNewName);
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
public OpenWorkspaceOptions(workspaceName: string) {
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper
|
|
|
|
|
.GetElement(this._workSpaceByName(workspaceName))
|
|
|
|
|
.last()
|
|
|
|
|
.closest(this._workspaceCompleteSection)
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.wait(1000) ///for scroll to finish & element to come to view
|
|
|
|
|
.find(this._optionsIcon)
|
|
|
|
|
.click({ force: true });
|
2023-05-19 18:37:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OpenWorkspaceSettings(workspaceName: string) {
|
|
|
|
|
this.OpenWorkspaceOptions(workspaceName);
|
|
|
|
|
this.agHelper.GetNClick(this._workspaceSettingOption);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-10 06:55:13 +00:00
|
|
|
public RenameWorkspace(oldName: string, newWorkspaceName: string) {
|
2023-06-15 13:21:11 +00:00
|
|
|
this.OpenWorkspaceOptions(oldName);
|
|
|
|
|
this.agHelper.GetNClick(this._renameWorkspaceContainer, 0, true);
|
|
|
|
|
this.agHelper.TypeText(this._renameWorkspaceInput, newWorkspaceName).blur();
|
2022-06-15 15:37:41 +00:00
|
|
|
this.agHelper.Sleep(2000);
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@updateWorkspace");
|
2023-03-10 06:55:13 +00:00
|
|
|
this.agHelper.AssertContains(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) {
|
|
|
|
|
cy.get(this._workspaceList(workspaceName))
|
|
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible");
|
|
|
|
|
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,
|
|
|
|
|
) {
|
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();
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.AssertElementVisible(this._workspaceList(workspaceName));
|
|
|
|
|
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();
|
|
|
|
|
this.agHelper.AssertElementVisible(this._workspaceList(workspaceName));
|
|
|
|
|
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() {
|
|
|
|
|
cy.get(this._homeIcon).click({ force: true });
|
2022-08-24 14:23:41 +00:00
|
|
|
this.agHelper.Sleep(2000);
|
2023-06-15 13:21:11 +00:00
|
|
|
if (!Cypress.env("AIRGAPPED")) {
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@getReleaseItems");
|
2023-06-15 13:21:11 +00:00
|
|
|
} else {
|
|
|
|
|
this.agHelper.Sleep(2000);
|
|
|
|
|
}
|
2022-06-15 15:37:41 +00:00
|
|
|
//cy.wait("@applications"); this randomly fails & introduces flakyness hence commenting!
|
2023-02-22 06:01:25 +00:00
|
|
|
this.agHelper.AssertElementVisible(this._homeAppsmithImage);
|
2022-06-15 15:37:41 +00:00
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-05-02 09:52:05 +00:00
|
|
|
public CreateNewApplication(skipSignposting = 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.get(this._homePageAppCreateBtn).first().click({ force: true });
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@createNewApplication", 201);
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this.locator._loading).should("not.exist");
|
2023-05-02 09:52:05 +00:00
|
|
|
|
|
|
|
|
if (skipSignposting) {
|
|
|
|
|
this.agHelper.AssertElementVisible(this.entityExplorer._entityExplorer);
|
|
|
|
|
this.onboarding.closeIntroModal();
|
|
|
|
|
this.onboarding.skipSignposting();
|
|
|
|
|
}
|
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 = "") {
|
2022-07-29 08:48:25 +00:00
|
|
|
cy.xpath(this._existingWorkspaceCreateNewApp(workspaceName))
|
2022-06-15 15:37:41 +00:00
|
|
|
.scrollIntoView()
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.click({ force: true });
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@createNewApplication", 201);
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this.locator._loading).should("not.exist");
|
|
|
|
|
this.agHelper.Sleep(2000);
|
2022-09-02 17:15:08 +00:00
|
|
|
if (appname) this.RenameApplication(appname);
|
2023-06-18 04:55:16 +00:00
|
|
|
//this.assertHelper.AssertNetworkStatus("@updateApplication", 200);
|
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 AppSetupForRename in command.js
|
|
|
|
|
public RenameApplication(appName: string) {
|
|
|
|
|
cy.get(this._applicationName).then(($appName) => {
|
|
|
|
|
if (!$appName.hasClass(this._editAppName)) {
|
|
|
|
|
cy.get(this._applicationName).click();
|
|
|
|
|
cy.get(this._appMenu)
|
2023-05-19 18:37:06 +00:00
|
|
|
.contains("Edit name", { matchCase: false })
|
2022-06-15 15:37:41 +00:00
|
|
|
.click();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
cy.get(this._applicationName).type(appName + "{enter}");
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.RemoveTooltip("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-03-15 10:02:24 +00:00
|
|
|
cy.request({
|
|
|
|
|
method: "POST",
|
|
|
|
|
url: "/api/v1/logout",
|
|
|
|
|
headers: {
|
|
|
|
|
"X-Requested-By": "Appsmith",
|
|
|
|
|
},
|
|
|
|
|
});
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.Sleep(2000); //for logout to complete - CI!
|
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-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@postLogout");
|
2023-02-14 19:42:45 +00:00
|
|
|
this.agHelper.Sleep(); //for logout to complete!
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
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
|
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.window().its("store").invoke("dispatch", { type: "LOGOUT_USER_INIT" });
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.wait("@postLogout");
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.VisitNAssert("/user/login", "signUpLogin");
|
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._username).should("be.visible").type(uname);
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this._password).type(pswd, { log: false });
|
|
|
|
|
cy.get(this._submitBtn).click();
|
|
|
|
|
cy.wait("@getMe");
|
|
|
|
|
this.agHelper.Sleep(3000);
|
|
|
|
|
if (role != "App Viewer")
|
|
|
|
|
cy.get(this._homePageAppCreateBtn)
|
|
|
|
|
.should("be.visible")
|
|
|
|
|
.should("be.enabled");
|
|
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
|
2023-05-30 09:24:38 +00:00
|
|
|
public FilterApplication(appName: string, workspaceId?: string) {
|
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);
|
2023-05-30 09:24:38 +00:00
|
|
|
workspaceId && cy.get(this._appContainer).contains(workspaceId);
|
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.locator._spanButton("Share")).first().should("be.visible");
|
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 launchApp in command.js
|
|
|
|
|
public LaunchAppFromAppHover() {
|
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();
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.get(this.locator._loading).should("not.exist");
|
|
|
|
|
cy.wait("@getPagesForViewApp").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
|
|
|
|
}
|
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-04-05 11:52:43 +00:00
|
|
|
this.agHelper.UpdateInput(this._searchUsersInput, email);
|
|
|
|
|
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 });
|
2022-06-15 15:37:41 +00:00
|
|
|
cy.wait("@getMembers").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
200,
|
|
|
|
|
);
|
2022-08-24 14:23:41 +00:00
|
|
|
this.agHelper.Sleep(2500);
|
2022-08-22 17:57:07 +00:00
|
|
|
//wait for members page to load!
|
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);
|
2022-08-22 17:57:07 +00:00
|
|
|
cy.log(workspaceName, email, currentRole);
|
2023-04-21 13:23:05 +00:00
|
|
|
this.agHelper.UpdateInput(this._searchUsersInput, email);
|
|
|
|
|
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-02-22 06:01:25 +00:00
|
|
|
this.agHelper.AssertElementVisible(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
|
|
|
|
2022-07-29 08:48:25 +00:00
|
|
|
public ImportApp(fixtureJson: string, intoWorkspaceName = "") {
|
2023-05-19 18:37:06 +00:00
|
|
|
cy.get(this._homeIcon).click({ force: true });
|
2022-07-29 08:48:25 +00:00
|
|
|
if (intoWorkspaceName)
|
|
|
|
|
this.agHelper.GetNClick(this._optionsIconInWorkspace(intoWorkspaceName));
|
|
|
|
|
else this.agHelper.GetNClick(this._optionsIcon);
|
|
|
|
|
this.agHelper.GetNClick(this._workspaceImport, 0, true);
|
|
|
|
|
this.agHelper.AssertElementVisible(this._workspaceImportAppModal);
|
2023-05-24 12:30:39 +00:00
|
|
|
cy.xpath(this._uploadFile).selectFile("cypress/fixtures/" + fixtureJson, {
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.Sleep(3500);
|
|
|
|
|
}
|
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
|
|
|
);
|
2023-05-30 05:29:01 +00:00
|
|
|
this.agHelper.AssertElementExist("//span[text()='business edition']");
|
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 });
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.GetNClick(
|
|
|
|
|
this._optionsIconInWorkspace(workspaceNameToDelete),
|
|
|
|
|
);
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.GetNClick(this._wsAction("Delete workspace")); //Are you sure?
|
2022-07-29 08:48:25 +00:00
|
|
|
this.agHelper.GetNClick(this._wsAction("Are you sure?")); //
|
2022-08-24 14:23:41 +00:00
|
|
|
this.agHelper.AssertContains("Workspace deleted successfully");
|
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() {
|
|
|
|
|
this.agHelper.AssertElementVisible(this._importSuccessModal);
|
|
|
|
|
this.agHelper.GetNClick(this._importSuccessModalGotit, 0, true);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
public AssertImportToast(timeout = 5000) {
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.AssertContains("Application imported successfully");
|
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
|
|
|
|
|
|
|
|
public ForkApplication(appliName: string) {
|
|
|
|
|
this.agHelper.GetNClick(this._applicationContextMenu(appliName));
|
|
|
|
|
this.agHelper.GetNClick(this._forkApp);
|
|
|
|
|
this.agHelper.AssertElementVisible(this._forkModal);
|
2023-05-19 18:37:06 +00:00
|
|
|
this.agHelper.ClickButton("Fork");
|
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);
|
2023-06-17 08:23:03 +00:00
|
|
|
this.agHelper.WaitUntilToastDisappear("Deleting application...");
|
2022-07-29 08:48:25 +00:00
|
|
|
}
|
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);
|
2022-10-13 12:14:39 +00:00
|
|
|
cy.xpath(this._leaveWorkspace).click({ force: true });
|
|
|
|
|
cy.xpath(this._leaveWorkspaceConfirm).click({ force: 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();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-03-02 16:54:43 +00:00
|
|
|
}
|