test: Cypress | CI Stabilize (#26934)

## Description
- This PR unskips JSOnload1_spec.ts & try in CI
- Improves the GraphQL methods to be more modular

#### Type of change
- Script update (non-breaking change which fixes an issue)

## Testing
#### How Has This Been Tested?
- [X] Cypress CI runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed
This commit is contained in:
Aishwarya-U-R 2023-09-04 19:00:21 +05:30 committed by GitHub
parent f24f5d4304
commit 9126927af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 12 deletions

View File

@ -112,7 +112,7 @@ describe("JSObjects OnLoad Actions tests", function () {
});
//Skipping due to - "tableData":"ERROR: invalid input syntax for type smallint: "{}""
it.skip("4. Tc 53 - Verify OnPage Load - Enabled & Disabling - Before Function calling for JSOBject", function () {
it("4. Tc 53 - Verify OnPage Load - Enabled & Disabling - Before Function calling for JSOBject", function () {
entityExplorer.SelectEntityByName(jsName as string, "Queries/JS");
jsEditor.EnableDisableAsyncFuncSettings("getEmployee", true, false);
//jsEditor.RunJSObj(); //Even running JS functin before delpoying does not help

View File

@ -230,6 +230,8 @@ describe("GraphQL Datasource Implementation", function () {
});
//Create Auth GraphQL to verify Delete operation
dataSources.NavigateToDSCreateNew();
dataSources.CreatePlugIn("Authenticated GraphQL API");
dataSources.CreateNFillAuthenticatedGraphQLDSForm(
datasourceName,
"Authorization",

View File

@ -7,6 +7,7 @@ export const DataSourceKVP = {
Mongo: "MongoDB",
MySql: "MySQL",
UnAuthenticatedGraphQL: "GraphQL API",
AuthenticatedGraph: "Authenticated GraphQL API",
MsSql: "Microsoft SQL Server",
Airtable: "Airtable",
ArangoDB: "ArangoDB",
@ -269,6 +270,9 @@ export class DataSources {
_s3MaxFileSizeAlert = "//p[@role='alert']";
_entityExplorerID = (dsName: string) =>
"[data-testid='t--entity-item-" + dsName + "']";
_stagingTab = "[data-testid='t--ds-data-filter-Staging']";
_graphQlDsFromRightPane = (dsName: string) =>
"//div/span[text() ='" + dsName + "']";
public AssertDSEditViewMode(mode: "Edit" | "View") {
if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton);
@ -683,31 +687,41 @@ export class DataSources {
public FillUnAuthenticatedGraphQLDSForm(
environment = this.dataManager.defaultEnviorment,
enterOrSelectUrl: "enter" | "select" = "enter",
dsNameToSelect = "",
) {
this.agHelper.GetNClick(this._createBlankGraphQL);
cy.get("@guid").then((uid) => {
this.agHelper.RenameWithInPane("GraphQL_API" + "_" + uid, true);
this.apiPage.EnterURL(
this.dataManager.dsValues[environment].GraphqlApiUrl_TED,
);
if (enterOrSelectUrl == "enter")
this.apiPage.EnterURL(
this.dataManager.dsValues[environment].GraphqlApiUrl_TED,
);
else if (enterOrSelectUrl == "select")
this.agHelper.GetNClick(this._graphQlDsFromRightPane(dsNameToSelect));
this.assertHelper.AssertNetworkStatus("@createNewApi", 201);
cy.wrap("GraphQL_API" + "_" + uid).as("dsName");
});
}
public FillAuthenticatedGrapgQLURL(
environment = this.dataManager.defaultEnviorment,
) {
this.agHelper.TypeText(
this.locator._inputFieldByName("URL") + "//" + this.locator._inputField,
this.dataManager.dsValues[environment].GraphqlApiUrl_TED,
);
}
public CreateNFillAuthenticatedGraphQLDSForm(
dataSourceName: string,
hKey: string,
hValue: string,
environment = this.dataManager.defaultEnviorment,
) {
this.NavigateToDSCreateNew();
this.CreatePlugIn("Authenticated GraphQL API");
this.agHelper.TypeText(
this.locator._inputFieldByName("URL") + "//" + this.locator._inputField,
this.dataManager.dsValues[environment].GraphqlApiUrl_TED,
);
this.FillAuthenticatedGrapgQLURL(environment);
this.agHelper.UpdateInputValue(this._graphQLHeaderKey, hKey);
this.agHelper.UpdateInputValue(this._graphQLHeaderValue, hValue);
@ -741,7 +755,7 @@ export class DataSources {
);
}
public fillTwilioDSForm(environment = this.dataManager.defaultEnviorment) {
public FillTwilioDSForm(environment = this.dataManager.defaultEnviorment) {
this.ValidateNSelectDropdown("Authentication type", "", "Basic auth");
this.agHelper.UpdateInputValue(
this._username,
@ -774,6 +788,7 @@ export class DataSources {
this.assertHelper.AssertNetworkStatus("@saveDatasource", 201);
if (!isSavingEnvInOldDS)
this.agHelper.AssertContains("datasource created");
else this.agHelper.AssertContains("datasource updated successfully");
} else {
this.assertHelper.AssertNetworkStatus("@updateDatasource", 200);
}
@ -1215,6 +1230,7 @@ export class DataSources {
| "Mongo"
| "MySql"
| "UnAuthenticatedGraphQL"
| "AuthenticatedGraph"
| "MsSql"
| "Airtable"
| "ArangoDB"
@ -1272,7 +1288,9 @@ export class DataSources {
else if (DataSourceKVP[dsType] == "Redis")
this.FillRedisDSForm(environment);
else if (DataSourceKVP[dsType] == "S3") this.FillS3DSForm();
else if (DataSourceKVP[dsType] == "Twilio") this.fillTwilioDSForm();
else if (DataSourceKVP[dsType] == "Twilio") this.FillTwilioDSForm();
else if (DataSourceKVP[dsType] == "Authenticated GraphQL API")
this.FillAuthenticatedGrapgQLURL();
if (testNSave) {
this.TestSaveDatasource();