Skip to content

Commit

Permalink
Merge branch 'release' into feat/snowflake-key-auth-server
Browse files Browse the repository at this point in the history
  • Loading branch information
“sneha122” committed Jun 28, 2024
2 parents 78d700d + 65e28b4 commit 4267582
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 130 deletions.
89 changes: 33 additions & 56 deletions .github/workflows/pr-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,16 @@ jobs:
# In case of missing tags, guides towards correct usage in test response
- name: Add test response with tags documentation link
if: steps.parseTags.outputs.outcome != 'success'
uses: nefrob/pr-description@v1.1.2
uses: actions/github-script@v7
env:
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts"
BODY: |
The provided command lacks proper tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs.
Explore the [tags documentation](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918).
with:
content: |
<!-- This is an auto-generated comment: Cypress test results -->
> [!WARNING]
> The provided command lacks proper tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs.
> Explore the tags documentation [here](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918)
<!-- end of auto-generated comment: Cypress test results -->
regex: "<!-- This is an auto-generated comment: Cypress test results -->.*?<!-- end of auto-generated comment: Cypress test results -->"
regexFlags: ims
token: ${{ secrets.GITHUB_TOKEN }}

# In case of missing tags, exit the workflow with failure
- name: Stop the workflow run if tags are not present
if: steps.parseTags.outputs.outcome != 'success'
run: exit 1
script: |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY)
setFailed()
- name: Check Tags
env:
Expand All @@ -95,23 +88,16 @@ jobs:
# In case of incorrect tags, guides towards correct tags
- name: Add test response with tags list link
if: steps.checkTags.outputs.outcome == 'failure'
uses: nefrob/pr-description@v1.1.2
uses: actions/github-script@v7
env:
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts"
BODY: |
The provided command contains incorrect tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs.
Please find [complete list of tags](https://github.com/appsmithorg/appsmith/blob/release/app/client/cypress/tags.js).
with:
content: |
<!-- This is an auto-generated comment: Cypress test results -->
> [!WARNING]
> The provided command contains incorrect tags. Please modify PR body, specifying the tags you want to include or use `/ok-to-test tags="@tag.All"` to run all specs.
> Please find complete list of tags [here](https://github.com/appsmithorg/appsmith/blob/release/app/client/cypress/tags.js)
<!-- end of auto-generated comment: Cypress test results -->
regex: "<!-- This is an auto-generated comment: Cypress test results -->.*?<!-- end of auto-generated comment: Cypress test results -->"
regexFlags: ims
token: ${{ secrets.GITHUB_TOKEN }}

# In case of incorrect tags, exit the workflow with failure
- name: Stop the workflow run if tags are incorrect
if: steps.checkTags.outputs.outcome == 'failure'
run: exit 1
script: |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY)
setFailed()
# In case of a run with all test cases, allocate a larger matrix
- name: Check if @tag.All is present in tags
Expand All @@ -131,40 +117,31 @@ jobs:
# In case of incorrect usage for all test cases, inform the PR author of correct usage
- name: Add test response to use correct @tag.All format
if: steps.checkAll.outputs.invalid_tags_all != ''
uses: nefrob/pr-description@v1.1.2
uses: actions/github-script@v7
env:
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts"
BODY: |
Please use `/ok-to-test tags="@tag.All"` to run all specs.
Explore the [tags documentation](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918).
with:
content: |
<!-- This is an auto-generated comment: Cypress test results -->
> [!WARNING]
> Please use `/ok-to-test tags="@tag.All"` to run all specs.
> Explore the tags documentation [here](https://www.notion.so/appsmith/Ok-to-test-With-Tags-7c0fc64d4efb4afebf53348cd6252918)
<!-- end of auto-generated comment: Cypress test results -->
regex: "<!-- This is an auto-generated comment: Cypress test results -->.*?<!-- end of auto-generated comment: Cypress test results -->"
regexFlags: ims
token: ${{ secrets.GITHUB_TOKEN }}

# In case of incorrect usage for all test cases, exit the workflow with failure
- name: Stop the workflow run if given @tag.All format is wrong
if: steps.checkAll.outputs.invalid_tags_all != ''
run: exit 1
script: |
require("write-cypress-status.js")({core, context, github}, "warning", process.env.BODY)
core.setFailed()
# In case of a runnable command, update the PR with run details
- name: Add test response with link to workflow run
uses: actions/github-script@v7
env:
NODE_PATH: "${{ github.workspace }}/.github/workflows/scripts"
BODY: |
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>
> Commit: ${{ github.event.pull_request.head.sha }}
> Workflow: `${{ github.workflow }}`
> Tags: `${{ steps.checkAll.outputs.tags }}`
Your tests are running.
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>
Commit: ${{ github.event.pull_request.head.sha }}
Workflow: `${{ github.workflow }}`
Tags: `${{ steps.checkAll.outputs.tags }}`
with:
script: |
require("write-cypress-comment.js")({core, context, github}, process.env.BODY)
require("write-cypress-status.js")({core, context, github}, "important", process.env.BODY)
# Call the workflow to run Cypress tests
perform-test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ const HEADER = '<!-- This is an auto-generated comment: Cypress test results --
const FOOTER = '<!-- end of auto-generated comment: Cypress test results -->';
const PATTERN = new RegExp(HEADER + ".*?" + FOOTER, "ims");

module.exports = async function({core, context, github}, note) {
// Ref: https://github.com/orgs/community/discussions/16925
const VALID_ALERT_TYPES = ["note", "tip", "important", "warning", "caution"]

const ALERT_PREFIXES = {
important: "🟣 🟣 🟣 ",
}

module.exports = async function({core, context, github}, alertType, note) {
if (!VALID_ALERT_TYPES.includes(alertType)) {
core.setFailed("Invalid alert type: '" + alertType + "'. Allowed: " + VALID_ALERT_TYPES.join(", ") + ".");
}

const prNumber = context.payload.pull_request?.number;

if (!prNumber) {
Expand All @@ -23,7 +34,12 @@ module.exports = async function({core, context, github}, note) {
return;
}

note = [HEADER, note, FOOTER].join("\n");
note = [
HEADER,
`> [!${alertType.toUpperCase()}]`,
((ALERT_PREFIXES[alertType] ?? "") + note.trim()).replaceAll(/^/gm, "> "),
FOOTER,
].join("\n");

if (body.match(PATTERN)) {
body = body.replace(PATTERN, note);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe(

cy.get(gitSyncLocators.mergeButton).should("be.disabled");
cy.wait(3000);
cy.get(gitSyncLocators.mergeBranchDropdownDestination).click();
cy.get(_.gitSync._mergeBranchDropdownDestination).click();
cy.get(commonLocators.dropdownmenu).contains(mainBranch).click();
_.agHelper.AssertElementAbsence(_.gitSync._checkMergeability, 30000);

Expand Down
8 changes: 2 additions & 6 deletions app/client/cypress/fixtures/anvilCurrencyInputWidget.json
Original file line number Diff line number Diff line change
Expand Up @@ -3033,9 +3033,5 @@
}
}
]
},
"layoutOnLoadActions": [],
"layoutOnLoadActionErrors": [],
"id": "667a99469da472349cd2d492",
"userPermissions": []
}
}
}
8 changes: 2 additions & 6 deletions app/client/cypress/fixtures/anvilInputWidget.json
Original file line number Diff line number Diff line change
Expand Up @@ -3410,9 +3410,5 @@
}
}
]
},
"layoutOnLoadActions": [],
"layoutOnLoadActionErrors": [],
"id": "667a94f99da472349cd2d47c",
"userPermissions": []
}
}
}
8 changes: 2 additions & 6 deletions app/client/cypress/fixtures/anvilPhoneInputWidget.json
Original file line number Diff line number Diff line change
Expand Up @@ -2895,9 +2895,5 @@
}
}
]
},
"layoutOnLoadActions": [],
"layoutOnLoadActionErrors": [],
"id": "667ba7729da472349cd2d4f6",
"userPermissions": []
}
}
}
1 change: 0 additions & 1 deletion app/client/cypress/locators/gitSyncLocators.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
bottomBarCommitButton: ".t--bottom-bar-commit",
bottomBarMergeButton: ".t--bottom-bar-merge",
bottomBarPullButton: ".t--bottom-bar-pull",
mergeBranchDropdownDestination: ".t--merge-branch-dropdown-destination",
mergeCTA: "[data-testid=t--git-merge-button]",
loaderQuickGitAction: ".t--loader-quick-git-action",
connetStatusbar: ".t--connect-statusbar",
Expand Down
7 changes: 4 additions & 3 deletions app/client/cypress/support/Pages/GitSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export class GitSync {
public _bottomBarMergeButton = ".t--bottom-bar-merge";
private mergeCTA = "[data-testid=t--git-merge-button]";
public _mergeBranchDropdownDestination =
".t--merge-branch-dropdown-destination";
"[data-testid=t--merge-branch-dropdown-destination]";
public _mergeBranchDropdownmenu =
".t--merge-branch-dropdown-destination .rc-select-selection-search-input";
"[data-testid=t--merge-branch-dropdown-destination] .rc-select-selection-search-input";
public _dropdownmenu = ".rc-select-item-option-content";
private _openRepoButton = "[data-testid=t--git-repo-button]";
public _commitButton = ".t--commit-button";
Expand Down Expand Up @@ -371,8 +371,9 @@ export class GitSync {
this.agHelper.WaitUntilEleAppear(this._mergeBranchDropdownmenu);
this.agHelper.WaitUntilEleDisappear(this._mergeLoader);
this.assertHelper.AssertNetworkStatus("@getBranch", 200);
this.agHelper.WaitUntilEleAppear(this._mergeBranchDropdownmenu);
this.agHelper.GetNClick(this._mergeBranchDropdownmenu, 0, true);
this.agHelper.WaitUntilEleAppear(this._dropdownmenu);
this.agHelper.AssertContains(destinationBranch);
this.agHelper.GetNClickByContains(this._dropdownmenu, destinationBranch);
this.agHelper.AssertElementAbsence(this._checkMergeability, 35000);
}
Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress/support/gitSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Cypress.Commands.add("merge", (destinationBranch) => {
); */

agHelper.AssertElementEnabledDisabled(
gitSyncLocators.mergeBranchDropdownDestination,
gitSync._mergeBranchDropdownDestination,
0,
false,
);
Expand All @@ -121,7 +121,7 @@ Cypress.Commands.add("merge", (destinationBranch) => {
interceptions[0]?.response?.statusCode === 200 &&
interceptions[1]?.response?.statusCode === 200
) {
cy.get(gitSyncLocators.mergeBranchDropdownDestination).click();
cy.get(gitSync._mergeBranchDropdownDestination).click();
cy.get(commonLocators.dropdownmenu).contains(destinationBranch).click();
agHelper.AssertElementAbsence(gitSync._checkMergeability, 35000);
assertHelper.WaitForNetworkCall("mergeStatus");
Expand Down
2 changes: 1 addition & 1 deletion app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cytest": "REACT_APP_TESTING=TESTING REACT_APP_ENVIRONMENT=DEVELOPMENT craco start & ./node_modules/.bin/cypress open",
"test:unit": "yarn g:jest --coverage --collectCoverage=true --coverageDirectory='../../' --coverageReporters='json-summary'",
"test:jest": "jest --watch",
"g:jest": "cd $INIT_CWD && jest -b --colors --no-cache --silent --maxWorkers=50%",
"g:jest": "cd $INIT_CWD && jest --colors --no-cache --silent --maxWorkers=50%",
"test:unit:ci": "yarn workspaces foreach -tv run test:unit",
"generate:widget": "plop --plopfile generators/index.js",
"postinstall": "node cypress/apply-patches.js && yarn init-husky",
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/pages/Editor/gitSync/Tabs/Merge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default function Merge() {
<Space size={2} />
<Row style={{ overflow: "unset", paddingBottom: "4px" }}>
<Select
className="t--merge-branch-dropdown-destination"
data-testid="t--merge-branch-dropdown-destination"
dropdownClassName={Classes.MERGE_DROPDOWN}
dropdownMatchSelectWidth
getPopupContainer={(triggerNode) => triggerNode.parentNode}
Expand Down
13 changes: 10 additions & 3 deletions app/client/src/sagas/BuildingBlockSagas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { CopiedWidgetData } from "layoutSystems/anvil/utils/paste/types";
import { getWidgetHierarchy } from "layoutSystems/anvil/utils/paste/utils";
import { all, call, put, select } from "redux-saga/effects";
import { apiCallToSaveAction } from "sagas/ActionSagas";
import { accessNestedObjectValue } from "sagas/PasteWidgetUtils";
import { saveCopiedWidgets } from "utils/storage";

export function* saveBuildingBlockWidgetsToStore(
Expand Down Expand Up @@ -73,11 +74,17 @@ export function updateWidgetsNameInNewQueries(
return queries
.filter((query) => !!query)
.map((query) => {
if (!query.actionConfiguration.body || !query.jsonPathKeys) {
if (!query.actionConfiguration && !query.jsonPathKeys) {
return query;
}
query.actionConfiguration.body =
query.actionConfiguration.body.replaceAll(oldWidgetName, newWidgetName);
query?.dynamicBindingPathList?.forEach((path: { key: string }) => {
accessNestedObjectValue(
query.actionConfiguration,
path.key,
oldWidgetName,
newWidgetName,
);
});
query.jsonPathKeys = query.jsonPathKeys.map((path: string) =>
path.replaceAll(oldWidgetName, newWidgetName),
);
Expand Down
16 changes: 16 additions & 0 deletions app/client/src/sagas/PasteWidgetUtils/PasteWidgetUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ describe("accessNestedObjectValue", () => {

expect(result).toBeUndefined();
});

it("4. should work for null/undefined object", () => {
const obj = null;

const oldValue = "oldValue";
const newValue = "newValue";

const result = accessNestedObjectValue(
obj,
"foo.bar.qux",
oldValue,
newValue,
);

expect(result).toBeUndefined();
});
});

describe("handleJSONFormPropertiesListedInDynamicBindingPath", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { createRef, useEffect, useState } from "react";
import { Tooltip } from "@blueprintjs/core";
import { CellWrapper, TooltipContentWrapper } from "../TableStyledWrappers";
import type { CellAlignment, VerticalAlignment } from "../Constants";
import { importSvg } from "design-system-old";
import React, { createRef, useEffect, useState } from "react";
import styled from "styled-components";
import { ColumnTypes } from "widgets/TableWidgetV2/constants";
import { importSvg } from "design-system-old";
import type { CellAlignment, VerticalAlignment } from "../Constants";
import { CellWrapper, TooltipContentWrapper } from "../TableStyledWrappers";

const OpenNewTabIcon = importSvg(
async () => import("assets/icons/control/open-new-tab.svg"),
Expand Down Expand Up @@ -34,12 +34,9 @@ export const Content = styled.span`
const WIDTH_OFFSET = 32;
const MAX_WIDTH = 500;
const TOOLTIP_OPEN_DELAY = 500;
const MAX_CHARS_ALLOWED_IN_TOOLTIP = 200;

function useToolTip(
children: React.ReactNode,
tableWidth?: number,
title?: string,
) {
function useToolTip(children: React.ReactNode, title?: string) {
const ref = createRef<HTMLDivElement>();
const [requiresTooltip, setRequiresTooltip] = useState(false);

Expand Down Expand Up @@ -85,7 +82,9 @@ function useToolTip(
boundary="viewport"
content={
<TooltipContentWrapper width={MAX_WIDTH - WIDTH_OFFSET}>
{title}
{title && title.length > MAX_CHARS_ALLOWED_IN_TOOLTIP
? `${title.substring(0, MAX_CHARS_ALLOWED_IN_TOOLTIP)} (...)`
: title}
</TooltipContentWrapper>
}
defaultIsOpen
Expand Down Expand Up @@ -128,7 +127,7 @@ interface Props {
}

function LinkWrapper(props: Props) {
const content = useToolTip(props.children, props.tableWidth, props.title);
const content = useToolTip(props.children, props.title);

return (
<CellWrapper
Expand Down Expand Up @@ -160,7 +159,7 @@ function LinkWrapper(props: Props) {
}

function AutoToolTipComponent(props: Props) {
const content = useToolTip(props.children, props.tableWidth, props.title);
const content = useToolTip(props.children, props.title);

if (props.columnType === ColumnTypes.URL && props.title) {
return <LinkWrapper {...props} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.external.plugins;

import com.appsmith.external.constants.Authentication;
import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError;
import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException;
import com.appsmith.external.exceptions.pluginExceptions.StaleConnectionException;
Expand Down Expand Up @@ -284,7 +285,7 @@ public Set<String> validateDatasource(DatasourceConfiguration datasourceConfigur
if (datasourceConfiguration.getAuthentication() == null) {
invalids.add(SnowflakeErrorMessages.DS_MISSING_AUTHENTICATION_DETAILS_ERROR_MSG);
} else {
if (SNOWFLAKE_KEY_PAIR_AUTH.equals(
if (Authentication.SNOWFLAKE_KEY_PAIR_AUTH.equals(
datasourceConfiguration.getAuthentication().getAuthenticationType())) {
KeyPairAuth authentication = (KeyPairAuth) datasourceConfiguration.getAuthentication();
if (StringUtils.isEmpty(authentication.getUsername())) {
Expand Down
Loading

0 comments on commit 4267582

Please sign in to comment.