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

10/10 Daily Promotion #36792

Merged
merged 15 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ app/client/src/ce/JSFunctionExecutionSaga.ts @ApekshaBhosale
app/client/src/ee/JSFunctionExecutionSaga.ts @ApekshaBhosale

# Enterprise Success
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/**/* @sharat87 @abhvsn
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/**/* @sharat87 @abhvsn @AnaghHegde

# DevOps & Shri
deploy/**/* @sharat87 @pratapaprasanna
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import reconnectDatasourceModal from "../../../../locators/ReconnectLocators";
import {
agHelper,
apiPage,
dataSources,
homePage,
locators,
} from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
PageLeftPane,
EntityType,
PagePaneSegment,
} from "../../../../support/Pages/EditorNavigation";

const apiwidget = require("../../../../locators/apiWidgetslocator.json");
const queryLocators = require("../../../../locators/QueryEditor.json");

describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
describe("Focus Retention of Inputs", { tags: ["@tag.IDE"] }, function () {
before("Import the test application", () => {
homePage.CreateNewWorkspace("MaintainContext&Focus", true);
homePage.ImportApp("ContextSwitching.json", "MaintainContext");
homePage.NavigateToHome();
homePage.ImportApp("ContextSwitching.json");
cy.wait("@importNewApplication").then((interception) => {
agHelper.Sleep();
const { isPartialImport } = interception.response.body.data;
Expand Down Expand Up @@ -46,26 +47,26 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {

cy.focusCodeInput(".t--graphql-query-editor", { ch: 4, line: 1 });

EditorNavigation.SelectEntityByName("Rest_Api_1", EntityType.Api);
PageLeftPane.selectItem("Rest_Api_1");

cy.wait(1000);
cy.xpath("//span[contains(text(), 'Params')]").click();
cy.focusCodeInput(apiwidget.queryKey);
cy.wait("@saveAction");

EditorNavigation.SelectEntityByName("Rest_Api_2", EntityType.Api);
PageLeftPane.selectItem("Rest_Api_2");

cy.wait(1000);
cy.xpath("//span[contains(text(), 'Headers')]").click();
agHelper.GetNClick("//span[contains(text(), 'Headers')]", 0);
cy.updateCodeInput(apiwidget.headerValue, "test");
cy.wait("@saveAction");

EditorNavigation.SelectEntityByName("SQL_Query", EntityType.Query);
PageLeftPane.selectItem("SQL_Query");
cy.wait(1000);
cy.focusCodeInput(".t--actionConfiguration\\.body", { ch: 5, line: 0 });
cy.wait("@saveAction");

EditorNavigation.SelectEntityByName("S3_Query", EntityType.Query);
PageLeftPane.selectItem("S3_Query");

cy.wait(1000);
cy.focusCodeInput(".t--actionConfiguration\\.formData\\.bucket\\.data", {
Expand All @@ -75,25 +76,18 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
cy.wait(1000);
cy.wait("@saveAction");

EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
PageLeftPane.switchSegment(PagePaneSegment.JS);

PageLeftPane.selectItem("JSObject1");

cy.wait(1000);
cy.focusCodeInput(".js-editor", { ch: 4, line: 4 });
cy.wait("@saveAction");

EditorNavigation.SelectEntityByName("JSObject2", EntityType.JSObject);
PageLeftPane.selectItem("JSObject2");

cy.wait(1000);
cy.focusCodeInput(".js-editor", { ch: 2, line: 2 });

EditorNavigation.SelectEntityByName("Mongo_Query", EntityType.Query);

cy.wait(1000);
dataSources.EnterJSContext({
fieldLabel: "Collection",
fieldValue: "TestCollection",
});
cy.wait("@saveAction");
});

it("2. Maintains focus on property/Api/Query/Js Pane", () => {
Expand All @@ -106,8 +100,14 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
line: 0,
});

PageLeftPane.switchSegment(PagePaneSegment.Queries);

//Maintains focus on the API pane
EditorNavigation.SelectEntityByName("Graphql_Query", EntityType.Api);
PageLeftPane.selectItem("Graphql_Query");

agHelper
.GetElement(locators._queryName)
.should("have.text", "Graphql_Query");

cy.xpath("//span[contains(text(), 'Body')]/parent::button").should(
"have.attr",
Expand All @@ -116,10 +116,20 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
);
cy.assertCursorOnCodeInput(".t--graphql-query-editor", { ch: 4, line: 1 });

EditorNavigation.SelectEntityByName("Rest_Api_1", EntityType.Api);
// cy.assertCursorOnCodeInput(apiwidget.headerValue);
PageLeftPane.selectItem("Rest_Api_1");

agHelper.GetElement(locators._queryName).should("have.text", "Rest_Api_1");

EditorNavigation.SelectEntityByName("Rest_Api_2", EntityType.Api);
cy.xpath("//span[contains(text(), 'Params')]/parent::button").should(
"have.attr",
"aria-selected",
"true",
);
cy.assertCursorOnCodeInput(apiwidget.queryKey, { ch: 0, line: 0 });

PageLeftPane.selectItem("Rest_Api_2");

agHelper.GetElement(locators._queryName).should("have.text", "Rest_Api_2");

cy.xpath("//span[contains(text(), 'Headers')]/parent::button").should(
"have.attr",
Expand All @@ -129,61 +139,35 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
cy.assertCursorOnCodeInput(apiwidget.headerValue);

//Maintains focus on Query panes
EditorNavigation.SelectEntityByName("SQL_Query", EntityType.Query);
PageLeftPane.selectItem("SQL_Query");

agHelper.GetElement(locators._queryName).should("have.text", "SQL_Query");

cy.assertCursorOnCodeInput(".t--actionConfiguration\\.body", {
ch: 5,
line: 0,
});

EditorNavigation.SelectEntityByName("S3_Query", EntityType.Query);
PageLeftPane.selectItem("S3_Query");

cy.assertCursorOnCodeInput(
".t--actionConfiguration\\.formData\\.bucket\\.data",
{ ch: 2, line: 0 },
);

// Removing as the Mongo collection is now converted to dropdown
// entityExplorer.SelectEntityByName("Mongo_Query");

// cy.assertCursorOnCodeInput(
// ".t--actionConfiguration\\.formData\\.collection\\.data",
// );
PageLeftPane.switchSegment(PagePaneSegment.JS);

//Maintains focus on JS Objects
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);
PageLeftPane.selectItem("JSObject1");

cy.assertCursorOnCodeInput(".js-editor", { ch: 2, line: 4 });

EditorNavigation.SelectEntityByName("JSObject2", EntityType.JSObject);
PageLeftPane.selectItem("JSObject2");

cy.assertCursorOnCodeInput(".js-editor", { ch: 2, line: 2 });
});

it("3. Check if selected tab on right tab persists", () => {
EditorNavigation.SelectEntityByName("Rest_Api_1", EntityType.Api);
apiPage.SelectRightPaneTab("Connections");
EditorNavigation.SelectEntityByName("SQL_Query", EntityType.Query);
EditorNavigation.SelectEntityByName("Rest_Api_1", EntityType.Api);
apiPage.AssertRightPaneSelectedTab("Connections");

//Check if the URL is persisted while switching pages
cy.Createpage("Page2");

EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
EditorNavigation.SelectEntityByName("Rest_Api_1", EntityType.Api);

EditorNavigation.SelectEntityByName("Page2", EntityType.Page);
cy.dragAndDropToCanvas("textwidget", { x: 300, y: 200 });

EditorNavigation.SelectEntityByName("Page1", EntityType.Page);
cy.get(".t--nameOfApi .bp3-editable-text-content").should(
"contain",
"Rest_Api_1",
);
});

it("4. Datasource edit mode has to be maintained", () => {
it("3. Datasource edit mode has to be maintained", () => {
EditorNavigation.SelectEntityByName("Appsmith", EntityType.Datasource);
dataSources.EditDatasource();
EditorNavigation.SelectEntityByName("Github", EntityType.Datasource);
Expand All @@ -192,7 +176,7 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {
dataSources.AssertDSEditViewMode("Edit");
});

it("5. Maintain focus of form control inputs", () => {
it("4. Maintain focus of form control inputs", () => {
EditorNavigation.SelectEntityByName("SQL_Query", EntityType.Query);
dataSources.ToggleUsePreparedStatement(false);
EditorNavigation.SelectEntityByName("S3_Query", EntityType.Query);
Expand All @@ -202,14 +186,15 @@ describe("MaintainContext&Focus", { tags: ["@tag.IDE"] }, function () {

EditorNavigation.SelectEntityByName("SQL_Query", EntityType.Query);
cy.get(".bp3-editable-text-content").should("contain.text", "SQL_Query");
cy.get(".t--form-control-SWITCH input").should("be.focused");
cy.xpath(queryLocators.querySettingsTab).click();
agHelper.GetElement(dataSources._usePreparedStatement).should("be.focused");
EditorNavigation.SelectEntityByName("S3_Query", EntityType.Query);
agHelper.Sleep();
cy.xpath(queryLocators.querySettingsTab).click();
cy.xpath(queryLocators.queryTimeout).should("be.focused");
});

it("6. Bug 21999 Maintain focus of code editor when Escape is pressed with autcomplete open + Bug 22960", () => {
it("5. Bug 21999 Maintain focus of code editor when Escape is pressed with autcomplete open + Bug 22960", () => {
EditorNavigation.SelectEntityByName("JSObject1", EntityType.JSObject);

cy.assertCursorOnCodeInput(".js-editor", { ch: 2, line: 4 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Widget error state", { tags: ["@tag.Widget"] }, function () {
//Check if the current value is shown in the debugger

_.debuggerHelper.OpenDebugger();
cy.get("[data-testid=t--tab-ERROR]").click();
cy.get("[data-testid=t--tab-ERROR_TAB]").click();
//This feature is disabled in updated error log - epic 17720
// _.debuggerHelper.LogStateContains("Test");
});
Expand All @@ -37,7 +37,7 @@ describe("Widget error state", { tags: ["@tag.Widget"] }, function () {
cy.get(widgetLocators.buttonWidget).click();

cy.get(".t--toast-debug-button").click();
cy.get("[data-testid='t--tab-ERROR']").should(
cy.get("[data-testid='t--tab-ERROR_TAB']").should(
"have.attr",
"aria-selected",
"true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,17 @@ describe(
expect(afterSearch).to.eq("Software Engineer");
});
table.RemoveSearchTextNVerify("1", "v2");
});

// Search for a value in the table
table.SearchTable("20");
table.ReadTableRowColumnData(0, 2, "v2").then((afterSearch) => {
expect(afterSearch).to.eq("Product Manager");
it("12. Verify table filter for select column type", function () {
featureFlagIntercept({ release_table_cell_label_value_enabled: true });
table.OpenNFilterTable("role", "is exactly", "Product Manager");
table.ReadTableRowColumnData(0, 2, "v2").then(($cellData) => {
expect($cellData).to.eq("Product Manager");
});
table.ReadTableRowColumnData(1, 2, "v2").then(($cellData) => {
expect($cellData).to.eq("Product Manager");
});
table.RemoveSearchTextNVerify("1", "v2");
});
},
);
2 changes: 1 addition & 1 deletion app/client/cypress/locators/commonlocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"labelSectionTxt": ".CodeMirror-code .cm-variable",
"lintError": ".CodeMirror-lint-mark-error",
"debugger": ".t--debugger-count",
"errorTab": "[data-testid=t--tab-ERROR]",
"errorTab": "[data-testid=t--tab-ERROR_TAB]",
"debugErrorMsg": "[data-testid=t--debugger-log-message]",
"tableButtonVariant": ".t--property-control-buttonvariant",
"debuggerLabel": "span.debugger-label",
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/ApiCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Cypress.Commands.add(
}
cy.get(".string-value").contains(baseurl.concat(path));
cy.get(".string-value").contains(verb);
cy.get("[data-testid=t--tab-response]").first().click({ force: true });
cy.get("[data-testid=t--tab-RESPONSE_TAB]").first().click({ force: true });
},
);

Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export class CommonLocators {
_createNew = ".t--add-item";
_uploadFiles = "div.uppy-Dashboard-AddFiles input";
_uploadBtn = "button.uppy-StatusBar-actionBtn--upload";
_errorTab = "[data-testid=t--tab-ERROR]";
_responseTab = "[data-testid=t--tab-response]";
_errorTab = "[data-testid=t--tab-ERROR_TAB]";
_responseTab = "[data-testid=t--tab-RESPONSE_TAB]";
_modal = ".t--modal-widget";
_closeModal = "button:contains('Close')";
_entityProperties = (entityNameinLeftSidebar: string) =>
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/ApiPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class ApiPage {
private _paginationTypeLabels = ".t--apiFormPaginationType label";
_saveAsDS = ".t--store-as-datasource";
_responseStatus = ".t--response-status-code";
public _responseTabHeader = "[data-testid=t--tab-headers]";
public _responseTabHeader = "[data-testid=t--tab-HEADERS_TAB]";
public _headersTabContent = ".t--headers-tab";
public _autoGeneratedHeaderInfoIcon = (key: string) =>
`.t--auto-generated-${key}-info`;
Expand Down
6 changes: 3 additions & 3 deletions app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ export class DataSources {
_globalSearchInput = ".t--global-search-input";
_gsScopeDropdown =
"[data-testid^='datasourceStorages.'][data-testid$='.datasourceConfiguration.authentication.scopeString']";
_gsScopeOptions = ".ads-v2-select__dropdown .rc-select-item-option";
_gsScopeOptions = ".ads-v2-radio-group";
_queryTimeout = "//input[@name='actionConfiguration.timeoutInMillisecond']";
_getStructureReq = "/api/v1/datasources/*/structure?ignoreCache=true";
_editDatasourceFromActiveTab = (dsName: string) =>
".t--datasource-name:contains('" + dsName + "')";
_mandatoryMark = "//span[text()='*']";
_deleteDSHostPort = ".t--delete-field";
_dsTabSchema = "[data-testid='t--tab-schema']";
_dsTabSchema = "[data-testid='t--tab-SCHEMA_TAB']";
private _pageSelectionMenu = "[data-testId='t--page-selection']";

private _pageSelectMenuItem = ".ads-v2-menu__menu-item";
Expand Down Expand Up @@ -1854,7 +1854,7 @@ export class DataSources {
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
`getDatasourceStructureUpdated_${ds_entity_name}`,
);
cy.get("[data-testid=t--tab-schema]").first().click({ force: true });
cy.get("[data-testid=t--tab-SCHEMA_TAB]").first().click({ force: true });
this.RefreshDatasourceSchema();
this.assertHelper
.WaitForNetworkCall(`@getDatasourceStructureUpdated_${ds_entity_name}`)
Expand Down
Loading
Loading