Skip to content

Commit

Permalink
Merge pull request #38273 from appsmithorg/release
Browse files Browse the repository at this point in the history
20/12 Daily Promotion
  • Loading branch information
btsgh authored Dec 20, 2024
2 parents 01d3ff5 + d1cff32 commit b4b40d4
Show file tree
Hide file tree
Showing 60 changed files with 1,522 additions and 698 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/build-client-server-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
matrix_count: ${{steps.matrix.outputs.matrix_count}}
run_count: ${{ steps.countArgs.outputs.run_count }}
is-pg-build: ${{steps.args.outputs.is-pg-build}}
update_snapshot: ${{steps.args.outputs.update_snapshot}}
specs_to_run: ${{steps.args.outputs.specs_to_run}}
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v4
Expand All @@ -38,6 +40,21 @@ jobs:
runId=$((checkArg + 0))
echo "runId=$runId" >> $GITHUB_OUTPUT
fi
# Check for update_snapshot
checkArg=${{ github.event.client_payload.slash_command.args.named.update_snapshot }}
if [[ -z "$checkArg" ]]; then
echo "update_snapshot=false" >> $GITHUB_OUTPUT
else
echo "update_snapshot=$checkArg" >> $GITHUB_OUTPUT
fi
# Check for spec file
checkArg=${{ github.event.client_payload.slash_command.args.named.specs_to_run }}
if [[ -z "$checkArg" ]]; then
echo "specs_to_run=''" >> $GITHUB_OUTPUT
else
echo "specs_to_run=$checkArg" >> $GITHUB_OUTPUT
fi
- name: Set run count
id: countArgs
Expand Down Expand Up @@ -97,7 +114,7 @@ jobs:
body: |
Tests running at: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
[Cypress dashboard](https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail)
PR: #${{ fromJson(steps.args.outputs.pr) }}.
PR: #${{ fromJson(steps.args.outputs.pr) }} with spec: ${{steps.args.outputs.specs_to_run}} .
server-build:
name: server-build
Expand Down Expand Up @@ -149,6 +166,8 @@ jobs:
with:
pr: ${{fromJson(needs.file-check.outputs.pr)}}
run_count: ${{fromJson(needs.file-check.outputs.run_count)}}
update_snapshot: ${{fromJson(needs.file-check.outputs.update_snapshot)}}
specs_to_run: ${{needs.file-check.outputs.specs_to_run}}


ci-test-limited-existing-docker-image:
Expand All @@ -162,6 +181,8 @@ jobs:
pr: ${{fromJson(needs.file-check.outputs.pr)}}
previous-workflow-run-id: ${{ fromJson(needs.file-check.outputs.runId) }}
run_count: ${{fromJson(needs.file-check.outputs.run_count)}}
update_snapshot: ${{fromJson(needs.file-check.outputs.update_snapshot)}}
specs_to_run: ${{needs.file-check.outputs.specs_to_run}}

ci-test-limited-result:
needs: [file-check, ci-test-limited]
Expand Down
54 changes: 49 additions & 5 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ on:
required: false
type: number
default: 1
update_snapshot:
description: 'Give option to update snapshot (true/false)'
required: false
type: boolean
default: false
specs_to_run:
description: 'Cypress spec file(s) to run'
required: false
type: string

workflow_call:
inputs:
pr:
Expand All @@ -35,6 +45,15 @@ on:
required: false
type: number
default: 1
update_snapshot:
description: 'Give option to update snapshot (true/false)'
required: false
type: boolean
default: false
specs_to_run:
description: 'Cypress spec file(s) to run'
required: false
type: string

jobs:
ci-test-limited:
Expand Down Expand Up @@ -111,10 +130,18 @@ jobs:
else
echo "rerun=false" >> $GITHUB_OUTPUT
fi
- name: Upload existing snapshot data
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-existing-compare-snapshots
path: ${{ github.workspace }}/app/client/cypress/snapshots
overwrite: true

