-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
chore: removed old flags for airgap instances #36609
Changes from 5 commits
9c009d8
972c1b9
c410ba8
1786523
b92a9d0
63010c6
92ce628
7ffad1b
b956497
a02168b
c2158d8
2bdc8f5
1089048
90a54af
19b10cf
9461218
b30c9bb
126121f
bfbf6bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ describe( | |
); | ||
// validation of data displayed in input widgets based on search value set | ||
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); | ||
Comment on lines
27
to
29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Time for some homework revisions, students! Let's improve our test by avoiding the use of cy.get(".t--property-control-allowsearching input").should('be.visible').click({ force: true }); This way, we're letting Cypress automatically wait for the element to be visible before clicking, which is more reliable than using a fixed wait time. Also applies to: 33-34 |
||
_.table.ExpandIfCollapsedSection("search\\&filters"); | ||
cy.get(".t--property-control-allowsearching input").click({ | ||
force: true, | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ describe( | |
|
||
it("1.1. should test that allow Add new row property is present", () => { | ||
cy.openPropertyPane("tablewidgetv2"); | ||
table.ExpandIfCollapsedSection("addingarow"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Locator Variables Instead of Plain Strings It's important to use locator variables for selectors to enhance maintainability and readability. In the line: table.ExpandIfCollapsedSection("addingarow"); Replace the plain string Apply this change to use a locator variable: -table.ExpandIfCollapsedSection("addingarow");
+table.ExpandIfCollapsedSection(propPane._addingARow); Ensure that |
||
cy.get(".t--property-control-allowaddingarow").should("exist"); | ||
cy.get(".t--property-control-allowaddingarow input").should("exist"); | ||
cy.get(".t--add-new-row").should("not.exist"); | ||
|
@@ -151,6 +152,11 @@ describe( | |
it("1.7. should not hide the header section when add new row button is enabled and another header element is disabled", () => { | ||
cy.get(".t--discard-new-row").click({ force: true }); | ||
//disable all header widgets for the table | ||
["pagination", "search\\&filters", "general", "addingarow"].forEach( | ||
(val) => { | ||
table.ExpandIfCollapsedSection(val); | ||
}, | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expand Sections Using Locator Variables In the loop: ["pagination", "search\\&filters", "general", "addingarow"].forEach(
(val) => {
table.ExpandIfCollapsedSection(val);
},
); Ensure the Refactor as: -["pagination", "search\\&filters", "general", "addingarow"].forEach(
+const sections = [
+ propPane._paginationSection,
+ propPane._searchAndFiltersSection,
+ propPane._generalSection,
+ propPane._addingARowSection,
+];
+sections.forEach((section) => {
table.ExpandIfCollapsedSection(section);
}); Define the locator variables in your locators file. |
||
[ | ||
"Show pagination", | ||
"Allow searching", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ describe( | |
entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); | ||
//propPane.EnterJSContext("Table data", JSON.stringify(this.dataSet.TableInput)); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use locator variables instead of plain strings for selectors It's important to follow best practices in your test code. Using locator variables instead of plain strings enhances maintainability and readability. Let's replace the plain string with a predefined locator variable. Apply this diff to make the improvement: -table.ExpandIfCollapsedSection("search\\&filters");
+table.ExpandIfCollapsedSection(locators.searchAndFiltersSection);
|
||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
table.AddSampleTableData(); | ||
//propPane.EnterJSContext("Table Data", JSON.stringify(this.dataSet.TableInput)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ describe( | |
it("1. Verify Table Filter for 'empty'", function () { | ||
entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to use locator variables instead of plain strings for selectors At line 20, we have: agHelper.GetNClick(".t--property-control-allowfiltering input"); Using plain string selectors can make our tests brittle and harder to maintain. It's important to use locator variables, which promote reuse and make changes easier to manage. Here's how you can update the code: +const allowFilteringToggle = ".t--property-control-allowfiltering input";
...
-agHelper.GetNClick(".t--property-control-allowfiltering input");
+agHelper.GetNClick(allowFilteringToggle); |
||
table.AddSampleTableData(); | ||
propPane.UpdatePropertyFieldValue( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using In line 22, the code uses: agHelper.Sleep(2000); //table to filter & records to disappear Relying on fixed delays can lead to flaky tests because the actual load time may vary. Instead, we should wait for a specific element or condition that indicates the table has finished filtering. Consider replacing the sleep with a wait for the table to become empty: table.WaitForTableEmpty("v2"); This ensures the test proceeds only after the table is fully filtered. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ describe( | |
entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); | ||
//propPane.EnterJSContext("Table data", JSON.stringify(this.dataSet.TableInput)); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Let's improve selector usage by adopting locator variables In line 21, you're directly using a CSS selector To implement this improvement, let's define a locator variable using a Add the following in your locators file (e.g., export const allowFilteringToggle = '[data-cy="t--property-control-allowfiltering"] input'; Then, update line 21 as shown below: - agHelper.GetNClick(".t--property-control-allowfiltering input");
+ agHelper.GetNClick(allowFilteringToggle); |
||
table.AddSampleTableData(); | ||
//propPane.EnterJSContext("Table Data", JSON.stringify(this.dataSet.TableInput)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ describe( | |
it("1. Verify Full table data - download csv and download Excel", function () { | ||
entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Let's use locator variables with data attributes instead of CSS selectors Remember, to make our tests more maintainable and robust, we should use locator variables that utilize |
||
table.AddSampleTableData(); | ||
propPane.UpdatePropertyFieldValue( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ describe( | |
before(() => { | ||
entityExplorer.DragDropWidgetNVerify("tablewidgetv2", 650, 250); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to use locator variables instead of plain strings for selectors. In line 32, you've used a plain string selector in Let's define a locator variable for |
||
propPane.EnterJSContext("Table data", JSON.stringify(data)); | ||
assertHelper.AssertNetworkStatus("@updateLayout"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,8 @@ describe( | |
cy.get(commonlocators.editPropBackButton).click(); | ||
cy.openPropertyPane("tablewidgetv2"); | ||
// Confirm if isSortable is true | ||
_.table.ExpandIfCollapsedSection("sorting"); | ||
|
||
cy.get(commonlocators.isSortable).should("be.checked"); | ||
// Publish App | ||
_.deployMode.DeployApp(); | ||
|
@@ -124,6 +126,7 @@ describe( | |
"Table data", | ||
`{{[{step: 1, task: 1}]}}`, | ||
); | ||
_.table.ExpandIfCollapsedSection("search\\&filters"); | ||
cy.get(".t--property-control-allowfiltering input").click(); | ||
cy.editColumn("step"); | ||
cy.get(".t--table-filter-toggle-btn").click(); | ||
|
@@ -237,6 +240,7 @@ describe( | |
it("7. should check that adding cyclic dependency in the table doesn't crash the app", () => { | ||
//_.deployMode.NavigateBacktoEditor(); | ||
cy.openPropertyPane("tablewidgetv2"); | ||
_.table.ExpandIfCollapsedSection("rowselection"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider Using Locator Variables Instead of Plain Strings Using plain strings like For example: const rowSelectionSection = "rowselection";
_.table.ExpandIfCollapsedSection(rowSelectionSection); This approach improves readability and maintainability of your tests. |
||
|
||
cy.updateCodeInput( | ||
".t--property-control-defaultselectedrow", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ describe( | |
before(() => { | ||
_.entityExplorer.DragDropWidgetNVerify(_.draggableWidgets.TABLE); | ||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
_.table.ExpandIfCollapsedSection("search\\&filters"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to use locator variables instead of plain strings for locators Dear student, to maintain code consistency and adhere to our best practices, please use locator variables instead of plain strings when specifying locators. This enhances the maintainability and readability of the code. You can apply the following change to fix this: - _.table.ExpandIfCollapsedSection("search\\&filters");
+ _.table.ExpandIfCollapsedSection(_.locators.searchAndFiltersSection); If a locator variable for
|
||
_.agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
_.propPane.EnterJSContext("Table data", tableData); | ||
cy.editColumn("completed"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ describe( | |
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 300, 300); | ||
|
||
// turn on filtering for the table - it is disabled by default in this PR(#34593) | ||
table.ExpandIfCollapsedSection("search\\&filters"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remember to use locator variables instead of plain strings. To ensure consistency and maintainability, it's important to use locator variables for selectors. Instead of passing a plain string |
||
agHelper.GetNClick(".t--property-control-allowfiltering input"); | ||
|
||
// Create SQL data-source | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -888,4 +888,20 @@ export class Table { | |
isoFormat, | ||
}; | ||
} | ||
|
||
public ExpandIfCollapsedSection(sectionName: string) { | ||
cy.get(`.t--property-pane-section-collapse-${sectionName}`) | ||
.scrollIntoView() | ||
.then(($element) => { | ||
cy.wrap($element) | ||
.siblings(".bp3-collapse") | ||
.then(($sibling) => { | ||
const siblingHeight = $sibling.height(); // Get the height of the sibling element | ||
|
||
if (!siblingHeight) { | ||
$element.click(); | ||
} | ||
}); | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Now, let's turn our attention to the This method is designed to expand a collapsed section in the property pane if it's not already expanded. While the intention is good, there are a few areas where we can improve:
Let's consider refactoring this method to make it more robust and consistent with the rest of the class. Here's a suggested improvement: - public ExpandIfCollapsedSection(sectionName: string) {
- cy.get(`.t--property-pane-section-collapse-${sectionName}`)
- .scrollIntoView()
- .then(($element) => {
- cy.wrap($element)
- .siblings(".bp3-collapse")
- .then(($sibling) => {
- const siblingHeight = $sibling.height(); // Get the height of the sibling element
-
- if (!siblingHeight) {
- $element.click();
- }
- });
- });
- }
+ public ExpandIfCollapsedSection(sectionName: string) {
+ return this.agHelper.GetElement(`.t--property-pane-section-collapse-${sectionName}`)
+ .then(($element) => {
+ if ($element.siblings(".bp3-collapse").height() === 0) {
+ this.agHelper.ScrollTo(`.t--property-pane-section-collapse-${sectionName}`);
+ this.agHelper.ClickButton($element);
+ }
+ })
+ .catch((error) => {
+ this.agHelper.LogErrorAndFail(`Failed to expand section ${sectionName}: ${error}`);
+ });
+ } This refactored version:
Remember, class, consistency and error handling are key to maintaining a robust test suite!
|
||
} |
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.
Remember to use locator variables and data- attributes instead of CSS selectors*
As we've learned, using locator variables and data-* attributes enhances the maintainability and reliability of our tests. Relying on plain strings and CSS paths can make the tests brittle and harder to maintain. Let's replace the CSS selectors with appropriate locator variables.
Here's how you might adjust the code:
If
commonlocators.onSearchTextChangedToggle
doesn't exist, please consider adding it to your locators file.📝 Committable suggestion