Skip to content

Commit

Permalink
Merge branch 'release' into fix/skip-redudant-code-from-js-object-update
Browse files Browse the repository at this point in the history
  • Loading branch information
“sneha122” committed Nov 5, 2024
2 parents 0b19764 + 6660bd9 commit ed54f78
Show file tree
Hide file tree
Showing 100 changed files with 1,984 additions and 1,000 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-test-custom-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
working-directory: "."
run: |
sudo /etc/init.d/ssh stop ;
sudo systemctl disable --now ssh.socket
mkdir -p ~/git-server/keys
ted_tag="${{inputs.ted_tag}}"
docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/test-vulnerabilities-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,85 +29,6 @@ jobs:
- name: Install pg
run: npm install pg

- name: Fetch vulnerability data
id: vulnerability_data
env:
DB_HOST: ${{ secrets.CYPRESS_DB_HOST }}
DB_NAME: ${{ secrets.CYPRESS_DB_NAME }}
DB_USER: ${{ secrets.CYPRESS_DB_USER }}
DB_PWD: ${{ secrets.CYPRESS_DB_PWD }}
uses: actions/github-script@v7
with:
script: |
const { Pool } = require("pg");
const fs = require('fs');
const path = require('path');
const { DB_HOST, DB_NAME, DB_USER, DB_PWD } = process.env;
const pool = new Pool({
user: DB_USER,
host: DB_HOST,
database: DB_NAME,
password: DB_PWD,
port: 5432,
connectionTimeoutMillis: 60000,
});
(async () => {
const client = await pool.connect();
try {
// Fetch vurn_id, product, scanner_tool, and priority from the database
const result = await client.query(`SELECT vurn_id, product, scanner_tool, priority FROM vulnerability_tracking`);
console.log('Vulnerability Data:', result.rows);
// Extract relevant fields from the result
const extractedData = result.rows.map(({ vurn_id, product, scanner_tool, priority }) => ({
vurn_id,
product,
scanner_tool,
priority
}));
console.log('Extracted Vulnerability Data:', extractedData);
// Prepare CSV content
const csvContent = [
['vurn_id', 'product', 'scanner_tool', 'priority'], // Add priority column header
...extractedData.map(row => [row.vurn_id, row.product, row.scanner_tool, row.priority])
]
.map(e => e.join(',')) // Join columns
.join('\n'); // Join rows
// Write to CSV file in workspace
const csvFilePath = path.join(process.env.GITHUB_WORKSPACE, 'vulnerability_base_data.csv');
fs.writeFileSync(csvFilePath, csvContent);
console.log(`Data successfully written to ${csvFilePath}`);
// Prepare TXT content
const txtContent = extractedData
.map(row => `vurn_id: ${row.vurn_id}, product: ${row.product}, scanner_tool: ${row.scanner_tool}, priority: ${row.priority}`)
.join('\n'); // Join rows
// Write to TXT file in workspace
const txtFilePath = path.join(process.env.GITHUB_WORKSPACE, 'vulnerability_base_data.txt');
fs.writeFileSync(txtFilePath, txtContent);
console.log(`Data successfully written to ${txtFilePath}`);
client.release();
return extractedData; // Return the extracted data
} catch (err) {
console.error('Error fetching vulnerability data:', err);
client.release();
}
})();
- name: Upload Vulnerability Data
uses: actions/upload-artifact@v3
with:
name: vulnerability-data
path: |
vulnerability_base_data.csv
vulnerability_base_data.txt
# Run Scout vulnerability data script
- name: Run Scout vulnerability data script
if: always()
Expand Down
2 changes: 2 additions & 0 deletions app/client/.eslintrc.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
],
"plugins": [
"react",
"eslint-plugin-react-compiler",
"@typescript-eslint",
"prettier",
"sort-destructure-keys",
Expand Down Expand Up @@ -41,6 +42,7 @@
"project": "./tsconfig.json"
},
"rules": {
"react-compiler/react-compiler": "warn",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ describe(
formWidgetsPage.datepickerWidget,
widgetsPage.widgetNameSpan,
);

// change the date to next day
cy.get(formWidgetsPage.defaultDate).click();

/**
* setDate--> is a Command to select the date in the date picker
*/

cy.setDate(1);
const nextDay = dayjs().add(1, "days").format("DD/MM/YYYY");
cy.log(nextDay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe(
.contains("This is a test message")
.should("be.visible");
});
_.agHelper.ClickButton("Discard", { index: 0 }); // discard changes
});

