fix: fixes google sheets datasource global search error (#15020)
* fixes google sheets datasource global search error * Adds cypress test * Fix cypress test * Fixes navigating to google sheets queries from global search issue
This commit is contained in:
parent
1f7b923ad9
commit
57dba485ce
|
|
@ -4,6 +4,7 @@ const dsl = require("../../../../fixtures/MultipleWidgetDsl.json");
|
|||
const globalSearchLocators = require("../../../../locators/GlobalSearch.json");
|
||||
const datasourceHomeLocators = require("../../../../locators/apiWidgetslocator.json");
|
||||
const datasourceLocators = require("../../../../locators/DatasourcesEditor.json");
|
||||
const appPage = require("../../../../locators/PgAdminlocators.json");
|
||||
|
||||
describe("GlobalSearch", function() {
|
||||
before(() => {
|
||||
|
|
@ -166,6 +167,27 @@ describe("GlobalSearch", function() {
|
|||
cy.get(datasourceHomeLocators.apiTxt)
|
||||
.invoke("val")
|
||||
.then((title) => expect(title).includes("Api"));
|
||||
});
|
||||
|
||||
it("8. navigatesToGoogleSheetsQuery does not break again: Bug 15012", () => {
|
||||
cy.createGoogleSheetsDatasource();
|
||||
cy.renameDatasource("XYZ");
|
||||
cy.wait(4000);
|
||||
cy.get(appPage.dropdownChevronLeft).click();
|
||||
|
||||
cy.get(commonlocators.globalSearchTrigger).click({ force: true });
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(1000); // modal open transition should be deterministic
|
||||
cy.get(commonlocators.globalSearchInput).type("XYZ");
|
||||
cy.get("body").type("{enter}");
|
||||
|
||||
cy.get(".t--save-datasource")
|
||||
.contains("Save and Authorize")
|
||||
.should("be.visible");
|
||||
|
||||
cy.deleteDatasource("XYZ");
|
||||
|
||||
// this should be called at the end of the last test case in this spec file.
|
||||
cy.NavigateToHome();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"PostgreSQL": ".t--plugin-name:contains('PostgreSQL')",
|
||||
"SMTP":".t--plugin-name:contains('SMTP')",
|
||||
"MySQL": ".t--plugin-name:contains('MySQL')",
|
||||
"GoogleSheets": ".t--plugin-name:contains('Google Sheets')",
|
||||
"sectionAuthentication": "[data-cy=section-Authentication]",
|
||||
"PostgresEntity": ".t--entity-name:contains(PostgreSQL)",
|
||||
"MySQLEntity": ".t--entity-name:contains(Mysql)",
|
||||
|
|
|
|||
|
|
@ -356,6 +356,12 @@ Cypress.Commands.add("createPostgresDatasource", () => {
|
|||
cy.testSaveDatasource();
|
||||
});
|
||||
|
||||
// this can be modified further when google sheets automation is done.
|
||||
Cypress.Commands.add("createGoogleSheetsDatasource", () => {
|
||||
cy.NavigateToDatasourceEditor();
|
||||
cy.get(datasourceEditor.GoogleSheets).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("deleteDatasource", (datasourceName) => {
|
||||
cy.NavigateToQueryEditor();
|
||||
cy.get(pages.integrationActiveTab)
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ import {
|
|||
builderURL,
|
||||
jsCollectionIdURL,
|
||||
} from "RouteBuilder";
|
||||
import { getPlugins } from "selectors/entitiesSelector";
|
||||
import { PluginType } from "entities/Action";
|
||||
|
||||
const StyledContainer = styled.div<{ category: SearchCategory; query: string }>`
|
||||
width: ${({ category, query }) =>
|
||||
|
|
@ -194,6 +196,7 @@ function GlobalSearch() {
|
|||
const category = useSelector(
|
||||
(state: AppState) => state.ui.globalSearch.filterContext.category,
|
||||
);
|
||||
const plugins = useSelector(getPlugins);
|
||||
const setCategory = useCallback(
|
||||
(category: SearchCategory) => {
|
||||
if (isSnippet(category)) {
|
||||
|
|
@ -412,12 +415,18 @@ function GlobalSearch() {
|
|||
const { config } = item;
|
||||
const { id, pageId, pluginType } = config;
|
||||
const actionConfig = getActionConfig(pluginType);
|
||||
let plugin;
|
||||
// passing plugins for SAAS actions since they require it for computing urls.
|
||||
if (pluginType === PluginType.SAAS) {
|
||||
plugin = plugins.find((plugin) => plugin?.id === config?.pluginId);
|
||||
}
|
||||
const url = actionConfig?.getURL(
|
||||
applicationSlug,
|
||||
pageIdToSlugMap[pageId] as string,
|
||||
pageId,
|
||||
id,
|
||||
pluginType,
|
||||
plugin,
|
||||
);
|
||||
toggleShow();
|
||||
url && history.push(url);
|
||||
|
|
|
|||
|
|
@ -241,7 +241,6 @@ class DatasourceEditorRouter extends React.Component<Props> {
|
|||
datasourceId,
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Default to old flow
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user