Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update response tab UI #37352

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cb597f4
chore: update tabs paddings
alex-golovanov Nov 11, 2024
d28b531
chore: update button text
alex-golovanov Nov 11, 2024
52654af
feat: add response type selector icons
alex-golovanov Nov 12, 2024
94d376d
feat: change selector to menu & update spacing/layout
alex-golovanov Nov 12, 2024
ccacb12
feat: adjust sizing & spacing
alex-golovanov Nov 12, 2024
ee36111
Merge branch 'release' into feat/35290-update-response-tab-ui
alex-golovanov Nov 12, 2024
cf838f4
chore: remove test condition
alex-golovanov Nov 13, 2024
c755b34
chore: add common constants
alex-golovanov Nov 13, 2024
3c6a107
feat: update design
alex-golovanov Nov 13, 2024
57792a2
feat: update design & switch to minWtidth
alex-golovanov Nov 13, 2024
d78847f
chore: switch to common tab bar height & update type
alex-golovanov Nov 13, 2024
70c4e99
chore: correct size & fix potential bug
alex-golovanov Nov 13, 2024
2ecd266
fix: switch from hook&refs to direct event handlers
alex-golovanov Nov 13, 2024
c741a2f
fix: account for scrollbar width
alex-golovanov Nov 14, 2024
7df6776
chore: add status bar for error state
alex-golovanov Nov 14, 2024
87d79d5
Merge branch 'release' into feat/35290-update-response-tab-ui
alex-golovanov Nov 18, 2024
041e7b6
chore: fix response type selector tests
alex-golovanov Nov 18, 2024
693df86
Merge branch 'release' into feat/35290-update-response-tab-ui
alex-golovanov Nov 18, 2024
fa3ede6
chore: test fixes
alex-golovanov Nov 19, 2024
66f044b
test: add record count test
alex-golovanov Nov 19, 2024
9a4fbbe
fix: added default record count of 1 for cud operations
alex-golovanov Nov 20, 2024
a1f02f4
feat: add record checking & improve content type checking
alex-golovanov Nov 20, 2024
fe16e7d
chore: fix unit tests
alex-golovanov Nov 20, 2024
7ce1bd4
chore: remove detached tests
alex-golovanov Nov 20, 2024
97ada3d
chore: change record count params
alex-golovanov Nov 20, 2024
9d827b7
fix: make operator optional & add a default
alex-golovanov Nov 21, 2024
2f3e880
chore: update conditions
alex-golovanov Nov 21, 2024
3f1d3f2
chore: update message
alex-golovanov Nov 21, 2024
7bb20a6
chore: uncomment
alex-golovanov Nov 21, 2024
11f5301
Merge branch 'release' into feat/35290-update-response-tab-ui
alex-golovanov Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ describe(
EditorNavigation.SelectEntityByName(queryName, EntityType.Query);

BottomPane.response.switchToResponseTab();

BottomPane.response.openResponseTypeMenu();
agHelper.AssertElementVisibility(
BottomPane.response.getResponseTypeSelector("TABLE"),
BottomPane.response.locators.responseTypeMenuItem("TABLE"),
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@ describe(
//Add HSET
dataSources.CreateQueryAfterDSSaved();
dataSources.EnterQuery(hSetReceipe);
dataSources.RunQueryNVerifyResponseViews(1); //verify all views are returned!
dataSources.runQueryAndVerifyResponseViews(1); //verify all views are returned!
dataSources.AssertQueryTableResponse(0, "4"); //Success response for 4 keys inserted via above HSET!

//Read only one key from above HSET
dataSources.EnterQuery(hGetKeys);
dataSources.RunQueryNVerifyResponseViews(1); //verify all views are returned!
dataSources.runQueryAndVerifyResponseViews(1); //verify all views are returned!
dataSources.AssertQueryTableResponse(0, "Vegetable Stir Fry");

//Read more than one key from above HSET
dataSources.EnterQuery(hMGet);
dataSources.RunQueryNVerifyResponseViews(2);
dataSources.runQueryAndVerifyResponseViews(2);
dataSources.AssertQueryTableResponse(0, "easy");
dataSources.AssertQueryTableResponse(1, "Vegetable Stir Fry");

//Update key value in HSET
dataSources.EnterQuery(hUpdate);
dataSources.RunQueryNVerifyResponseViews(1); //verify all views are returned!
dataSources.runQueryAndVerifyResponseViews(1); //verify all views are returned!

//validate updated key
dataSources.EnterQuery(getUpdatedKey);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);
dataSources.AssertQueryTableResponse(0, "medium");

//Get All keys from HSET
dataSources.EnterQuery(getAll);
dataSources.RunQueryNVerifyResponseViews(8); //4 keys, 4 values
dataSources.runQueryAndVerifyResponseViews(8); //4 keys, 4 values
dataSources.ReadQueryTableResponse(0).then(($cellData: any) => {
expect($cellData).to.be.oneOf([
"name",
Expand All @@ -70,11 +70,11 @@ describe(

//Ading one more key/value to HSET
dataSources.EnterQuery(addNewKeyValue);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);

//Verify new key/value also added to HSET
dataSources.EnterQuery(getAll);
dataSources.RunQueryNVerifyResponseViews(10); //5 keys, 5 values
dataSources.runQueryAndVerifyResponseViews(10); //5 keys, 5 values
dataSources.ReadQueryTableResponse(0).then(($cellData: any) => {
expect($cellData).to.be.oneOf([
"name",
Expand All @@ -87,11 +87,11 @@ describe(

//Deleting the Hash key
dataSources.EnterQuery(deletehKey);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);

//Verify Deletion is success
dataSources.EnterQuery(hGetKeys);
dataSources.RunQueryNVerifyResponseViews(); //5 keys, 5 values
dataSources.runQueryAndVerifyResponseViews(); //5 keys, 5 values
dataSources.AssertQueryTableResponse(0, "null");

// Delete the query & datasource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe(
agHelper.FocusElement(locators._codeMirrorTextArea);
//agHelper.VerifyEvaluatedValue(tableCreateQuery); //failing sometimes!

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
dataSources.AssertTableInVirtuosoList(dsName, "productlines");

agHelper.ActionContextMenuWithInPane({
Expand Down Expand Up @@ -279,7 +279,7 @@ describe(
agHelper.FocusElement(locators._codeMirrorTextArea);
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
dataSources.AssertTableInVirtuosoList(dsName, "Stores", false);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe(
agHelper.FocusElement(locators._codeMirrorTextArea);
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
dataSources.AssertTableInVirtuosoList(dsName, "Stores");
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved

agHelper.ActionContextMenuWithInPane({
Expand All @@ -79,7 +79,7 @@ describe(

it("2. Validate Select record from Postgress datasource & verify query response", () => {
dataSources.CreateQueryForDS(dsName, "SELECT * FROM Stores LIMIT 10");
dataSources.RunQueryNVerifyResponseViews(10);
dataSources.runQueryAndVerifyResponseViews(10);
dataSources.AssertQueryTableResponse(5, "2112");
dataSources.AssertQueryTableResponse(6, "Mike's Liquors");
// Commenting this deletion of query to make the generate crud work on the new page instead of the current page
Expand Down Expand Up @@ -375,7 +375,7 @@ describe(
agHelper.FocusElement(locators._codeMirrorTextArea);
//agHelper.VerifyEvaluatedValue(tableCreateQuery);

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
dataSources.AssertTableInVirtuosoList(dsName, "Stores", false);

agHelper.ActionContextMenuWithInPane({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe(
agHelper.FocusElement(locators._codeMirrorTextArea);
//agHelper.VerifyEvaluatedValue(tableCreateQuery); //failing sometimes!

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
});

it("2. Validate Select record from Postgress datasource & verify query response", () => {
Expand All @@ -70,7 +70,7 @@ describe(
"public.vessels",
"Select",
);
dataSources.RunQueryNVerifyResponseViews(10);
dataSources.runQueryAndVerifyResponseViews(10);
dataSources.AssertQueryTableResponse(0, "371681");
dataSources.AssertQueryTableResponse(6, "Passenger");
agHelper.ActionContextMenuWithInPane({
Expand Down Expand Up @@ -617,7 +617,7 @@ describe(
dataSources.CreateQueryForDS(dsName, deleteTblQuery, "DropVessels");
agHelper.FocusElement(locators._codeMirrorTextArea);

dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
dataSources.AssertTableInVirtuosoList(dsName, "public.vessels", false);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ describe(
//Validating use of extention
query = `CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "pgcrypto"`;
dataSources.CreateQueryForDS(dsName, query, "verifyUUIDFunctions");
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);
dataSources.AssertQueryResponseHeaders(["affectedRows"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("0");
Expand Down Expand Up @@ -297,7 +297,7 @@ describe(
//Validating Addition of new column taking default value form package method
query = `ALTER TABLE uuidtype ADD COLUMN newUUID uuid DEFAULT uuid_generate_v4();`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);
dataSources.AssertQueryResponseHeaders(["affectedRows"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("0");
Expand All @@ -314,7 +314,7 @@ describe(
//Validating altering the new column default value to generate id from pgcrypto package
query = `ALTER TABLE uuidtype ALTER COLUMN newUUID SET DEFAULT gen_random_uuid();`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);
dataSources.AssertQueryResponseHeaders(["affectedRows"]);
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
expect($cellData).to.eq("0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ describe(
"Find",
);
dataSources.ValidateNSelectDropdown("Command", "Find document(s)");
dataSources.RunQueryNVerifyResponseViews(1, false);
dataSources.runQueryAndVerifyResponseViews(1, false);
agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: entityItems.Query,
Expand All @@ -352,7 +352,7 @@ describe(
directInput: false,
inputFieldName: "Query",
});
dataSources.RunQueryNVerifyResponseViews(1, false);
dataSources.runQueryAndVerifyResponseViews(1, false);
agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: entityItems.Query,
Expand Down Expand Up @@ -738,7 +738,7 @@ describe(
"Aggregate",
);
dataSources.ValidateNSelectDropdown("Command", "Aggregate");
dataSources.RunQueryNVerifyResponseViews(7, false);
dataSources.runQueryAndVerifyResponseViews(7, false);
agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: entityItems.Query,
Expand Down Expand Up @@ -899,7 +899,7 @@ describe(
"Find",
);
dataSources.ValidateNSelectDropdown("Command", "Find document(s)");
dataSources.RunQueryNVerifyResponseViews(4, false);
dataSources.runQueryAndVerifyResponseViews(4, false);
agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: entityItems.Query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe(
"List files",
);

dataSources.RunQueryNVerifyResponseViews(100);
dataSources.runQueryAndVerifyResponseViews(100);
agHelper.ActionContextMenuWithInPane({
action: "Delete",
entityType: entityItems.Query,
Expand Down Expand Up @@ -191,8 +191,7 @@ describe(
cy.typeValueNValidate(fileName, formControls.s3ListPrefix);
dataSources.RunQuery({ toValidateResponse: false });

BottomPane.response.switchResponseType("TABLE");
BottomPane.response.switchResponseType("JSON");
BottomPane.response.selectResponseResponseTypeFromMenu("JSON");
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved

cy.wait("@postExecute").then(({ response }) => {
expect(response.body.data.isExecutionSuccess).to.eq(true);
Expand Down
10 changes: 5 additions & 5 deletions app/client/cypress/e2e/Sanity/Datasources/Arango_Basic_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ if (CURRENT_REPO == REPO.CE) {
}
INTO ${collectionName}`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved
dataSources.AssertQueryResponseHeaders([
"writesExecuted",
"writesIgnored",
Expand All @@ -232,7 +232,7 @@ if (CURRENT_REPO == REPO.CE) {
FILTER place.type == "Natural"
RETURN { country: doc.country, name: place.name }`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews(5); //Verify all records are filtered
dataSources.runQueryAndVerifyResponseViews(5); //Verify all records are filtered
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved
dataSources.AssertQueryTableResponse(0, "Japan");
dataSources.AssertQueryTableResponse(1, "Mount Fuji");
dataSources.AssertQueryTableResponse(6, "Brazil"); //Widget binding is verified here
Expand Down Expand Up @@ -265,7 +265,7 @@ if (CURRENT_REPO == REPO.CE) {
}
IN ${collectionName}`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews();
dataSources.runQueryAndVerifyResponseViews();

dataSources.createQueryWithDatasourceSchemaTemplate(
dsName,
Expand All @@ -276,7 +276,7 @@ if (CURRENT_REPO == REPO.CE) {
FILTER document._key == "1"
RETURN document`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews(1);
dataSources.runQueryAndVerifyResponseViews(1);
dataSources.AssertQueryTableResponse(3, "Australia");

//Delete record from collection
Expand All @@ -287,7 +287,7 @@ if (CURRENT_REPO == REPO.CE) {
);
query = `REMOVE "1" in ${collectionName}`;
dataSources.EnterQuery(query);
dataSources.RunQueryNVerifyResponseViews(1); //Removing Australia
dataSources.runQueryAndVerifyResponseViews(1); //Removing Australia

//Verify no records return for the deleted key
query = `FOR document IN ${collectionName}
Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe(
'SELECT * FROM public."users" LIMIT 10;',
);

dataSources.RunQueryNVerifyResponseViews(); //minimum 1 rows are expected
dataSources.runQueryAndVerifyResponseViews(); //minimum 1 rows are expected
AppSidebar.navigate(AppSidebarButton.Data);
dataSources
.getDatasourceListItemDescription(mockDBName)
Expand All @@ -57,7 +57,7 @@ describe(
expect(interception.request.body.source).to.equal("SELF");
});

dataSources.RunQueryNVerifyResponseViews(); //minimum 1 rows are expected
dataSources.runQueryAndVerifyResponseViews(); //minimum 1 rows are expected
AppSidebar.navigate(AppSidebarButton.Data);
dataSources
.getDatasourceListItemDescription(mockDBName)
Expand Down
24 changes: 24 additions & 0 deletions app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ export class DataSources {
this.assertHelper.AssertNetworkStatus("@saveAction", 200);
}

/** @deprecated */
public RunQueryNVerifyResponseViews(
expectedRecordsCount = 1,
tableCheck = true,
Expand All @@ -1149,6 +1150,29 @@ export class DataSources {
BottomPane.response.getResponseTypeSelector("RAW"),
);
}
}

public runQueryAndVerifyResponseViews(
expectedRecordsCount = 1,
tableCheck = true,
) {
this.RunQuery();
if (tableCheck) {
BottomPane.response.openResponseTypeMenu();

this.agHelper.AssertElementVisibility(
BottomPane.response.locators.responseTypeMenuItem("TABLE"),
);
this.agHelper.AssertElementVisibility(
BottomPane.response.locators.responseTypeMenuItem("JSON"),
);
this.agHelper.AssertElementVisibility(
BottomPane.response.locators.responseTypeMenuItem("RAW"),
);

BottomPane.response.closeResponseTypeMenu();
}

BottomPane.response.validateRecordCount(expectedRecordsCount);
}

Expand Down
48 changes: 40 additions & 8 deletions app/client/cypress/support/Pages/IDE/BottomPane/Response.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
class Response {
private ResponseTab = "//button[@data-testid='t--tab-RESPONSE_TAB']";
public locators = {
responseTab: "[data-testid='t--tab-RESPONSE_TAB']",
responseDataContainer: "[data-testid='t--query-response-data-container']",
responseTypeMenuTrigger: "[data-testid='t--query-response-type-trigger']",
responseRecordCount: "[data-testid='t--query-response-record-count']",

/** @deprecated */
responseType(type: string): string {
return `//div[@data-testid='t--response-tab-segmented-control']//span[text()='${type}']`;
},
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved

responseTypeMenuItem(type: string) {
return `[data-testid="t--query-response-type-menu-item"][data-value="${type}"]`;
},
};

/** @deprecated */
public getResponseTypeSelector = this.locators.responseType;

/** @deprecated */
public switchResponseType(type: string): void {
this.switchToResponseTab();
cy.xpath(this.locators.responseType(type)).click({ force: true });
}
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved

public switchToResponseTab(): void {
cy.xpath(this.ResponseTab).click({ force: true });
cy.get(this.locators.responseTab).click({ force: true });
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved
}

public getResponseTypeSelector(type: string): string {
return `//div[@data-testid='t--response-tab-segmented-control']//span[text()='${type}']`;
public openResponseTypeMenu() {
cy.get(this.locators.responseDataContainer).realHover();
cy.get(this.locators.responseTypeMenuTrigger).click({ force: true });
alex-golovanov marked this conversation as resolved.
Show resolved Hide resolved
}

public switchResponseType(type: string): void {
public selectResponseResponseTypeFromMenu(type: string): void {
this.switchToResponseTab();
cy.xpath(this.getResponseTypeSelector(type)).click({ force: true });
this.openResponseTypeMenu();
cy.get(this.locators.responseTypeMenuItem(type)).realClick();
}

// TODO: Implement this method when response UI is ready
public validateRecordCount(count: number): void {}
public closeResponseTypeMenu() {
cy.get(this.locators.responseTypeMenuTrigger).realClick();
}

public validateRecordCount(count: number): void {
cy.get(this.locators.responseRecordCount)
.invoke("text")
.should("match", new RegExp(`^${count}\\b`));
}
}

export { Response };
Loading
Loading