Skip to content

Commit

Permalink
Merge branch 'appsmithorg:release' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
hajrezvan authored Oct 17, 2024
2 parents 6d39cea + 9719e92 commit 62b35bd
Show file tree
Hide file tree
Showing 266 changed files with 4,545 additions and 2,492 deletions.
3 changes: 2 additions & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ reviews:
auto_review:
enabled: true
drafts: false
base_branches: ["pg", "release"]
path_instructions:
- path: "app/client/cypress/**/**.*"
instructions: |
Expand All @@ -34,4 +35,4 @@ reviews:
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.
chat:
auto_reply: true
auto_reply: true
10 changes: 10 additions & 0 deletions .github/workflows/ad-hoc-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ jobs:
scripts/generate_info_json.sh
fi
- name: Place server artifacts-es
run: |
run: |
if [[ -f scripts/prepare_server_artifacts.sh ]]; then
scripts/prepare_server_artifacts.sh
else
echo "No script found to prepare server artifacts"
exit 1
fi
- name: Set up Depot CLI
uses: depot/setup-action@v1

Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,18 @@ jobs:
- name: Set Commit Message
env:
EVENT_COMMITS: ${{ toJson(github.event.commits[0].message) }}
COMMIT_INFO_AUTHOR: ${{ github.event.commits[0].author.name }}
run: |
if [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'workflow_dispatch' ]]; then
if [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=$COMMIT_INFO_MESSAGE" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=Workflow run on PR# ${{ inputs.pr }}" >> $GITHUB_ENV
else
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV
if [[ "$EVENT_COMMITS" == "null" ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by $COMMIT_INFO_AUTHOR" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
COMMIT_FIRST_LINE=$(echo "$EVENT_COMMITS" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')
echo "COMMIT_INFO_MESSAGE=$COMMIT_FIRST_LINE" >> $GITHUB_ENV
fi
fi
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,18 @@ jobs:
- name: Set Commit Message
env:
EVENT_COMMITS: ${{ toJson(github.event.commits[0].message) }}
COMMIT_INFO_AUTHOR: ${{ github.event.commits[0].author.name }}
run: |
if [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{github.event_name}} == 'workflow_dispatch' ]]; then
if [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'repository_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=$COMMIT_INFO_MESSAGE" >> $GITHUB_ENV
elif [[ ${{ inputs.pr }} -ne 0 && ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "COMMIT_INFO_MESSAGE=Workflow run on PR# ${{ inputs.pr }}" >> $GITHUB_ENV
else
if [[ '${{env.EVENT_COMMITS}}' == 'null' ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by ${{ env.COMMIT_INFO_AUTHOR }}" >> $GITHUB_ENV
if [[ "$EVENT_COMMITS" == "null" ]]; then
echo "COMMIT_INFO_MESSAGE=${{ github.event_name }} by $COMMIT_INFO_AUTHOR" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=$(echo \"${{ env.EVENT_COMMITS }}\" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')" >> $GITHUB_ENV
COMMIT_FIRST_LINE=$(echo "$EVENT_COMMITS" | awk -F '\\\\n' '{print $1}' | sed 's/^\"//')
echo "COMMIT_INFO_MESSAGE=$COMMIT_FIRST_LINE" >> $GITHUB_ENV
fi
fi
Expand Down
125 changes: 95 additions & 30 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,39 +178,104 @@ jobs:
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi
args=()
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi
if ! mvn test "${args[@]}"; then
echo "Generating failed test list:"
failed_tests_file="$PWD/failed-server-tests.txt"
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi
args=()
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi
# Run tests and capture logs
mvn test "${args[@]}" | tee mvn_test.log
# Check for "BUILD FAILURE" in the mvn_test.log
if grep -q "BUILD FAILURE" mvn_test.log; then
test_result="failed"
else
test_result="passed"
fi
echo "test_result variable value: ${test_result}"
# Prepare output file for failed tests and ensure a fresh file is created
OUTPUT_FILE="failed-server-tests.txt"
rm -f "$OUTPUT_FILE"
touch "$OUTPUT_FILE"
failed_modules=()
skipped_modules=()
# Process mvn_test.log for FAILURE and SKIPPED statuses
while IFS= read -r line; do
if [[ $line == *"FAILURE"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
failed_modules+=("$module_name")
elif [[ $line == *"SKIPPED"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
skipped_modules+=("$module_name")
fi
done < mvn_test.log
echo "Failed Modules: ${failed_modules[*]}"
echo "Skipped Modules: ${skipped_modules[*]}"
# Handle older approach for reading failed tests from XML files
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
| sort -u \
| tee "$failed_tests_file"
echo "Saved to $failed_tests_file"
if [[ -s $failed_tests_file ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$failed_tests_file"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"
# Add a comment to the PR with the list of failed tests.
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
| tee "$failed_tests_from_xml"
# Filter out failed modules and add only relevant tests to the final failed list
for module in "${failed_modules[@]}"; do
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
done
# Include all skipped module test files in the final list
for module in "${skipped_modules[@]}"; do
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
for module_directory in $module_directories; do
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
for class_name in $test_classes; do
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
echo "${class_name}#" >> "$OUTPUT_FILE"
fi
done
done
done
# Combine the XML file test cases and skipped module test files into the final output file
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"
# Print the final output
cat "$OUTPUT_FILE"
if [[ -s $OUTPUT_FILE ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$OUTPUT_FILE"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"
# Post a comment to the PR
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
fi
exit 1
fi
# Fail the script if tests did not pass
if [[ "$test_result" == "failed" ]]; then
echo "Tests failed, exiting with status 1."
exit 1
fi
# Set status = failedtest
- name: Set fail if there are test failures
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import {
agHelper,
gitSync,
homePage,
} from "../../../../support/Objects/ObjectsCore";

let wsName: string;
let appName: string;
let repoName: string;

describe(
"Git Persist Branch",
{
tags: ["@tag.Git", "@tag.GitPersistBranch"],
},
function () {
before(() => {
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
wsName = "GitPB-" + uid;
appName = "GitPB1-" + uid;
homePage.CreateNewWorkspace(wsName, true);
homePage.CreateAppInWorkspace(wsName, appName);
gitSync.CreateNConnectToGit("test-git-perssit-branch", true, true);
cy.get("@gitRepoName").then((resRepoName) => {
repoName = resRepoName.toString();
homePage.NavigateToHome();
});
});
});
it("Check if branch persist after changing branch and exiting the app", function () {
featureFlagIntercept({ release_git_persist_branch_enabled: true }, true);
homePage.EditAppFromAppHover(appName);
gitSync.CreateGitBranch("b1", false);
cy.get("@gitbranchName").then((resBranchName) => {
const branchName = resBranchName.toString();
homePage.NavigateToHome();
homePage.EditAppFromAppHover(appName);
gitSync.AssertBranchName(branchName);
gitSync.AssertBranchNameInUrl(branchName);
});
});
},
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { featureFlagIntercept } from "../../../../../support/Objects/FeatureFlags";
import * as _ from "../../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
EntityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe(
});

it("3. Verify applying style in one line should be observed in next line", function () {
agHelper.GetNClick(locators._richText_Text_Color);
agHelper.GetNClick(locators._richText_Text_Color("Black"));
agHelper.GetNClick(locators._richText_color("Red"));
agHelper
.GetElement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ describe(
cy.get('[aria-label="Underline"]').should("exist");

//Check if button for Background Color is rendered only once within the Toolbar of RTE widget
cy.get('[data-mce-name="backcolor"]').should("have.length", 1);
cy.get('[aria-label="Background color Black"]').should("have.length", 1);

//Check if button for Text Color is rendered only once within the Toolbar of RTE widget
cy.get('[data-mce-name="forecolor"]').should("have.length", 1);
cy.get('[aria-label="Text color Black"]').should("have.length", 1);
});

it("6. Check if able to add an emoji through toolbar", () => {
cy.get('[data-mce-name="overflow-button"]').click({ force: true });
cy.wait(500);
cy.get('[data-mce-name="emoticons"]').click({ force: true });
cy.wait(500);
cy.get('[data-mce-tooltip="grinning"]').click({ force: true });
cy.get('[aria-label="Reveal or hide additional toolbar items"]').click({
force: true,
});
cy.get('[aria-label="Emojis"]').click({ force: true });
cy.get('[aria-label="grinning"]').click({ force: true });
const getEditorContent = (win) => {
const tinyMceId = "rte-component-vw4zehojqt";
const editor = win.tinymce.EditorManager.get(tinyMceId);
Expand Down
10 changes: 5 additions & 5 deletions app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ export class CommonLocators {
`.uppy-Informer p:contains('${msg}')`;
_fileUploadAddMore = ".uppy-DashboardContent-addMore";
_buttonText = ".bp3-button-text";
_richText_TitleBlock = "[data-mce-name='blocks']";
_richText_Heading = "[aria-label='Heading 1']";
_richText_TitleBlock = "[aria-label='Block Paragraph']";
_richText_Heading = "[title='Heading 1']";
_richText_Label_Text = ".tox-tbtn__select-label";
_richText_Text_Color =
'[data-mce-name="forecolor"] .tox-split-button__chevron';
_richText_color = (value: string) => `[data-mce-name="${value}"]`;
_richText_Text_Color = (color: string) =>
`[aria-label="Text color ${color}"] .tox-split-button__chevron`;
_richText_color = (value: string) => `[title="${value}"]`;
_richText_line = "#tinymce p span";
_treeSelectedContent = ".rc-tree-select-selection-item-content";
_switcherIcon = ".switcher-icon";
Expand Down
12 changes: 12 additions & 0 deletions app/client/cypress/support/Pages/GitSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,4 +453,16 @@ export class GitSync {
}
this.CloseGitSyncModal();
}

public AssertBranchName(branch: string) {
this.agHelper.AssertElementVisibility(this._branchButton);
this.agHelper.AssertContains(branch);
}

public AssertBranchNameInUrl(branch: string) {
cy.location("search")
.then((searchParams) => new URLSearchParams(searchParams))
.invoke("get", "branch")
.should("equal", branch);
}
}
13 changes: 10 additions & 3 deletions app/client/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function parseConfig() {
return "";
}

const LOG_LEVELS = ["debug", "error"];
const CONFIG_LOG_LEVEL_INDEX = 1;

module.exports = {
setupFiles: ["jest-canvas-mock", "<rootDir>/test/__mocks__/reactMarkdown.tsx"],
setupFiles: [
"jest-canvas-mock",
"<rootDir>/test/__mocks__/reactMarkdown.tsx",
],
roots: ["<rootDir>/src"],
transform: {
"^.+\\.(png|js|ts|tsx)$": "ts-jest",
Expand All @@ -17,7 +21,7 @@ module.exports = {
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", "css"],
moduleDirectories: ["node_modules", "src", "test"],
transformIgnorePatterns: [
"<rootDir>/node_modules/(?!codemirror|konva|react-dnd|dnd-core|@babel|(@blueprintjs)|@github|lodash-es|@draft-js-plugins|react-documents|linkedom|assert-never|axios)",
"<rootDir>/node_modules/(?!codemirror|konva|react-dnd|dnd-core|@babel|(@blueprintjs)|@github|lodash-es|@draft-js-plugins|react-documents|linkedom|assert-never|axios|usehooks-ts)",
],
moduleNameMapper: {
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js",
Expand Down Expand Up @@ -98,7 +102,10 @@ module.exports = {
fusioncharts: {
licenseKey: parseConfig("__APPSMITH_FUSIONCHARTS_LICENSE_KEY__"),
},
enableMixpanel: parseConfig("__APPSMITH_SEGMENT_KEY__"),
mixpanel: {
enabled: parseConfig("__APPSMITH_SEGMENT_KEY__"),
apiKey: parseConfig("__APPSMITH_MIXPANEL_KEY__"),
},
algolia: {
apiId: parseConfig("__APPSMITH_ALGOLIA_API_ID__"),
apiKey: parseConfig("__APPSMITH_ALGOLIA_API_KEY__"),
Expand Down
Loading

0 comments on commit 62b35bd

Please sign in to comment.