-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
test: to check CI failure analysis for analytics spec #38061
Conversation
WalkthroughThis pull request introduces two new files containing end-to-end tests for JavaScript libraries within client applications. The tests cover functionalities such as library installation, usage, and uninstallation, including specific libraries like moment.js and jspdf. Additionally, the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts
(1 hunks)app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.ts
(1 hunks)app/client/cypress/limited-tests.txt
(1 hunks)
🧰 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/e2e/Regression/ClientSide/JSLibrary/Library_Test_Git_spec.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.
app/client/cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.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 (1)
app/client/cypress/limited-tests.txt (1)
2-2
: Update to Limited Tests List Approved
Changing the test focus from Fork_Template_spec.js
to Analytics_spec.js
is appropriate.
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
agHelper.WaitUntilAllToastsDisappear(); | ||
deployMode.NavigateBacktoEditor(); | ||
}); | ||
|
||
it("2. Verify install/uninstall of Library ", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibraryViaURL( | ||
"https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", | ||
"swiper", | ||
); | ||
agHelper.WaitUntilAllToastsDisappear(); | ||
installer.uninstallLibrary("swiper"); | ||
installer.assertUnInstall("swiper"); | ||
}); | ||
|
||
it("3. Verify jspdf library", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibrary("jspdf", "jspdf"); | ||
jsEditor.CreateJSObject( | ||
`export default { | ||
genPDF: () => { | ||
const doc = new jspdf.jsPDF(); | ||
doc.text('Users', 20, 20); | ||
doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); | ||
download(doc.output(), 'users_list.pdf'); | ||
} | ||
}`, | ||
{ | ||
paste: true, | ||
completeReplace: true, | ||
toRun: false, | ||
shouldCreateNewJSObj: true, | ||
prettify: true, | ||
}, | ||
); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
propPane.EnterJSContext( | ||
"onClick", | ||
`{{JSObject2.genPDF();}}`, | ||
true, | ||
false, | ||
); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
deployMode.NavigateBacktoEditor(); | ||
}); | ||
|
||
it("4. Verify deleting jspdf library deletes all its references as well", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.uninstallLibrary("jspdf"); | ||
installer.assertUnInstall("jspdf"); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
|
||
if (CURRENT_REPO === REPO.EE) { | ||
agHelper.ValidateToastMessage( | ||
'"jspdf" is undefined . Please fix JSObject2.genPDF.', | ||
); | ||
} else { | ||
agHelper.ValidateToastMessage("jspdf is not defined"); | ||
} | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
if (CURRENT_REPO === REPO.EE) { | ||
agHelper.ValidateToastMessage( | ||
'"jspdf" is undefined . Please fix JSObject2.genPDF.', | ||
); | ||
} else { | ||
agHelper.WaitUntilToastDisappear("jspdf is not defined"); | ||
} | ||
deployMode.NavigateBacktoEditor(); | ||
// Install jspdf and verify references are working | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibrary("jspdf", "jspdf"); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
deployMode.NavigateBacktoEditor(); | ||
}); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Refactor to Eliminate Duplicate Test Cases
This test suite duplicates test cases from Custom_lib_spec.ts
. To adhere to the DRY principle and improve maintainability, consider refactoring to reuse common test logic and avoid redundancy.
agHelper.WaitUntilAllToastsDisappear(); | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
agHelper.WaitUntilAllToastsDisappear(); | ||
deployMode.NavigateBacktoEditor(); | ||
}); | ||
|
||
it("2. Verify install/uninstall of Library ", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibraryViaURL( | ||
"https://cdn.jsdelivr.net/npm/swiper@11.1.14/+esm", | ||
"swiper", | ||
); | ||
agHelper.WaitUntilAllToastsDisappear(); | ||
installer.uninstallLibrary("swiper"); | ||
installer.assertUnInstall("swiper"); | ||
}); | ||
|
||
it("3. Verify jspdf library", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibrary("jspdf", "jspdf"); | ||
jsEditor.CreateJSObject( | ||
`export default { | ||
genPDF: () => { | ||
const doc = new jspdf.jsPDF(); | ||
doc.text('Users', 20, 20); | ||
doc.table(20, 30, Table1.tableData, Table1.columnOrder, {autoSize: true}); | ||
download(doc.output(), 'users_list.pdf'); | ||
} | ||
}`, | ||
{ | ||
paste: true, | ||
completeReplace: true, | ||
toRun: false, | ||
shouldCreateNewJSObj: true, | ||
prettify: true, | ||
}, | ||
); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
propPane.EnterJSContext( | ||
"onClick", | ||
`{{JSObject2.genPDF();}}`, | ||
true, | ||
false, | ||
); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
deployMode.NavigateBacktoEditor(); | ||
}); | ||
|
||
it("4. Verify deleting jspdf library deletes all its references as well", () => { | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.uninstallLibrary("jspdf"); | ||
installer.assertUnInstall("jspdf"); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
if (CURRENT_REPO === REPO.EE) { | ||
agHelper.ValidateToastMessage( | ||
'"jspdf" is undefined . Please fix JSObject2.genPDF.', | ||
); | ||
} else { | ||
agHelper.ValidateToastMessage("jspdf is not defined"); | ||
} | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
if (CURRENT_REPO === REPO.EE) { | ||
agHelper.ValidateToastMessage( | ||
'"jspdf" is undefined . Please fix JSObject2.genPDF.', | ||
); | ||
} else { | ||
agHelper.WaitUntilToastDisappear("jspdf is not defined"); | ||
} | ||
deployMode.NavigateBacktoEditor(); | ||
// Install jspdf and verify references are working | ||
AppSidebar.navigate(AppSidebarButton.Libraries); | ||
installer.OpenInstaller(); | ||
installer.InstallLibrary("jspdf", "jspdf"); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
|
||
// Deploy | ||
deployMode.DeployApp(); | ||
agHelper.GetNClick(locators._widgetInDeployed("buttonwidget")); | ||
table.ValidateDownloadNVerify("users_list.pdf"); | ||
deployMode.NavigateBacktoEditor(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consolidate Overlapping Tests to Reduce Duplication
The test cases in this file significantly overlap with those in Library_Test_Git_spec.ts
. Consolidating these tests will help prevent duplication and simplify test management.
Summary by CodeRabbit
New Features
Chores