# Get specs to run
- name: Get specs to run
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
if: ${{ (inputs.specs_to_run == '' || inputs.specs_to_run == null) && steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest' }}
run: |
specs_to_run=""
while IFS= read -r line
Expand Down Expand Up @@ -349,10 +376,19 @@ jobs:
NODE_ENV: development
run: |
cd app/client
npx cypress-repeat-pro run -n ${{ inputs.run_count }} --force \
--spec ${{ env.specs_to_run }} \
if [[ "${{ inputs.update_snapshot }}" == "true" ]]; then
echo "Running Cypress with snapshot updates..."
CYPRESS_updateSnapshots=true npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ inputs.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser ${{ env.BROWSER_PATH }}
--browser "${{ env.BROWSER_PATH }}"
else
echo "Running Cypress tests without snapshot updates..."
npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ env.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
fi
cat cy-repeat-summary.txt
# Define the path for the failure flag file
FAILURE_FLAG_FILE="ci_test_status.txt"
Expand Down Expand Up @@ -453,9 +489,17 @@ jobs:
if: always()
with:
name: server-logs
path: app/server/server-logs.log
path: ${{ github.workspace }}/app/server/server-logs.log
overwrite: true

- name: Upload new compared snapshot data
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-new-compare-snapshots
path: ${{ github.workspace }}/app/client/cypress/snapshots
overwrite: true

# Set status = success
- name: Save the status of the run
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ jobs:
if: failure()
with:
name: server-logs
path: app/server/server-logs.log
path: ${{ github.workspace }}/app/server/server-logs.log
overwrite: true

# Set status = success
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/support/Pages/EditorNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { LeftPane } from "./IDE/LeftPane";
import PageList from "./PageList";

export enum AppSidebarButton {
Data = "Data",
Data = "Datasources",
Editor = "Editor",
Libraries = "Libraries",
Settings = "Settings",
}

export const AppSidebar = new Sidebar(Object.values(AppSidebarButton));

export enum PagePaneSegment {
Expand Down Expand Up @@ -42,6 +43,7 @@ export enum EntityType {
JSObject = "JSObject",
Page = "Page",
}

class EditorNavigation {
public locators = {
MaximizeBtn: "[data-testid='t--ide-maximize']",
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Pages/IDE/Sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export class Sidebar {
buttons: string[];
locators = {
sidebar: ".t--sidebar",
sidebarButton: (name: string) => `.t--sidebar-${name}`,
sidebarButton: (name: string) => `[data-testid='t--sidebar-${name}']`,
};

constructor(buttons: string[]) {
Expand Down
1 change: 1 addition & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"@redux-saga/core": "1.1.3",
"@redux-saga/types": "1.2.1",
"@reduxjs/toolkit": "^2.4.0",
"@segment/analytics-next": "^1.76.0",
"@sentry/react": "^6.2.4",
"@shared/ast": "workspace:^",
"@shared/dsl": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ export const StyledSegment = styled.span`
& > * {
color: var(--ads-v2-colors-control-segment-value-default-fg);
}
&[data-selected="true"] {
span {
font-weight: var(--ads-v2-font-weight-bold);
}
}
`;

export const StyledControlContainer = styled.div`
Expand Down Expand Up @@ -81,6 +87,7 @@ export const StyledControlContainer = styled.div`
/* Select all segments which is not a selected and last child */
/* seperator */
&:not(:hover):not(:last-child):not([data-selected="true"]):not(
:has(+ [data-selected="true"])
):after {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions app/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
return result;
};
const CLOUD_HOSTING = parseConfig('{{env "APPSMITH_CLOUD_HOSTING"}}');
const ZIPY_KEY = parseConfig('{{env "APPSMITH_ZIPY_SDK_KEY"}}');
const AIRGAPPED = parseConfig('{{env "APPSMITH_AIRGAP_ENABLED"}}');
const REO_CLIENT_ID = parseConfig('{{env "APPSMITH_REO_CLIENT_ID"}}');
</script>
Expand All @@ -64,21 +63,6 @@
})()
%>
</script>
<script>
if (CLOUD_HOSTING && ZIPY_KEY) {
const script = document.createElement("script");
script.crossOrigin = "anonymous";
script.defer = true;
script.src = "https://cdn.zipy.ai/sdk/v1.0/zipy.min.umd.js";
script.onload = () => {
window.zipy && window.zipy.init(ZIPY_KEY);
};
const head = document.getElementsByTagName("head")[0];
head && head.appendChild(script);
}


</script>

<!-- Start of Reo Javascript -->
<script type="text/javascript">
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/IDE/Components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function IDESidebar(props: IDESidebarProps) {
key={button.state}
onClick={onClick}
selected={editorState === button.state}
testId={button.testId}
title={button.title}
tooltip={button.tooltip}
urlSuffix={button.urlSuffix}
Expand All @@ -58,6 +59,7 @@ function IDESidebar(props: IDESidebarProps) {
key={button.state}
onClick={onClick}
selected={editorState === button.state}
testId={button.testId}
title={button.title}
tooltip={button.tooltip}
urlSuffix={button.urlSuffix}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ const sidebarButtonProps: SidebarButtonProps = {
selected: false,
title: "Test",
urlSuffix: "/test",
testId: "testId",
};

describe("SidebarButton", () => {
it("should render the button with the correct test id", () => {
const { getByTestId } = render(<SidebarButton {...sidebarButtonProps} />);

expect(getByTestId("t--sidebar-testId")).toBeDefined();
});

it("should render the warning icon in case the datasource list is empty", () => {
const withWarningCondition = {
...sidebarButtonProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ConditionConfig: Record<Condition, { icon: string; color: string }> = {

export interface SidebarButtonProps {
title?: string;
testId: string;
selected: boolean;
icon: string;
onClick: (urlSuffix: string) => void;
Expand All @@ -33,10 +34,8 @@ const Container = styled(Flex)`
padding: 8px 0;
`;

const IconContainer = styled.div<{ selected: boolean }>`
const IconContainer = styled.div`
padding: 2px;
background-color: ${(props) =>
props.selected ? "var(--colors-raw-orange-100, #fbe6dc)" : "white"};
border-radius: 3px;
width: 32px;
height: 32px;
Expand All @@ -46,11 +45,16 @@ const IconContainer = styled.div<{ selected: boolean }>`
cursor: pointer;
position: relative;
&:hover {
background: ${(props) =>
props.selected
? "var(--colors-raw-orange-100, #fbe6dc)"
: "var(--ads-v2-color-bg-subtle, #f1f5f9);"};
&[data-selected="false"] {
background-color: var(--ads-v2-color-bg);
&:hover {
background-color: var(--ads-v2-color-bg-subtle, #f1f5f9);
}
}
&[data-selected="true"] {
background-color: var(--ads-v2-color-bg-muted);
}
`;

Expand Down Expand Up @@ -85,9 +89,9 @@ function SidebarButton(props: SidebarButtonProps) {
<IconContainer
className={`t--sidebar-${title || tooltip}`}
data-selected={selected}
data-testid={"t--sidebar-" + props.testId}
onClick={handleOnClick}
role="button"
selected={selected}
>
<Icon name={icon} size="lg" />
{condition && (
Expand Down
9 changes: 0 additions & 9 deletions app/client/src/actions/analyticsActions.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { InternalAxiosRequestConfig } from "axios";
import type { ID } from "@segment/analytics-next";

export const addAnonymousUserIdHeader = (
config: InternalAxiosRequestConfig,
options: { anonymousId?: string; segmentEnabled?: boolean },
options: { anonymousId: ID; segmentEnabled?: boolean },
) => {
const { anonymousId, segmentEnabled } = options;

Expand Down
2 changes: 0 additions & 2 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1214,8 +1214,6 @@ const TenantActionErrorTypes = {
};

const AnalyticsActionTypes = {
SEGMENT_INITIALIZED: "SEGMENT_INITIALIZED",
SEGMENT_INIT_UNCERTAIN: "SEGMENT_INIT_UNCERTAIN",
SET_BUILDING_BLOCK_DRAG_START_TIME: "SET_BUILDING_BLOCK_DRAG_START_TIME",
RESET_BUILDING_BLOCK_DRAG_START_TIME: "RESET_BUILDING_BLOCK_DRAG_START_TIME",
SEND_ANALYTICS_FOR_SIDE_BY_SIDE_HOVER:
Expand Down
Loading

0 comments on commit b4b40d4

Please sign in to comment.