2022-05-18 10:39:42 +00:00
|
|
|
import { ObjectsRegistry } from "../Objects/Registry";
|
2023-11-28 11:11:54 +00:00
|
|
|
import {
|
|
|
|
|
AppSidebar,
|
|
|
|
|
AppSidebarButton,
|
|
|
|
|
PageLeftPane,
|
|
|
|
|
PagePaneSegment,
|
|
|
|
|
} from "./EditorNavigation";
|
2024-05-10 05:04:53 +00:00
|
|
|
import * as _ from "../Objects/ObjectsCore";
|
2024-07-10 08:52:39 +00:00
|
|
|
import ApiEditor from "../../locators/ApiEditor";
|
2024-12-03 03:51:43 +00:00
|
|
|
import { PluginActionForm } from "./PluginActionForm";
|
2022-11-25 03:47:00 +00:00
|
|
|
|
|
|
|
|
type RightPaneTabs = "datasources" | "connections";
|
|
|
|
|
|
2022-01-06 15:06:17 +00:00
|
|
|
export class ApiPage {
|
2022-05-18 10:39:42 +00:00
|
|
|
public agHelper = ObjectsRegistry.AggregateHelper;
|
|
|
|
|
public locator = ObjectsRegistry.CommonLocators;
|
2023-06-18 04:55:16 +00:00
|
|
|
private assertHelper = ObjectsRegistry.AssertHelper;
|
2024-12-03 03:51:43 +00:00
|
|
|
private pluginActionForm = new PluginActionForm();
|
2022-05-18 10:39:42 +00:00
|
|
|
|
2023-12-05 05:50:36 +00:00
|
|
|
// private datasources = ObjectsRegistry.DataSources;
|
|
|
|
|
|
2024-02-13 11:49:13 +00:00
|
|
|
_createapi = ".t--createBlankApiCard";
|
2022-05-18 10:39:42 +00:00
|
|
|
private _headerKey = (index: number) =>
|
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
|
|
|
".t--actionConfiguration\\.headers\\[" +
|
|
|
|
|
index +
|
|
|
|
|
"\\]\\.key\\." +
|
|
|
|
|
index +
|
|
|
|
|
"";
|
2022-05-18 10:39:42 +00:00
|
|
|
private _headerValue = (index: number) =>
|
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
|
|
|
".t--actionConfiguration\\.headers\\[" +
|
|
|
|
|
index +
|
|
|
|
|
"\\]\\.value\\." +
|
|
|
|
|
index +
|
|
|
|
|
"";
|
2022-05-18 10:39:42 +00:00
|
|
|
private _paramKey = (index: number) =>
|
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
|
|
|
".t--actionConfiguration\\.queryParameters\\[" +
|
|
|
|
|
index +
|
|
|
|
|
"\\]\\.key\\." +
|
|
|
|
|
index +
|
|
|
|
|
"";
|
2023-05-03 07:08:39 +00:00
|
|
|
public _paramValue = (index: number) =>
|
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
|
|
|
".t--actionConfiguration\\.queryParameters\\[" +
|
|
|
|
|
index +
|
|
|
|
|
"\\]\\.value\\." +
|
|
|
|
|
index +
|
|
|
|
|
"";
|
2023-02-24 12:18:48 +00:00
|
|
|
private _importedKey = (index: number, keyValueName: string) =>
|
|
|
|
|
`.t--${keyValueName}-key-${index}`;
|
|
|
|
|
private _importedValue = (index: number, keyValueName: string) =>
|
|
|
|
|
`.t--${keyValueName}-value-${index}`;
|
2022-05-18 10:39:42 +00:00
|
|
|
_bodyKey = (index: number) =>
|
|
|
|
|
".t--actionConfiguration\\.bodyFormData\\[0\\]\\.key\\." + index + "";
|
|
|
|
|
_bodyValue = (index: number) =>
|
2023-08-10 13:55:06 +00:00
|
|
|
`.t--actionConfiguration\\.bodyFormData\\[${index}\\]\\.value\\.${index}`;
|
2022-05-18 10:39:42 +00:00
|
|
|
_bodyTypeDropdown =
|
2023-05-19 18:37:06 +00:00
|
|
|
"//span[text()='Type'][@class='rc-select-selection-placeholder']/ancestor::div";
|
2024-12-03 03:51:43 +00:00
|
|
|
_apiRunBtn = '[data-testid="t--run-action"]';
|
2022-05-18 10:39:42 +00:00
|
|
|
private _queryTimeout =
|
|
|
|
|
"//input[@name='actionConfiguration.timeoutInMillisecond']";
|
|
|
|
|
_responseBody = ".CodeMirror-code span.cm-string.cm-property";
|
2024-01-12 14:43:58 +00:00
|
|
|
private _blankAPI = "span:contains('REST API')";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _apiVerbDropdown = ".t--apiFormHttpMethod div";
|
2022-05-18 10:39:42 +00:00
|
|
|
private _verbToSelect = (verb: string) =>
|
2023-05-19 18:37:06 +00:00
|
|
|
"//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'" +
|
2022-05-18 10:39:42 +00:00
|
|
|
verb +
|
|
|
|
|
"')]";
|
2024-05-09 11:32:48 +00:00
|
|
|
private _bodyTypeSelect = `//div[@data-testid="t--api-body-tab-switch"]`;
|
|
|
|
|
private _bodyTypeToSelect = (subTab: string) =>
|
|
|
|
|
"//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'" +
|
|
|
|
|
subTab +
|
|
|
|
|
"')]";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _rightPaneTab = (tab: string) =>
|
|
|
|
|
"//span[contains(text(), '" + tab + "')]/parent::button";
|
2022-05-18 10:39:42 +00:00
|
|
|
_visibleTextSpan = (spanText: string) => "//span[text()='" + spanText + "']";
|
|
|
|
|
_visibleTextDiv = (divText: string) => "//div[text()='" + divText + "']";
|
|
|
|
|
_noBodyMessageDiv = "#NoBodyMessageDiv";
|
|
|
|
|
_noBodyMessage = "This request does not have a body";
|
|
|
|
|
_imageSrc = "//img/parent::div";
|
2023-05-19 18:37:06 +00:00
|
|
|
private _trashDelete = "[data-testid=t--trash-icon]";
|
2022-05-18 10:39:42 +00:00
|
|
|
private _onPageLoad = "input[name='executeOnLoad'][type='checkbox']";
|
2023-09-19 19:26:11 +00:00
|
|
|
private _confirmBeforeRunning =
|
2022-05-18 10:39:42 +00:00
|
|
|
"input[name='confirmBeforeExecute'][type='checkbox']";
|
2022-09-09 15:59:47 +00:00
|
|
|
private _paginationTypeLabels = ".t--apiFormPaginationType label";
|
2022-08-04 04:48:15 +00:00
|
|
|
_saveAsDS = ".t--store-as-datasource";
|
2022-09-13 05:02:59 +00:00
|
|
|
_responseStatus = ".t--response-status-code";
|
2024-10-08 10:42:27 +00:00
|
|
|
public _responseTabHeader = "[data-testid=t--tab-HEADERS_TAB]";
|
2024-05-10 05:04:53 +00:00
|
|
|
public _headersTabContent = ".t--headers-tab";
|
2023-02-24 12:18:48 +00:00
|
|
|
public _autoGeneratedHeaderInfoIcon = (key: string) =>
|
|
|
|
|
`.t--auto-generated-${key}-info`;
|
2023-08-10 13:55:06 +00:00
|
|
|
_nextCursorValue = ".t--apiFormPaginationNextCursorValue";
|
|
|
|
|
_fileOperation = "[data-testid='t--file-operation']";
|
|
|
|
|
_addMore = ".t--addApiHeader";
|
2023-07-29 00:42:08 +00:00
|
|
|
public _editorDS = ".t--datasource-editor";
|
2023-08-08 15:23:01 +00:00
|
|
|
public _addMoreHeaderFieldButton = ".t--addApiHeader";
|
2023-08-11 10:20:13 +00:00
|
|
|
public jsonBody = `.t--apiFormPostBody`;
|
2024-01-05 06:12:03 +00:00
|
|
|
private _entityName = ".t--entity-name";
|
2024-07-10 08:52:39 +00:00
|
|
|
private curlImport = ".t--datasoucre-create-option-new_curl_import";
|
|
|
|
|
private _curlTextArea =
|
|
|
|
|
"//label[text()='Paste CURL Code Here']/parent::form/div";
|
2022-05-18 10:39:42 +00:00
|
|
|
|
|
|
|
|
CreateApi(
|
2022-08-22 05:47:24 +00:00
|
|
|
apiName = "",
|
2022-05-18 10:39:42 +00:00
|
|
|
apiVerb: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" = "GET",
|
2023-03-10 11:39:06 +00:00
|
|
|
aftDSSaved = false,
|
2022-05-18 10:39:42 +00:00
|
|
|
) {
|
2023-12-05 05:50:36 +00:00
|
|
|
if (aftDSSaved) ObjectsRegistry.DataSources.CreateQueryAfterDSSaved();
|
2023-03-10 11:39:06 +00:00
|
|
|
else {
|
2023-11-30 00:41:59 +00:00
|
|
|
AppSidebar.navigate(AppSidebarButton.Editor);
|
2023-10-25 14:03:07 +00:00
|
|
|
this.agHelper.RemoveUIElement("EvaluatedPopUp");
|
2024-01-12 14:43:58 +00:00
|
|
|
PageLeftPane.switchSegment(PagePaneSegment.Queries);
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.GetHoverNClick(this.locator._createNew);
|
|
|
|
|
this.agHelper.GetNClick(this._blankAPI, 0, true);
|
2024-05-16 08:08:43 +00:00
|
|
|
this.agHelper.RemoveUIElement(
|
|
|
|
|
"Tooltip",
|
|
|
|
|
Cypress.env("MESSAGES").ADD_QUERY_JS_TOOLTIP(),
|
|
|
|
|
);
|
2023-03-10 11:39:06 +00:00
|
|
|
}
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@createNewApi", 201);
|
2022-05-18 10:39:42 +00:00
|
|
|
|
|
|
|
|
// cy.get("@createNewApi").then((response: any) => {
|
|
|
|
|
// expect(response.response.body.responseMeta.success).to.eq(true);
|
|
|
|
|
// cy.get(this.agHelper._actionName)
|
|
|
|
|
// .click()
|
|
|
|
|
// .invoke("text")
|
|
|
|
|
// .then((text) => {
|
|
|
|
|
// const someText = text;
|
|
|
|
|
// expect(someText).to.equal(response.response.body.data.name);
|
|
|
|
|
// });
|
|
|
|
|
// }); // to check if Api1 = Api1 when Create Api invoked
|
|
|
|
|
|
2024-01-05 06:12:03 +00:00
|
|
|
if (apiName) {
|
2024-12-03 03:51:43 +00:00
|
|
|
this.agHelper.RenameQuery(apiName);
|
2024-01-05 06:12:03 +00:00
|
|
|
this.agHelper.GetNAssertContains(this._entityName, apiName);
|
|
|
|
|
}
|
2024-12-03 03:51:43 +00:00
|
|
|
this.agHelper.AssertElementVisibility(ApiEditor.dataSourceField);
|
2022-05-18 10:39:42 +00:00
|
|
|
if (apiVerb != "GET") this.SelectAPIVerb(apiVerb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CreateAndFillApi(
|
|
|
|
|
url: string,
|
2022-08-22 05:47:24 +00:00
|
|
|
apiName = "",
|
2022-08-24 14:23:41 +00:00
|
|
|
queryTimeout = 10000,
|
2022-05-18 10:39:42 +00:00
|
|
|
apiVerb: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" = "GET",
|
2023-03-10 11:39:06 +00:00
|
|
|
aftDSSaved = false,
|
2024-02-08 11:25:58 +00:00
|
|
|
toVerifySave = true,
|
2022-05-18 10:39:42 +00:00
|
|
|
) {
|
2023-03-10 11:39:06 +00:00
|
|
|
this.CreateApi(apiName, apiVerb, aftDSSaved);
|
2024-02-08 11:25:58 +00:00
|
|
|
this.EnterURL(url, "", toVerifySave);
|
2024-05-16 08:08:43 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@saveAction", 200);
|
2023-06-08 09:09:19 +00:00
|
|
|
this.AssertRunButtonDisability();
|
2024-02-08 11:25:58 +00:00
|
|
|
if (queryTimeout != 10000) this.SetAPITimeout(queryTimeout, toVerifySave);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-08 09:09:19 +00:00
|
|
|
AssertRunButtonDisability(disabled = false) {
|
2023-06-29 06:50:07 +00:00
|
|
|
this.agHelper.AssertElementEnabledDisabled(this._apiRunBtn, 0, disabled);
|
2023-06-08 09:09:19 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-08 11:25:58 +00:00
|
|
|
EnterURL(url: string, evaluatedValue = "", toVerifySave = true) {
|
|
|
|
|
this.agHelper.EnterValue(
|
|
|
|
|
url,
|
|
|
|
|
{
|
2024-12-03 03:51:43 +00:00
|
|
|
propFieldName: ApiEditor.dataSourceField,
|
2024-02-08 11:25:58 +00:00
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
apiOrQuery: "api",
|
|
|
|
|
},
|
|
|
|
|
toVerifySave,
|
|
|
|
|
);
|
2024-01-05 06:12:03 +00:00
|
|
|
this.agHelper.Sleep(); //Is needed for the entered url value to be registered, else failing locally & CI
|
2024-02-08 11:25:58 +00:00
|
|
|
evaluatedValue && this.agHelper.VerifyEvaluatedValue(evaluatedValue);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 05:03:34 +00:00
|
|
|
EnterHeader(hKey: string, hValue: string, index = 0) {
|
2022-05-18 10:39:42 +00:00
|
|
|
this.SelectPaneTab("Headers");
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(hKey, {
|
2023-03-15 05:03:34 +00:00
|
|
|
propFieldName: this._headerKey(index),
|
2022-06-06 05:59:15 +00:00
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(hValue, {
|
2023-03-15 05:03:34 +00:00
|
|
|
propFieldName: this._headerValue(index),
|
2022-06-06 05:59:15 +00:00
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-05-18 10:39:42 +00:00
|
|
|
this.agHelper.AssertAutoSave();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-03 07:08:39 +00:00
|
|
|
EnterParams(pKey: string, pValue: string, index = 0, escape = true) {
|
2022-05-18 10:39:42 +00:00
|
|
|
this.SelectPaneTab("Params");
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(pKey, {
|
2023-03-15 05:03:34 +00:00
|
|
|
propFieldName: this._paramKey(index),
|
2022-06-06 05:59:15 +00:00
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(pValue, {
|
2023-03-15 05:03:34 +00:00
|
|
|
propFieldName: this._paramValue(index),
|
2022-06-06 05:59:15 +00:00
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2023-05-03 07:08:39 +00:00
|
|
|
if (escape) {
|
|
|
|
|
this.agHelper.PressEscape();
|
|
|
|
|
}
|
2022-05-18 10:39:42 +00:00
|
|
|
this.agHelper.AssertAutoSave();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EnterBodyFormData(
|
|
|
|
|
subTab: "FORM_URLENCODED" | "MULTIPART_FORM_DATA",
|
|
|
|
|
bKey: string,
|
|
|
|
|
bValue: string,
|
|
|
|
|
type = "",
|
|
|
|
|
toTrash = false,
|
|
|
|
|
) {
|
|
|
|
|
this.SelectPaneTab("Body");
|
|
|
|
|
this.SelectSubTab(subTab);
|
|
|
|
|
if (toTrash) {
|
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._trashDelete).first().click();
|
2022-05-18 10:39:42 +00:00
|
|
|
cy.xpath(this._visibleTextSpan("Add more")).click();
|
2022-03-31 11:51:08 +00:00
|
|
|
}
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(bKey, {
|
|
|
|
|
propFieldName: this._bodyKey(0),
|
|
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-05-18 10:39:42 +00:00
|
|
|
|
|
|
|
|
if (type) {
|
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._bodyTypeDropdown).eq(0).click();
|
2022-05-18 10:39:42 +00:00
|
|
|
cy.xpath(this._visibleTextDiv(type)).click();
|
2022-03-31 11:51:08 +00:00
|
|
|
}
|
2022-06-06 05:59:15 +00:00
|
|
|
this.agHelper.EnterValue(bValue, {
|
|
|
|
|
propFieldName: this._bodyValue(0),
|
|
|
|
|
directInput: true,
|
|
|
|
|
inputFieldName: "",
|
|
|
|
|
});
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-05-18 10:39:42 +00:00
|
|
|
this.agHelper.AssertAutoSave();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-09 15:59:47 +00:00
|
|
|
RunAPI(
|
|
|
|
|
toValidateResponse = true,
|
|
|
|
|
waitTimeInterval = 20,
|
|
|
|
|
validateNetworkAssertOptions?: { expectedPath: string; expectedRes: any },
|
|
|
|
|
) {
|
2022-08-24 14:23:41 +00:00
|
|
|
this.agHelper.GetNClick(this._apiRunBtn, 0, true, waitTimeInterval);
|
|
|
|
|
toValidateResponse &&
|
2023-08-21 07:49:28 +00:00
|
|
|
this.assertHelper.AssertNetworkExecutionSuccess("@postExecute");
|
2022-09-09 15:59:47 +00:00
|
|
|
|
|
|
|
|
// Asserting Network result
|
|
|
|
|
validateNetworkAssertOptions?.expectedPath &&
|
|
|
|
|
validateNetworkAssertOptions?.expectedRes &&
|
2023-06-15 13:21:11 +00:00
|
|
|
this.agHelper.AssertNetworkDataNestedProperty(
|
2022-09-09 15:59:47 +00:00
|
|
|
"@postExecute",
|
|
|
|
|
validateNetworkAssertOptions.expectedPath,
|
|
|
|
|
validateNetworkAssertOptions.expectedRes,
|
|
|
|
|
);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-08 11:25:58 +00:00
|
|
|
SetAPITimeout(timeout: number, toVerifySave = true) {
|
2024-12-03 03:51:43 +00:00
|
|
|
this.pluginActionForm.toolbar.toggleSettings();
|
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._queryTimeout).clear().type(timeout.toString(), { delay: 0 }); //Delay 0 to work like paste!
|
2024-02-08 11:25:58 +00:00
|
|
|
toVerifySave && this.agHelper.AssertAutoSave();
|
2022-05-18 10:39:42 +00:00
|
|
|
this.SelectPaneTab("Headers");
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-17 06:12:18 +00:00
|
|
|
ToggleOnPageLoadRun(enable = true || false) {
|
2024-12-03 03:51:43 +00:00
|
|
|
this.pluginActionForm.toolbar.toggleSettings();
|
2023-01-09 12:16:52 +00:00
|
|
|
if (enable) this.agHelper.CheckUncheck(this._onPageLoad, true);
|
|
|
|
|
else this.agHelper.CheckUncheck(this._onPageLoad, false);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-19 19:26:11 +00:00
|
|
|
ToggleConfirmBeforeRunning(enable = true || false) {
|
2024-12-03 03:51:43 +00:00
|
|
|
this.pluginActionForm.toolbar.toggleSettings();
|
2023-09-19 19:26:11 +00:00
|
|
|
if (enable) this.agHelper.CheckUncheck(this._confirmBeforeRunning, true);
|
|
|
|
|
else this.agHelper.CheckUncheck(this._confirmBeforeRunning, false);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SelectPaneTab(
|
|
|
|
|
tabName:
|
|
|
|
|
| "Headers"
|
|
|
|
|
| "Params"
|
|
|
|
|
| "Body"
|
|
|
|
|
| "Pagination"
|
|
|
|
|
| "Authentication"
|
2022-09-12 04:18:44 +00:00
|
|
|
| "Response"
|
|
|
|
|
| "Errors"
|
|
|
|
|
| "Logs"
|
2024-09-17 08:52:32 +00:00
|
|
|
| "Inspect entity"
|
|
|
|
|
| "Query",
|
2022-05-18 10:39:42 +00:00
|
|
|
) {
|
2022-08-27 12:40:11 +00:00
|
|
|
this.agHelper.PressEscape();
|
2022-09-07 18:25:55 +00:00
|
|
|
this.agHelper.GetNClick(this._visibleTextSpan(tabName), 0, true);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SelectSubTab(
|
|
|
|
|
subTabName:
|
|
|
|
|
| "NONE"
|
|
|
|
|
| "JSON"
|
|
|
|
|
| "FORM_URLENCODED"
|
|
|
|
|
| "MULTIPART_FORM_DATA"
|
fix: REST API multimedia file upload issue fixed (#32921)
## Description
If we use REST API action and file picker widget to upload any
multimedia files (image, audio, video, pdf, xlsx), The file upload would
be successful but file would get corrupted upon uploading. This was
happening because file picker widget encodes this file to base64 format,
and we were uploading this same base64 string using REST API url.
Instead we should have decoded this base64 and then uploaded the file to
retain the original contents of the file.
This PR fixes that issue by adding a new tab in body of the REST API
action called `binary`, once we select this tab, we get autogenerated
header for `Content-Type: application/octet-stream`, in this binary
input field we can then provide base64 encoded file contents, the server
then decodes the contents before triggering the respective REST API and
uploading the file.
### Steps to test the issue
1. Add a file picker widget on canvas
2. Select data format as `Base64`
3. Upload any of pdf, image, audio, video, xlsx in file picker
4. Create a REST API action using [Dropbox upload
API](https://www.dropbox.com/developers/documentation/http/documentation#files-upload)
5. Configure the API headers as mentioned in the documentation, also
configure file name in the header correctly
6. Go to body tab, select binary and file contents in input box using
binding like {{Filepicker1.files[0].data}}
7. Execute this API
8. Now go to your dropbox account and check the uploaded file, you
should be able to successfully preview it
Fixes #32378
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._
## Automation
/ok-to-test tags="@tag.Datasource"
### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8844375718>
> Commit: 3316290a4d7d77ae3f9d8969245c5f470ef1ab5c
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8844375718&attempt=1"
target="_blank">Click here!</a>
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added support for binary file uploads in API requests, including
handling of base64-encoded files.
- Expanded content type options to include a new "BINARY" type for API
requests.
- **Tests**
- Implemented new tests to verify the functionality of binary file
uploads with dynamic data binding.
- **Bug Fixes**
- Ensured correct handling and auto-generation of headers for binary
file types and form urlencoded data formats.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
2024-04-29 11:38:33 +00:00
|
|
|
| "BINARY"
|
2022-05-18 10:39:42 +00:00
|
|
|
| "RAW",
|
|
|
|
|
) {
|
2024-05-09 11:32:48 +00:00
|
|
|
this.agHelper.GetNClick(this._bodyTypeSelect);
|
2024-08-28 12:17:44 +00:00
|
|
|
this.agHelper.GetNClick(this._bodyTypeToSelect(subTabName));
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2022-11-25 03:47:00 +00:00
|
|
|
AssertRightPaneSelectedTab(tabName: RightPaneTabs) {
|
2023-05-19 18:37:06 +00:00
|
|
|
cy.xpath(this._rightPaneTab(tabName)).should(
|
|
|
|
|
"have.attr",
|
|
|
|
|
"aria-selected",
|
|
|
|
|
"true",
|
2022-11-25 03:47:00 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SelectRightPaneTab(tabName: RightPaneTabs) {
|
|
|
|
|
this.agHelper.GetNClick(this._rightPaneTab(tabName));
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-18 10:39:42 +00:00
|
|
|
ValidateQueryParams(param: { key: string; value: string }) {
|
|
|
|
|
this.SelectPaneTab("Params");
|
|
|
|
|
this.agHelper.ValidateCodeEditorContent(this._paramKey(0), param.key);
|
|
|
|
|
this.agHelper.ValidateCodeEditorContent(this._paramValue(0), param.value);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-08 15:23:01 +00:00
|
|
|
ValidateHeaderParams(header: { key: string; value: string }, index = 0) {
|
2022-05-18 10:39:42 +00:00
|
|
|
this.SelectPaneTab("Headers");
|
2023-08-08 15:23:01 +00:00
|
|
|
this.agHelper.ValidateCodeEditorContent(this._headerKey(index), header.key);
|
|
|
|
|
this.agHelper.ValidateCodeEditorContent(
|
|
|
|
|
this._headerValue(index),
|
|
|
|
|
header.value,
|
|
|
|
|
);
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-02-24 12:18:48 +00:00
|
|
|
ValidateImportedHeaderParams(
|
|
|
|
|
isAutoGeneratedHeader = false,
|
|
|
|
|
header: { key: string; value: string },
|
|
|
|
|
index = 0,
|
|
|
|
|
) {
|
|
|
|
|
let keyValueName = "Header";
|
|
|
|
|
if (isAutoGeneratedHeader) {
|
|
|
|
|
keyValueName = "autoGeneratedHeader";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.SelectPaneTab("Headers");
|
|
|
|
|
this.ValidateImportedKeyValueContent(
|
|
|
|
|
this._importedKey(index, keyValueName),
|
|
|
|
|
header.key,
|
|
|
|
|
);
|
|
|
|
|
this.ValidateImportedKeyValueContent(
|
|
|
|
|
this._importedValue(index, keyValueName),
|
|
|
|
|
header.value,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValidateImportedKeyValueContent(
|
|
|
|
|
selector: string,
|
|
|
|
|
contentToValidate: any,
|
|
|
|
|
) {
|
|
|
|
|
this.agHelper.GetNAssertElementText(
|
|
|
|
|
selector,
|
|
|
|
|
contentToValidate,
|
|
|
|
|
"have.text",
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValidateImportedKeyValueOverride(index: number, isOverriden = true) {
|
|
|
|
|
let assertion = "";
|
|
|
|
|
|
|
|
|
|
if (isOverriden) {
|
|
|
|
|
assertion = "have.css";
|
|
|
|
|
} else {
|
|
|
|
|
assertion = "not.have.css";
|
|
|
|
|
}
|
|
|
|
|
cy.get(this._importedKey(index, "autoGeneratedHeader")).should(
|
|
|
|
|
assertion,
|
|
|
|
|
"text-decoration",
|
2023-05-19 18:37:06 +00:00
|
|
|
"line-through solid rgb(76, 86, 100)",
|
2023-02-24 12:18:48 +00:00
|
|
|
);
|
|
|
|
|
cy.get(this._importedValue(index, "autoGeneratedHeader")).should(
|
|
|
|
|
assertion,
|
|
|
|
|
"text-decoration",
|
2023-05-19 18:37:06 +00:00
|
|
|
"line-through solid rgb(76, 86, 100)",
|
2023-02-24 12:18:48 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ValidateImportedHeaderParamsAbsence(
|
|
|
|
|
isAutoGeneratedHeader = false,
|
|
|
|
|
index = 0,
|
|
|
|
|
) {
|
|
|
|
|
let keyValueName = "Header";
|
|
|
|
|
if (isAutoGeneratedHeader) {
|
|
|
|
|
keyValueName = "autoGeneratedHeader";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.SelectPaneTab("Headers");
|
|
|
|
|
this.ValidateImportedKeyValueAbsence(
|
|
|
|
|
this._importedKey(index, keyValueName),
|
|
|
|
|
);
|
|
|
|
|
this.ValidateImportedKeyValueAbsence(
|
|
|
|
|
this._importedValue(index, keyValueName),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValidateImportedKeyValueAbsence(selector: string) {
|
|
|
|
|
this.agHelper.AssertElementAbsence(selector);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-18 10:39:42 +00:00
|
|
|
ReadApiResponsebyKey(key: string) {
|
2022-09-13 05:02:59 +00:00
|
|
|
let apiResp = "";
|
2022-05-18 10:39:42 +00:00
|
|
|
cy.get(this._responseBody)
|
|
|
|
|
.contains(key)
|
|
|
|
|
.siblings("span")
|
|
|
|
|
.invoke("text")
|
|
|
|
|
.then((text) => {
|
|
|
|
|
apiResp = `${text
|
2023-03-23 11:32:18 +00:00
|
|
|
.match(/"(.*)"/)?.[0]
|
2022-05-18 10:39:42 +00:00
|
|
|
.split('"')
|
|
|
|
|
.join("")} `;
|
|
|
|
|
cy.log("Key value in api response is :" + apiResp);
|
|
|
|
|
cy.wrap(apiResp).as("apiResp");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-19 13:59:15 +00:00
|
|
|
SwitchToResponseTab(tabIdentifier: string) {
|
|
|
|
|
cy.get(tabIdentifier).click();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-18 10:39:42 +00:00
|
|
|
public SelectAPIVerb(verb: "GET" | "POST" | "PUT" | "DELETE" | "PATCH") {
|
|
|
|
|
cy.get(this._apiVerbDropdown).click();
|
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._verbToSelect(verb)).should("be.visible").click();
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|
2022-09-09 15:59:47 +00:00
|
|
|
|
2023-06-09 08:18:59 +00:00
|
|
|
public AssertAPIVerb(verb: "GET" | "POST" | "PUT" | "DELETE" | "PATCH") {
|
|
|
|
|
this.agHelper.AssertText(this._apiVerbDropdown, "text", verb);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-13 05:02:59 +00:00
|
|
|
ResponseStatusCheck(statusCode: string) {
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._responseStatus);
|
2023-03-10 11:39:06 +00:00
|
|
|
this.agHelper.GetNAssertContains(this._responseStatus, statusCode);
|
2022-09-13 05:02:59 +00:00
|
|
|
}
|
2024-07-10 08:52:39 +00:00
|
|
|
|
2022-09-09 15:59:47 +00:00
|
|
|
public SelectPaginationTypeViaIndex(index: number) {
|
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._paginationTypeLabels).eq(index).click({ force: true });
|
2022-09-09 15:59:47 +00:00
|
|
|
}
|
2022-10-08 02:17:07 +00:00
|
|
|
|
2022-11-19 13:59:15 +00:00
|
|
|
CreateAndFillGraphqlApi(url: string, apiName = "", queryTimeout = 10000) {
|
2022-10-08 02:17:07 +00:00
|
|
|
this.CreateGraphqlApi(apiName);
|
|
|
|
|
this.EnterURL(url);
|
|
|
|
|
this.agHelper.AssertAutoSave();
|
2023-06-08 09:09:19 +00:00
|
|
|
this.AssertRunButtonDisability();
|
2022-10-08 02:17:07 +00:00
|
|
|
if (queryTimeout != 10000) this.SetAPITimeout(queryTimeout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CreateGraphqlApi(apiName = "") {
|
2024-01-12 14:43:58 +00:00
|
|
|
AppSidebar.navigate(AppSidebarButton.Editor);
|
|
|
|
|
PageLeftPane.switchSegment(PagePaneSegment.Queries);
|
|
|
|
|
PageLeftPane.switchToAddNew();
|
|
|
|
|
this.agHelper.GetNClickByContains(".ads-v2-listitem", "GraphQL API");
|
2023-06-18 04:55:16 +00:00
|
|
|
this.assertHelper.AssertNetworkStatus("@createNewApi", 201);
|
2022-10-08 02:17:07 +00:00
|
|
|
|
2024-12-03 03:51:43 +00:00
|
|
|
if (apiName) this.agHelper.RenameQuery(apiName);
|
|
|
|
|
cy.get(ApiEditor.dataSourceField).should("be.visible");
|
2022-10-08 02:17:07 +00:00
|
|
|
}
|
2023-06-05 09:33:51 +00:00
|
|
|
|
|
|
|
|
AssertEmptyHeaderKeyValuePairsPresent(index: number) {
|
2023-08-10 07:06:03 +00:00
|
|
|
this.agHelper.AssertElementVisibility(this._headerKey(index));
|
|
|
|
|
this.agHelper.AssertElementVisibility(this._headerValue(index));
|
2023-06-05 09:33:51 +00:00
|
|
|
}
|
2024-05-10 05:04:53 +00:00
|
|
|
|
|
|
|
|
DebugError() {
|
|
|
|
|
this.agHelper.GetNClick(this._responseTabHeader);
|
|
|
|
|
cy.get(this._headersTabContent).contains("Debug").click();
|
|
|
|
|
}
|
2024-07-10 08:52:39 +00:00
|
|
|
|
|
|
|
|
public FillCurlNImport(value: string) {
|
|
|
|
|
AppSidebar.navigate(AppSidebarButton.Editor);
|
|
|
|
|
PageLeftPane.switchSegment(PagePaneSegment.Queries);
|
|
|
|
|
PageLeftPane.switchToAddNew();
|
|
|
|
|
this.agHelper.GetNClick(this.curlImport);
|
|
|
|
|
this.ImportCurlNRun(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ImportCurlNRun(value: string) {
|
|
|
|
|
this.agHelper.UpdateTextArea(this._curlTextArea, value);
|
|
|
|
|
this.agHelper.Sleep(500); //Clicking import after value settled
|
|
|
|
|
cy.get(ApiEditor.curlImportBtn).click({ force: true });
|
|
|
|
|
cy.wait("@curlImport").should(
|
|
|
|
|
"have.nested.property",
|
|
|
|
|
"response.body.responseMeta.status",
|
|
|
|
|
201,
|
|
|
|
|
);
|
|
|
|
|
this.RunAPI();
|
|
|
|
|
}
|
2022-05-18 10:39:42 +00:00
|
|
|
}
|