Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import HomePage from "../../../../locators/HomePage";
import { jsEditor, agHelper } from "../../../../support/Objects/ObjectsCore";
import EditorNavigation, {
PageLeftPane,
PagePaneSegment,
} from "../../../../support/Pages/EditorNavigation";
import PageList from "../../../../support/Pages/PageList";

describe(
" To test [Bug]: Function settings of a JS Object are not obeyed when copied/moved to another page #31475",
{ tags: ["@tag.JS"] },
() => {
// Bug: https://github.com/appsmithorg/appsmith/issues/31475
it.skip("Verify if settings are replicated in a copied JS Object", () => {
jsEditor.CreateJSObject("", { prettify: false, toRun: false });

// Step 2: Add a new blank page
PageList.AddNewPage("New blank page");

// Step 3: Navigate back to the source page
EditorNavigation.NavigateToPage("Page1", true);

// Step 4: Switch to the JS Objects segment in the left pane
PageLeftPane.switchSegment(PagePaneSegment.JS);

// Step 5: Enable "Run on page load" for a specific function
jsEditor.EnableDisableAsyncFuncSettings("myFun1");

// Step 6: Copy the JS Object to the target page
agHelper.GetNClick(jsEditor._moreActions, 0, true);
agHelper.HoverElement(
`${HomePage.portalMenuItem}:contains("Copy to page")`,
);
agHelper.GetNClick(`${HomePage.portalMenuItem}:contains("Page2")`);

// Step 7: Refresh the page to ensure the JS Object is updated
agHelper.RefreshPage();

// Step 8: Verify that the "Run on page load" setting is still enabled for the function
jsEditor.VerifyAsyncFuncSettings("myFun1", true);
});
},
);
2 changes: 1 addition & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/VisualTests/JSEditorIndent_spec.js
cypress/e2e/Regression/ClientSide/JSObject/Copied_JSObject_Settings_Bug31475_spec.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Path in limited-tests.txt needs correction

The test file exists but at a different path: app/client/cypress/e2e/Regression/ClientSide/JSObject/Copied_JSObject_Settings_Bug31475_spec.ts

Please update the path in limited-tests.txt to include the full path from the repository root.

🔗 Analysis chain

LGTM! Verify the test file implementation.

The test path aligns with the PR objectives for testing JS Object settings during copy action.

Let's verify the test file exists and follows Cypress best practices:


Test file referenced in limited-tests.txt is missing

The test file cypress/e2e/Regression/ClientSide/JSObject/Copied_JSObject_Settings_Bug31475_spec.ts specified in limited-tests.txt does not exist in the codebase. Let's verify if it's located in a different directory:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test file exists and check for common anti-patterns

# Check if the test file exists
FILE_PATH="cypress/e2e/Regression/ClientSide/JSObject/Copied_JSObject_Settings_Bug31475_spec.ts"
if ! fd "$FILE_PATH"; then
  echo "Error: Test file not found"
  exit 1
fi

# Check for anti-patterns in the test file
echo "Checking for Cypress anti-patterns..."

# Check for cy.wait usage
rg "cy\.wait" "$FILE_PATH"

# Check for cy.pause usage
rg "cy\.pause" "$FILE_PATH"

# Check for agHelper.sleep usage
rg "agHelper\.sleep" "$FILE_PATH"

# Check for it.only usage
rg "it\.only" "$FILE_PATH"

# Check for after/afterEach blocks
rg "after(Each)?\s*\(" "$FILE_PATH"

# Check for proper selector usage (avoid plain strings)
rg "cy\.(get|contains|find)\(['\"]" "$FILE_PATH"

Length of output: 1668


Script:

#!/bin/bash
# Search for the test file by name
fd "Copied_JSObject_Settings_Bug31475_spec.ts"

# Search for any file containing the bug number
fd -t f "31475"

# Search for similar test files in the JSObject directory
fd -t f . "app/client/cypress" -e ts -e js | rg "JSObject.*spec"

Length of output: 1007

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

Expand Down