it("4. Verify filter condition", () => {
Expand All @@ -159,7 +160,17 @@ describe(

// filter and verify checked rows
cy.getTableV2DataSelector("0", "4").then((selector) => {
cy.get(selector + checkboxSelector).should("be.checked");
_.agHelper.AssertExistingCheckedState(
selector + checkboxSelector,
"true",
);
});

cy.getTableV2DataSelector("1", "4").then((selector) => {
_.agHelper.AssertExistingCheckedState(
selector + checkboxSelector,
"true",
);
});

// Filter and verify unchecked rows
Expand All @@ -170,10 +181,10 @@ describe(
cy.get(publishPage.applyFiltersBtn).click();

cy.getTableV2DataSelector("0", "4").then((selector) => {
cy.get(selector + checkboxSelector).should("not.be.checked");
});
cy.getTableV2DataSelector("1", "4").then((selector) => {
cy.get(selector + checkboxSelector).should("not.be.checked");
_.agHelper.AssertExistingCheckedState(
selector + checkboxSelector,
"false",
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe(
cy.wait(100);
agHelper.ValidateToastMessage("This is a test message");
});
agHelper.ClickButton("Discard", { index: 0 }); // discard changes
});

it("4. Verify filter condition", () => {
Expand All @@ -151,7 +152,11 @@ describe(

// filter and verify checked rows
cy.getTableV2DataSelector("0", "4").then((selector) => {
cy.get(selector + switchSelector).should("be.checked");
agHelper.AssertExistingCheckedState(selector + switchSelector, "true");
});

cy.getTableV2DataSelector("1", "4").then((selector) => {
agHelper.AssertExistingCheckedState(selector + switchSelector, "true");
});

// Filter and verify unchecked rows
Expand All @@ -162,10 +167,7 @@ describe(
cy.get(publishPage.applyFiltersBtn).click();

cy.getTableV2DataSelector("0", "4").then((selector) => {
cy.get(selector + switchSelector).should("not.be.checked");
});
cy.getTableV2DataSelector("1", "4").then((selector) => {
cy.get(selector + switchSelector).should("not.be.checked");
agHelper.AssertExistingCheckedState(selector + switchSelector, "false");
});
});

Expand Down
1 change: 0 additions & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js

# For running all specs - uncomment below:
#cypress/e2e/**/**/*

Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/support/Pages/JSEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class JSEditor {
);
//Checking JS object was created successfully
this.assertHelper.AssertNetworkStatus("@createNewJSCollection", 201);
cy.get(this._jsObjName).click({ force: true });
this.agHelper.AssertElementVisibility(this._jsObjTxt);
// Assert that the name of the JS Object is focused when newly created
this.agHelper.PressEnter();
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable cypress/no-assigning-return-values */
/* This file is used to maintain comman methods across tests , refer other *.js files for adding common methods */
import { ANVIL_EDITOR_TEST } from "./Constants.js";
import advancedFormat from "dayjs/plugin/advancedFormat";

import EditorNavigation, {
EntityType,
Expand All @@ -18,6 +19,7 @@ import { v4 as uuidv4 } from "uuid";
const dayjs = require("dayjs");
const loginPage = require("../locators/LoginPage.json");
import homePage from "../locators/HomePage";
dayjs.extend(advancedFormat);

const commonlocators = require("../locators/commonlocators.json");
const widgetsPage = require("../locators/Widgets.json");
Expand Down Expand Up @@ -525,7 +527,7 @@ Cypress.Commands.add("getDate", (date, dateFormate) => {
});

Cypress.Commands.add("setDate", (date) => {
const expDate = dayjs().add(date, "days").format("dddd, MMMM DD");
const expDate = dayjs().add(date, "days").format("dddd, MMMM Do, YYYY");
cy.get(`.react-datepicker__day[aria-label^="Choose ${expDate}"]`).click();
});

Expand Down
1 change: 1 addition & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-compiler": "beta",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-perf": "^3.3.2",
"eslint-plugin-sort-destructure-keys": "^1.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,10 @@ const ExternalLinkIcon = importRemixIcon(
async () => import("remixicon-react/ExternalLinkLineIcon"),
);

const InputCursorMoveIcon = importSvg(
async () => import("../__assets__/icons/ads/input-cursor-move.svg"),
);

import PlayIconPNG from "../__assets__/icons/control/play-icon.png";

function PlayIconPNGWrapper() {
Expand Down Expand Up @@ -1363,6 +1367,7 @@ const ICON_LOOKUP = {
"minimize-v3": MinimizeV3Icon,
"maximize-v3": MaximizeV3Icon,
"workflows-mono": WorkflowsMonochromeIcon,
"input-cursor-move": InputCursorMoveIcon,
billing: BillingIcon,
binding: Binding,
book: BookIcon,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@
overflow: auto;
}

code:not(pre code) {
code:not([class*="language-"]) {
padding-inline: var(--inner-spacing-1);
background: var(--color-bg-accent-subtle);
background: var(--color-bg-neutral-subtle);
color: var(--color-fg-negative);
border-radius: var(--border-radius-elevation-3);
word-break: break-word;
white-space: normal;
outline: var(--border-width-1) solid var(--color-bg-neutral-soft);
}

pre {
Expand Down
2 changes: 1 addition & 1 deletion app/client/packages/rts/src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const provider = new NodeTracerProvider({
resource: new Resource({
[ATTR_DEPLOYMENT_NAME]: `${process.env.APPSMITH_DEPLOYMENT_NAME || "self-hosted"}`,
[ATTR_SERVICE_INSTANCE_ID]: `${process.env.HOSTNAME || "appsmith-0"}`,
[ATTR_SERVICE_NAME]: "rts",
[ATTR_SERVICE_NAME]: "appsmith-rts",
}),
});

Expand Down
14 changes: 5 additions & 9 deletions app/client/src/IDE/Components/EditableName/EditableName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@ describe("EditableName", () => {
target: { value: invalidTitle },
});

fireEvent.keyUp(inputElement, KEY_CONFIG.ENTER);

expect(getByRole("tooltip")).toBeInTheDocument();

expect(getByRole("tooltip").textContent).toEqual(validationError);

await userEvent.click(document.body);

expect(getByRole("tooltip").textContent).toEqual("");
expect(getByRole("tooltip").textContent).toEqual(validationError);

expect(exitEditing).toHaveBeenCalled();
expect(onNameSave).not.toHaveBeenCalledWith(invalidTitle);
Expand All @@ -169,7 +167,6 @@ describe("EditableName", () => {
target: { value: invalidTitle },
});

fireEvent.keyUp(inputElement, KEY_CONFIG.ENTER);
fireEvent.keyUp(inputElement, KEY_CONFIG.ESC);

expect(getByRole("tooltip")).toBeInTheDocument();
Expand All @@ -189,9 +186,8 @@ describe("EditableName", () => {
target: { value: invalidTitle },
});

fireEvent.keyUp(inputElement, KEY_CONFIG.ENTER);
fireEvent.focusOut(inputElement);
expect(getByRole("tooltip").textContent).toEqual("");
expect(getByRole("tooltip").textContent).toEqual(validationError);
expect(exitEditing).toHaveBeenCalled();
expect(onNameSave).not.toHaveBeenCalledWith(invalidTitle);
});
Expand All @@ -201,12 +197,12 @@ describe("EditableName", () => {
const input = getByRole("textbox");

fireEvent.change(input, { target: { value: "" } });
fireEvent.keyUp(input, KEY_CONFIG.ENTER);

expect(onNameSave).not.toHaveBeenCalledWith("");
expect(getByRole("tooltip")).toHaveTextContent(
"Please enter a valid name",
);
fireEvent.keyUp(input, KEY_CONFIG.ENTER);

expect(onNameSave).not.toHaveBeenCalledWith("");
});
});
});
Loading

0 comments on commit ed54f78

Please sign in to comment.