Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Theming Selected new Font is reverted whenever Color is removed #36119

Merged
merged 6 commits into from
Sep 6, 2024

Conversation

jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Sep 4, 2024

Fixes #15007

/ok-to-test tags="@tag.Theme"

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10733545727
Commit: dec2147
Cypress dashboard.
Tags: @tag.Theme
Spec:


Fri, 06 Sep 2024 06:48:00 UTC

Summary by CodeRabbit

  • New Features

    • Enhanced theme validation for the multi-select widget, improving the robustness of theme-related tests.
    • Added new locators for featured themes to enhance testing capabilities.
  • Bug Fixes

    • Reactivated a previously skipped test case to validate font consistency across the application.
  • Refactor

    • Optimized color change handling in the ColorPicker component for better performance and reliability.
    • Refactored theme color control logic for improved maintainability and clarity.
  • Improvements

    • Enhanced type safety in theme properties to prevent misconfigurations.
    • Improved testability of the ThemeCard and ThemeSelector components with new attributes for automated testing.

@github-actions github-actions bot added App Theming Product Items that are related to the App level theming controls epic Bug Something isn't working CI impacted Issues that cause CI failures and need to be addressed on priority by respective pods Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Production Widgets & Accelerators Pod Issues related to widgets & Accelerators labels Sep 4, 2024
Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

The recent changes encompass enhancements to the theming functionality within the application, focusing on the multi-select widget's theme validation, optimizations in color handling, and adjustments to theme management across various components. Key updates include the activation of previously skipped test cases, restructuring of theme validation logic, and improvements in performance through optimized function handling.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/... Activated test cases for theme validation, improved theme application checks, and streamlined code.
app/client/src/components/propertyControls/ColorPickerComponentV2.tsx Refactored color change handling for performance improvements using useMemo and useCallback.
app/client/src/entities/AppTheming/index.ts Updated AppThemeProperties interface to enhance type safety by restricting color key types.
app/client/src/pages/Editor/ThemePropertyPane/ThemeEditor.tsx Adjusted useEffect dependencies for improved theme update responsiveness.
app/client/src/pages/Editor/ThemePropertyPane/ThemeCard.tsx Added data-testid attribute to enhance testability of the ThemeCard component.
app/client/src/pages/Editor/ThemePropertyPane/ThemeSelector.tsx Added data-testid attribute to improve testability for the featured themes section.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ThemeEditor
    participant ColorPicker
    participant ThemeColorControl

    User->>ThemeEditor: Select Theme
    ThemeEditor->>ColorPicker: Update Theme Properties
    ColorPicker->>ThemeColorControl: Change Color
    ThemeColorControl->>ThemeEditor: Apply Color Change
    ThemeEditor->>User: Display Updated Theme
Loading

Assessment against linked issues

Objective Addressed Explanation
Previous selection should not be removed when changing other properties (15007) The changes focus on theme handling but do not explicitly address the bug described.

🎨 In the realm of themes, colors dance and play,
A new dawn of changes brightens the way.
With functions refined and logic so neat,
Theming's a joy, oh what a treat!
Colors and fonts in harmony blend,
In this vibrant world, let creativity extend! 🌈


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jsartisan jsartisan added the ok-to-test Required label for CI label Sep 4, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (1)
app/client/src/components/propertyControls/ColorPickerComponentV2.tsx (1)

370-374: Great optimization by using useMemo for memoization! Just one small suggestion.

Instead of depending on the entire props object, consider destructuring only the required props as dependencies. This will ensure that debouncedOnChange is only recreated when those specific props change, avoiding unnecessary recreations.

For example:

-}, [props]);
+}, [props.changeColor]);
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7d7a601 and efa3a5b.

Files selected for processing (5)
  • app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (3 hunks)
  • app/client/src/components/propertyControls/ColorPickerComponentV2.tsx (2 hunks)
  • app/client/src/entities/AppTheming/index.ts (1 hunks)
  • app/client/src/pages/Editor/ThemePropertyPane/ThemeEditor.tsx (2 hunks)
  • app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx (2 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (11)
app/client/src/entities/AppTheming/index.ts (1)

70-70: Great work on enhancing type safety! 👍

The change in the colors property of the AppThemeProperties interface is a valuable improvement. By using Exclude<string, number> as the key type, you ensure that only non-numeric string keys can be used within the colors object.

This enhancement prevents potential runtime errors or misconfigurations that could arise from unintended usage of numeric keys in theming properties. It enforces stricter adherence to the expected key types, making the code more robust and maintainable.

Well done on implementing this type-safe change! 🌟

app/client/src/pages/Editor/ThemePropertyPane/controls/ThemeColorControl.tsx (5)

2-2: Approved: The import changes look good.

  • Using useCallback for memoizing callback functions is a good practice for optimizing rendering.
  • Importing objectKeys from @appsmith/utils helps maintain consistency in utility usage across the codebase.

Also applies to: 9-9


37-46: Great work with the onColorClick function!

  • Memoizing the function with useCallback is a good practice for optimizing rendering.
  • Using a data- attribute to store the color name is a clean way to associate data with DOM elements.
  • The logic for toggling autoFocus based on the selected color is clear and concise.

48-62: The onChangeColor function looks great!

  • Memoizing the function with useCallback is a good practice for optimizing rendering.
  • The function correctly updates the theme object by creating a new object with the updated color property, while preserving other existing properties.
  • This approach ensures that the theme remains immutable and only the relevant parts are updated.

67-82: The changes in the color box rendering logic look good.

  • Using objectKeys instead of Object.keys maintains consistency with the utility functions used in the codebase.
  • Adding the data-color-name attribute to the ColorBox component allows for better event handling and data management in the onColorClick function.

89-89: The changes in the ColorPickerComponent look good.

  • Using the memoized onChangeColor function as the changeColor prop ensures that the color picker component receives a stable reference to the callback function, preventing unnecessary re-renders.
  • Adding the data-color attribute to the ColorPickerComponent provides additional data for testing and debugging purposes.

Also applies to: 91-91

app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (2)

15-15: Good work declaring the themeColor variable.

The variable declaration looks good.


100-100: Great job enabling the test case!

It's good to see that the previously skipped test case is now active, indicating that the related bug has been fixed.

app/client/src/pages/Editor/ThemePropertyPane/ThemeEditor.tsx (2)

94-94: Verify the impact of the dependency changes on the onClickChangeThemeButton function.

The useEffect hook dependencies have been updated to include dispatch and themingStack instead of setAppThemingModeStackAction. This change indicates a potential shift in how the theming mode stack is managed, possibly allowing for more dynamic updates based on the current state of the theming stack and the dispatch function.

To verify the impact, please run the following script:

The expected results will confirm that dispatch and themingStack are being used correctly in the setAppThemingModeStackAction call, ensuring the theming mode stack is updated dynamically based on the current state.

Verification successful

Let's correct the file type and adjust the search pattern to verify the impact of the dependency changes. We'll re-run the scripts to gather the necessary information.


The dependency changes in the useEffect hook are correctly implemented.

The inclusion of dispatch and themingStack as dependencies in the useEffect hook ensures that the onClickChangeThemeButton function can dynamically respond to changes in the theming stack. This is confirmed by their usage in the setAppThemingModeStackAction call, which updates the theming mode stack based on the current state. This change enhances the dynamic management of the theming stack, ensuring that the UI reflects the latest theme settings.

  • The dispatch function is used to call setAppThemingModeStackAction with a modified themingStack.
  • The themingStack is sliced before being passed to setAppThemingModeStackAction.

These changes are crucial for maintaining the correct state of the theming mode stack.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `dispatch` and `themingStack` in the `onClickChangeThemeButton` function.

# Test 1: Search for the usage of `dispatch`. Expect: Usage in the `setAppThemingModeStackAction` call.
rg --type typescript -A 5 $'dispatch' | rg $'setAppThemingModeStackAction'

# Test 2: Search for the usage of `themingStack`. Expect: Usage in the `setAppThemingModeStackAction` call.
rg --type typescript -A 5 $'themingStack' | rg $'setAppThemingModeStackAction'

Length of output: 215


Script:

#!/bin/bash
# Description: Verify the usage of `dispatch` and `themingStack` in the `onClickChangeThemeButton` function.

# Test 1: Search for the usage of `dispatch`. Expect: Usage in the `setAppThemingModeStackAction` call.
rg --type ts -A 5 'dispatch' | rg 'setAppThemingModeStackAction'

# Test 2: Search for the usage of `themingStack`. Expect: Usage in the `setAppThemingModeStackAction` call.
rg --type ts -A 5 'themingStack' | rg 'setAppThemingModeStackAction'

Length of output: 498


79-79: Verify the impact of the dependency changes on the updateSelectedTheme function.

The useEffect hook dependencies have been updated to include applicationId and dispatch instead of updateSelectedAppThemeAction. This change suggests a shift towards ensuring the effect responds to changes in the application ID and the dispatch function.

To verify the impact, please run the following script:

The expected results will confirm that the applicationId and dispatch are being used correctly in the updateSelectedAppThemeAction call, ensuring the theme update logic responds to changes in the application's state.

Verification successful

Let's correct the approach and gather the necessary information to verify the impact of the dependency changes. We'll focus on the updateSelectedTheme function and ensure we're looking at the right context.


Let's broaden our search to ensure we locate the updateSelectedTheme function and verify the usage of applicationId and dispatch.


The dependency changes in the useEffect hook are correctly implemented.

The inclusion of applicationId and dispatch as dependencies ensures that the updateSelectedTheme function responds appropriately to changes in these variables. This is crucial for maintaining the correct application state and ensuring that theme updates are applied as expected.

  • The applicationId and dispatch are used in the updateSelectedAppThemeAction call within the useCallback hook in ThemeEditor.tsx.

This change enhances the responsiveness of the theme update logic based on the application's state. Well done on making this improvement!

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `applicationId` and `dispatch` in the `updateSelectedTheme` function.

# Test 1: Search for the usage of `applicationId`. Expect: Usage in the `updateSelectedAppThemeAction` call.
rg --type typescript -A 5 $'applicationId' | rg $'updateSelectedAppThemeAction'

# Test 2: Search for the usage of `dispatch`. Expect: Usage in the `updateSelectedAppThemeAction` call.
rg --type typescript -A 5 $'dispatch' | rg $'updateSelectedAppThemeAction'

Length of output: 216


Script:

#!/bin/bash
# Description: Locate the `updateSelectedTheme` function and verify the usage of `applicationId` and `dispatch`.

# Step 1: Use `ast-grep` to locate the `updateSelectedTheme` function.
ast-grep --lang ts --pattern $'function updateSelectedTheme($$$) { $$$ }'

# Step 2: Use `rg` to search for `applicationId` and `dispatch` within the `updateSelectedTheme` function context.
rg --type ts -A 10 'function updateSelectedTheme' | rg 'applicationId|dispatch'

Length of output: 156


Script:

#!/bin/bash
# Description: Search for the `updateSelectedTheme` function across the codebase and verify the usage of `applicationId` and `dispatch`.

# Step 1: Use `rg` to search for the `updateSelectedTheme` function name across the codebase.
rg 'updateSelectedTheme'

# Step 2: Once located, examine the context to verify the usage of `applicationId` and `dispatch`.
rg --type ts -A 10 'updateSelectedTheme' | rg 'applicationId|dispatch'

Length of output: 1238

app/client/src/components/propertyControls/ColorPickerComponentV2.tsx (1)

547-559: Excellent work with the handleChangeColor function!

  • Using useCallback for memoization is a great performance optimization. It prevents unnecessary recreations of the function on each render.
  • The dependency on debouncedOnChange is correctly specified.
  • The check for empty input value is a good addition. It prevents the function from proceeding with empty input, avoiding unnecessary calls to debouncedOnChange.
  • Validating the color using isValidColor before invoking debouncedOnChange ensures that only valid color values are processed.

Overall, these changes enhance the efficiency and reliability of the color change handling. Well done!

Comment on lines 21 to 29
let themesSection = (sectionName, themeName) =>
"//*[text()='" +
sectionName +
"']/following-sibling::div//*[text()='" +
themeName +
"']";
let applyTheme = (sectionName, themeName) =>
themesSection(sectionName, themeName) +
"/parent::div/following-sibling::div[contains(@class, 't--theme-card')]//div[text()='Apply theme']";
Copy link
Contributor

@coderabbitai coderabbitai bot Sep 4, 2024

Choose a reason for hiding this comment

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

Use data- attributes for selectors instead of XPaths.*

The themesSection and applyTheme functions use XPath selectors to locate elements. As per the additional instructions, it's recommended to use data-* attributes for selectors instead of XPaths.

Please update the functions to use data-* attributes for selectors. For example:

let themesSection = (sectionName, themeName) =>
  `[data-section='${sectionName}'] [data-theme='${themeName}']`;

let applyTheme = (sectionName, themeName) =>
  `${themesSection(sectionName, themeName)} [data-cy='apply-theme-button']`;

Copy link
Contributor

Choose a reason for hiding this comment

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

@jsartisan can you check this suggestions as well please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok let me update it.

Comment on lines 111 to 141
it("3. Apply theme and validate the color", function () {
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
//Change the Theme
cy.get(commonlocators.changeThemeBtn).click({ force: true });
cy.get(themelocator.currentTheme).click({ force: true });
cy.get(".t--theme-card main > main")
.first()
.invoke("css", "background-color")
.then(() => {
cy.get(".t--draggable-multiselectwidgetv2:contains('more')")
.last()
.invoke("css", "background-color")
.then((selectedBackgroudColor) => {
expect("rgba(0, 0, 0, 0)").to.equal(selectedBackgroudColor);
appSettings.ClosePane();
});
});
cy.xpath(applyTheme("Featured themes", "Sunrise"))
.click({ force: true })
.wait(1000);
cy.contains("Applied theme")
.click()
.parent()
.siblings()
.find(".t--theme-card > main > section > div > main")
.eq(0)
.invoke("css", "background-color")
.then((backgroudColor) => {
themeColor = backgroudColor;

console.log({ backgroudColor })
expect(backgroudColor).to.eq("rgb(239, 68, 68)");
});

//Publish the App and validate change of Theme across the app in publish mode
deployMode.DeployApp();
cy.xpath("//div[@id='root']//section/parent::div").should(
"have.css",
"background-color",
"rgb(165, 42, 42)",
);

console.log({ themeColor })

cy.get(".rc-select-selector").click({force: true});
cy.get(".rc-select-item-option-selected .bp3-control-indicator")
.first()
.should("have.css", "background-color", "rgb(239, 68, 68)");
});
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve the test case by following best practices.

The test case can be improved in the following ways:

  1. Use data-* attributes for selectors instead of XPaths and plain strings.
  2. Avoid using arbitrary waits like cy.wait(1000).
  3. Use multiple assertions for the expect statement.

Here's an example of how the test case can be improved:

it("3. Apply theme and validate the color", function () {
  appSettings.OpenAppSettings();
  appSettings.GoToThemeSettings();
  cy.get(commonlocators.changeThemeBtn).click({ force: true });
  
  cy.get("[data-cy='featured-themes-section'] [data-cy='sunrise-theme']")
    .find("[data-cy='apply-theme-button']")
    .click({ force: true });

  cy.contains("Applied theme")
    .click()
    .parent()
    .siblings()
    .find("[data-cy='theme-color']")
    .eq(0)
    .invoke("css", "background-color")
    .then((backgroundColor) => {
      themeColor = backgroundColor;
      expect(backgroundColor).to.eq("rgb(239, 68, 68)");
    });

  deployMode.DeployApp();

  cy.get("[data-cy='multi-select']").click({force: true});
  cy.get("[data-cy='selected-option']")
    .first()
    .should("have.css", "background-color", themeColor)
    .and("eq", "rgb(239, 68, 68)");
});

@jsartisan
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Sep 5, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10714214512.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 36119.
recreate: .

Comment on lines 21 to 29
let themesSection = (sectionName, themeName) =>
"//*[text()='" +
sectionName +
"']/following-sibling::div//*[text()='" +
themeName +
"']";
let applyTheme = (sectionName, themeName) =>
themesSection(sectionName, themeName) +
"/parent::div/following-sibling::div[contains(@class, 't--theme-card')]//div[text()='Apply theme']";
Copy link
Contributor

Choose a reason for hiding this comment

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

@jsartisan can you check this suggestions as well please?

Copy link

github-actions bot commented Sep 5, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10714228036.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 36119.
recreate: .

Copy link

github-actions bot commented Sep 5, 2024

Deploy-Preview-URL: https://ce-36119.dp.appsmith.com

1 similar comment
Copy link

github-actions bot commented Sep 5, 2024

Deploy-Preview-URL: https://ce-36119.dp.appsmith.com

@jsartisan
Copy link
Contributor Author

/ci-test-limit

Copy link

github-actions bot commented Sep 5, 2024

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
app/client/cypress/limited-tests.txt (1)

3-3: Review and Improve Cypress Test Practices

The test file Theme_MultiSelectWidget_spec.js shows some adherence to best practices by using data-* attributes. However, there are several instances of plain string selectors that should be replaced with data-* attributes or locator variables to enhance test robustness. Additionally, avoid using arbitrary wait times like cy.wait(1000) to prevent flaky tests.

  • Replace plain string selectors such as cy.contains("Border") and cy.get(".rc-virtual-list .rc-select-item-option") with data-* attributes or locator variables.
  • Review the use of cy.wait with specific times and consider using network aliases or other strategies to wait for elements to be actionable.

By addressing these points, your tests will be more reliable and maintainable. Keep up the good work and continue refining your testing practices!

Analysis chain

Added test file: Verify adherence to best practices.

The file Theme_MultiSelectWidget_spec.js has been added to the limited tests. Ensure that this test follows best practices for Cypress tests as outlined:

  • Use data-* attributes for selectors.
  • Avoid using cy.wait, cy.pause, and agHelper.sleep().
  • Use locator variables instead of plain strings.
  • Ensure multiple assertions per expect statement.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the adherence to Cypress best practices in Theme_MultiSelectWidget_spec.js.

# Test: Search for non-adherence patterns in the new test file.
rg --type txt -A 5 $'cy.wait|cy.pause|agHelper.sleep|button\[type=submit\]' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

Length of output: 1037


Script:

#!/bin/bash
# Description: Verify the use of data-* attributes and locator variables in Theme_MultiSelectWidget_spec.js.

# Test: Search for the use of data-* attributes in the test file.
rg --type js 'data-' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

# Test: Search for plain string selectors to verify the use of locator variables.
rg --type js -oP 'cy\.(get|contains|xpath)\(["\']([^#\.\[][^"\']+)["\']\)' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

Length of output: 503


Script:

#!/bin/bash
# Description: Verify the use of data-* attributes and locator variables in Theme_MultiSelectWidget_spec.js.

# Test: Search for the use of data-* attributes in the test file.
rg --type js 'data-' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

# Test: Search for plain string selectors to verify the use of locator variables.
rg --type js -oP 'cy\.(get|contains|xpath)\(["\'][^"\']+["\']\)' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

Length of output: 295


Script:

#!/bin/bash
# Description: Verify the use of data-* attributes and locator variables in Theme_MultiSelectWidget_spec.js.

# Test: Search for the use of data-* attributes in the test file.
rg --type js 'data-' app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

# Test: Search for plain string selectors to verify the use of locator variables.
rg --type js -oP "cy\.(get|contains|xpath)\(['\"][^'\"]+['\"]\)" app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js

Length of output: 761

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between efa3a5b and 4d6b70e.

Files selected for processing (5)
  • app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (3 hunks)
  • app/client/cypress/limited-tests.txt (1 hunks)
  • app/client/cypress/locators/ThemeLocators.json (1 hunks)
  • app/client/src/pages/Editor/ThemePropertyPane/ThemeCard.tsx (1 hunks)
  • app/client/src/pages/Editor/ThemePropertyPane/ThemeSelector.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/ThemePropertyPane/ThemeSelector.tsx
Additional context used
Path-based instructions (3)
app/client/cypress/limited-tests.txt (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/locators/ThemeLocators.json (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (6)
app/client/cypress/limited-tests.txt (1)

2-2: Commented out test file: Ensure coverage is maintained.

The test file Fork_Template_spec.js has been commented out. It's important to ensure that the test scenarios covered by this file are either no longer relevant or are covered by other tests. This helps maintain comprehensive test coverage.

app/client/cypress/locators/ThemeLocators.json (1)

13-13: Excellent addition of a new locator!

The new locator "featuredThemeSection" uses a data-testid attribute, which is a best practice in test automation. This ensures that the tests remain robust and maintainable. Well done on enhancing the theming functionality without disrupting existing locators.

app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (2)

Line range hint 19-84: Refactor to avoid using cy.wait and improve selector strategy.

  1. Avoid using cy.wait: The use of cy.wait with arbitrary time values (e.g., cy.wait(1000)) is discouraged as it can lead to flaky tests. Instead, use more deterministic wait conditions such as cy.wait('@alias') where @alias is an alias for a network request.

  2. Improve Selector Strategy: The use of XPath to select elements is not recommended. Instead, use data-* attributes to make the tests more robust and maintainable. For example, replace:

    cy.xpath("//p[text()='App font']/following-sibling::section//div//input")

    with a data-* attribute selector if possible.

  3. Refactor to Use Fixtures and Aliases Properly: The fixture fontData is loaded but not used effectively. Consider using the fixture data directly in your tests or ensure it's used if intended for setup or assertions.

  4. General Best Practices: Ensure that the test descriptions are clear and reflect what is being tested. Also, ensure that assertions are specific and meaningful to avoid false positives.


100-113: Optimize the test case for theme color validation.

  1. Avoid Arbitrary Waits: The use of cy.wait(1000) should be replaced with more deterministic wait conditions. For example, wait for a specific network call to complete or for a UI element to become visible.

  2. Use Data Attributes for Selectors: Replace complex CSS selectors and ensure all selectors are using data-* attributes to improve test stability and readability. For example, replace:

    cy.get(".rc-select-item-option-selected .bp3-control-indicator")

    with a data-* attribute selector.

  3. Improve Assertions: Ensure that assertions are specific and check for meaningful properties. For example, verifying the background-color is good, but also consider checking other style or functional properties related to the theme application.

app/client/src/pages/Editor/ThemePropertyPane/ThemeCard.tsx (2)

180-180: Addition of data-testid attribute enhances testability.

The addition of the data-testid attribute to the main container of the ThemeCard component is a good practice for improving the testability of the component. This attribute allows for easier selection in automated tests, which is crucial for ensuring that the component behaves as expected under various conditions. The attribute value dynamically incorporates the theme's name, which helps in identifying different theme cards in test scenarios.


180-180: Well-structured component logic and use of Redux.

The ThemeCard component is well-structured and makes appropriate use of Redux for state management. The logic for handling theme selection and deletion is clear and effectively uses conditional rendering and event handlers. This structure ensures that the component is maintainable and scalable, which is essential for future enhancements.

Copy link

github-actions bot commented Sep 5, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10714747038.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

@sagar-qa007
Copy link
Contributor

@jsartisan can we please start to use/ci-test-limit-count now onwards? Benefit : No need to run command 2 times and saves a lot of time.

@jsartisan
Copy link
Contributor Author

/ci-test-limit-count run_count=15

Copy link

github-actions bot commented Sep 5, 2024

Copy link

github-actions bot commented Sep 5, 2024

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10715356702.
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉

***** Repeat Run Summary ***** Total Tests with repeat: 45 Total Passed: 45 Total Failed: 0 Total Skipped: 0 *****************************

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (2)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (2)

Line range hint 1-88: Optimize and improve test case structure and practices.

Dear student, let's refine your test case with some best practices:

  1. Replace cy.wait with more deterministic waits: Using arbitrary waits can lead to flaky tests. Instead, use .should() for conditions to stabilize before proceeding.
  2. Use data- attributes instead of XPaths:* This will make your tests more robust and maintainable.
  3. Consider splitting the test case: This test seems to validate multiple theming properties. Splitting it into smaller tests could improve clarity and focus.

Here's a snippet to illustrate replacing cy.xpath:

cy.get('[data-cy="app-font-input"]').click({ force: true });

And replacing cy.wait:

cy.get('[data-cy="border"]').should('have.length', '3');

Line range hint 89-99: Ensure test case independence for font validation.

Dear student, while your intention is clear and the focus is commendable, relying on themeFont set in a previous test can lead to flakiness if tests are run independently. Consider setting themeFont within this test or using a more stable approach to share state across tests, such as Cypress environment variables.

Here's how you can set it within the test:

beforeEach(() => {
  themeFont = 'Inter, sans-serif'; // Set the expected font directly
});
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4d6b70e and 3f7e7b6.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (2 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.

Comment on lines 100 to 115
it("3. Apply theme and validate the color", function () {
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
//Change the Theme
cy.get(commonlocators.changeThemeBtn).click({ force: true });
cy.get(themelocator.currentTheme).click({ force: true });
cy.get(".t--theme-card main > main")
.first()
.invoke("css", "background-color")
.then(() => {
cy.get(".t--draggable-multiselectwidgetv2:contains('more')")
.last()
.invoke("css", "background-color")
.then((selectedBackgroudColor) => {
expect("rgba(0, 0, 0, 0)").to.equal(selectedBackgroudColor);
appSettings.ClosePane();
});
});
cy.get(
`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`,
)
.click({ force: true })
.wait(1000);

//Publish the App and validate change of Theme across the app in publish mode
deployMode.DeployApp();
cy.xpath("//div[@id='root']//section/parent::div").should(
"have.css",
"background-color",
"rgb(165, 42, 42)",
);

cy.get(".rc-select-selector").click({ force: true });
cy.get(".rc-select-item-option-selected .bp3-control-indicator")
.first()
.should("have.css", "background-color", "rgb(239, 68, 68)");
Copy link
Contributor

Choose a reason for hiding this comment

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

Enhance selector consistency and assertion detail in theme color validation test.

Dear student, your test is well-focused but let's make it even better:

  1. Consistent use of selectors: Stick to data-* attributes throughout for consistency.
  2. Enhance assertions: Provide more detailed assertions to ensure that not only the color is correct but also other style properties if relevant.

Example of enhanced assertion:

cy.get('[data-cy="selected-theme-color"]').should('have.css', 'background-color', 'rgb(239, 68, 68)').and('have.css', 'border-color', 'rgb(239, 68, 68)');

`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`,
)
.click({ force: true })
.wait(1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove wait.

znamenskii-ilia
znamenskii-ilia previously approved these changes Sep 5, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f7e7b6 and 8337791.

Files selected for processing (4)
  • app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (3 hunks)
  • app/client/cypress/locators/ThemeLocators.json (1 hunks)
  • app/client/cypress/locators/WidgetLocators.ts (1 hunks)
  • app/client/packages/eslint-plugin/package.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/cypress/locators/ThemeLocators.json
  • app/client/packages/eslint-plugin/package.json
Additional context used
Path-based instructions (2)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/locators/WidgetLocators.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (2)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

58-58: Ensure consistency in font validation across components.

The test case "2. Publish the App and validate Font across the app" is crucial for ensuring that the font settings are consistently applied across the app. It's good to see that the test validates the font family using the themeFont variable. However, ensure that this variable is robustly set and consider adding more detailed assertions to verify other font properties if relevant.

expect(themeFont).to.be.a('string').and.satisfy(msg => msg.startsWith('Inter'));

This will ensure that the font is not only applied but also matches the expected type and format.

Also applies to: 60-60, 63-63

app/client/cypress/locators/WidgetLocators.ts (1)

179-183: Review of New Multi-Select Widget Locators

The newly added multiSelectWidgetLocators are well-defined and adhere to best practices for Cypress testing:

  • Use of data- attributes:* The locators use class selectors which are stable and less likely to change compared to other attributes like id or tags. This is good practice in test automation to ensure that tests are less brittle.
  • Clarity and specificity: The locators are specific enough to uniquely identify elements without being overly complex. This helps in maintaining the tests easier.

However, there are a few improvements and checks you might consider:

  • Verification of selectors: Ensure that these selectors are indeed present in the DOM and are unique to the elements they are supposed to select. This is crucial as any changes in the application's HTML structure could make these selectors invalid.
  • Avoiding XPath where not necessary: It's noted that other locators in the file use XPath, which can be slower and more brittle. It's good that the new locators do not use XPath, and this practice should be continued.

Overall, the addition seems appropriate for the intended testing purposes.

cy.contains("Shadow").click({ force: true });

//Font

Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor: Replace XPath with data- attributes for selectors.*

The use of XPath selectors is discouraged due to their fragility and performance issues. It's better to use data-* attributes, which are more robust and maintainable. For instance:

- cy.xpath("//p[text()='App font']/following-sibling::section//div//input")
+ cy.get('[data-cy="app-font-input"]')

Please update all instances where XPath is used to use data-* attributes instead.

Also applies to: 34-34, 35-35, 36-36, 39-39, 53-53

@@ -1,6 +1,7 @@
const commonlocators = require("../../../../locators/commonlocators.json");
const themelocator = require("../../../../locators/ThemeLocators.json");

import { multiSelectWidgetLocators } from "../../../../locators/WidgetLocators";
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor: Consolidate imports for better maintainability.

It's commendable to keep all related imports together, but consider consolidating them into fewer lines to enhance readability and maintainability. For example:

- import {
-   agHelper,
-   locators,
-   entityExplorer,
-   deployMode,
-   appSettings,
-   theme,
-   draggableWidgets,
- } from "../../../../support/Objects/ObjectsCore";
+ import { agHelper, locators, entityExplorer, deployMode, appSettings, theme, draggableWidgets } from "../../../../support/Objects/ObjectsCore";

Committable suggestion was skipped due to low confidence.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8337791 and dec2147.

Files selected for processing (1)
  • app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (3 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (1)
app/client/cypress/e2e/Regression/ClientSide/ThemingTests/Theme_MultiSelectWidget_spec.js (1)

4-4: Refactor: Consolidate imports for better maintainability.

It's commendable to keep all related imports together, but consider consolidating them into fewer lines to enhance readability and maintainability. For example:

- import {
-   agHelper,
-   locators,
-   entityExplorer,
-   deployMode,
-   appSettings,
-   theme,
-   draggableWidgets,
- } from "../../../../support/Objects/ObjectsCore";
+ import { agHelper, locators, entityExplorer, deployMode, appSettings, theme, draggableWidgets } from "../../../../support/Objects/ObjectsCore";

This change not only simplifies the import statement but also enhances the readability and maintainability of the test code.

Skipped due to learnings
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settingsTe_Spec.ts:33-33
Timestamp: 2024-07-16T08:27:01.667Z
Learning: Follow best practices for Cypress code and e2e automation:
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes, and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.

cy.fixture("fontData").then(function (testdata) {
this.testdata = testdata;
});
agHelper.GetNClick($elem);
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor: Replace XPath with data- attributes for selectors.*

The use of XPath selectors is discouraged due to their fragility and performance issues. It's better to use data-* attributes, which are more robust and maintainable. For instance:

- cy.xpath("//p[text()='App font']/following-sibling::section//div//input")
+ cy.get('[data-cy="app-font-input"]')

Please update all instances where XPath is used to use data-* attributes instead.

Also applies to: 36-42, 55-55

appSettings.ClosePane();
});

//Skipping due to mentioned bug
it.skip("2. Publish the App and validate Font across the app + Bug 15007", function () {
it("2. Publish the App and validate Font across the app", function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Re-enable and update the skipped test case.

The test case "2. Publish the App and validate Font across the app" is currently skipped. Given the PR's focus on ensuring font settings are retained correctly, this test case should be re-enabled and updated to reflect the new functionality. Ensure that the test case validates the font consistency across different app components after theme changes.

Also applies to: 62-71

.last()
.should("have.css", "font-family", themeFont);
deployMode.NavigateBacktoEditor();
});

it.skip("3. Validate current theme feature", function () {
cy.get("#canvas-selection-0").click({ force: true });
it("3. Apply theme and validate the color", function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Optimize theme application and color validation logic.

The test case "3. Apply theme and validate the color" is well-structured to validate the color consistency after theme application. However, consider using more direct selectors and assertions to streamline the process and improve test performance. For example:

- agHelper.GetNClick(`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`)
+ cy.get('[data-cy="theme-card-Sunrise"]').click()

This change not only simplifies the selector but also enhances the readability and maintainability of the test code.

Also applies to: 80-93

@jsartisan jsartisan merged commit f06a82b into release Sep 6, 2024
44 checks passed
@jsartisan jsartisan deleted the chore/fix-multi-select-spec branch September 6, 2024 07:16
hetunandu pushed a commit that referenced this pull request Sep 6, 2024
/ok-to-test tags="@tag.All"

This PR fixes a regression that was added by #36119

<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10736250400>
> Commit: 11ba202
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10736250400&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ServerSide/OnLoadTests/ExecuteAction_Spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Fri, 06 Sep 2024 11:05:42 UTC
<!-- end of auto-generated comment: Cypress test results  -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved color input handling to ensure that empty values are
processed correctly, enhancing color validation functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Theming Product Items that are related to the App level theming controls epic Bug Something isn't working CI impacted Issues that cause CI failures and need to be addressed on priority by respective pods Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production Widgets & Accelerators Pod Issues related to widgets & Accelerators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Theming :: Selected new Font is reverted whenever Color is removed
3 participants