-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: update select component #38954
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
Changes from all commits
e6d8240
cb84f21
8b9cd63
9bbed69
ba025e7
31119fb
6822b13
aec4ab6
b983eeb
d2ac846
567cdc8
2013477
4ed2be1
378ca9d
3538d41
d12f864
90b34cc
4214d1a
f97b937
5c6e115
0c22a01
e9c59b1
aa8b7ac
4bf2720
3363409
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,12 +27,13 @@ describe( | |
|
|
||
| it("2. should check for type of value and widget", () => { | ||
| cy.openPropertyPane(widgetName); | ||
| cy.get(".t--property-control-currency").click(); | ||
| cy.get(".t--property-control-currency").type("usd"); | ||
| cy.openSelectDropdown(".t--property-control-currency"); | ||
| cy.searchSelectDropdown("usd"); | ||
| cy.selectDropdownValue( | ||
| ".t--property-control-currency input", | ||
| ".t--property-control-currency", | ||
| "USD - US Dollar", | ||
| ); | ||
|
|
||
| function enterAndTest(text, expected) { | ||
| cy.get(widgetInput).clear(); | ||
| cy.wait(300); | ||
|
|
@@ -53,7 +54,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "1"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "1"); | ||
|
|
||
| [ | ||
| //[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}:{{CurrencyInput1.isValid}}:{{typeof CurrencyInput1.text}}:{{typeof CurrencyInput1.value}}:{{CurrencyInput1.countryCode}}:{{CurrencyInput1.currencyCode}}] | ||
|
|
@@ -66,7 +67,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "2"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "2"); | ||
|
|
||
| [ | ||
| //[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}:{{CurrencyInput1.isValid}}:{{typeof CurrencyInput1.text}}:{{typeof CurrencyInput1.value}}:{{CurrencyInput1.countryCode}}:{{CurrencyInput1.currencyCode}}] | ||
|
|
@@ -80,10 +81,10 @@ describe( | |
| cy.get(".currency-change-dropdown-trigger").should("contain", "$"); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.get(".t--property-control-currency").click(); | ||
| cy.get(".t--property-control-currency").type("ind"); | ||
| cy.openSelectDropdown(".t--property-control-currency"); | ||
| cy.searchSelectDropdown("ind"); | ||
| cy.selectDropdownValue( | ||
| ".t--property-control-currency input", | ||
| ".t--property-control-currency", | ||
| "INR - Indian Rupee", | ||
| ); | ||
| enterAndTest("100.22", "100.22:100.22:true:string:number:IN:INR"); | ||
|
|
@@ -100,12 +101,13 @@ describe( | |
| .last() | ||
| .click(); | ||
| enterAndTest("100.22", "100.22:100.22:true:string:number:GB:GBP"); | ||
| enterAndTest("100.22", "100.22:100.22:true:string:number:GB:GBP"); | ||
| cy.get(".t--input-currency-change").should("contain", "£"); | ||
| }); | ||
|
|
||
| it("3. should accept 0 decimal option", () => { | ||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "0"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "0"); | ||
| cy.closePropertyPane(); | ||
| cy.wait(500); | ||
|
Contributor
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. Remove cy.wait() commands and use proper assertions. Replace cy.wait() with proper assertions that wait for elements to be in the expected state. Example refactor: -cy.wait(300);
+cy.get(widgetInput).should('not.be.disabled');Also applies to: 121-121, 191-191, 192-192, 193-193, 194-194, 195-195, 196-196, 197-197, 198-198 |
||
| cy.openPropertyPane(widgetName); | ||
|
|
@@ -142,7 +144,7 @@ describe( | |
| `{{CurrencyInput1.text}}:{{CurrencyInput1.value}}`, | ||
| ); | ||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "0"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "0"); | ||
|
|
||
| [ | ||
| //[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}] | ||
|
|
@@ -157,7 +159,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "1"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "1"); | ||
| [ | ||
| //[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}] | ||
| ["100", "100:100"], | ||
|
|
@@ -171,7 +173,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "2"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "2"); | ||
| [ | ||
| //[input, {{CurrencyInput1.text}}:{{CurrencyInput1.value}}] | ||
| ["100", "100:100"], | ||
|
|
@@ -205,7 +207,7 @@ describe( | |
| } | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "0"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "0"); | ||
|
|
||
| [ | ||
| //[input, expected] | ||
|
|
@@ -221,7 +223,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "1"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "1"); | ||
| [ | ||
| //[input, expected] | ||
| ["100", "100"], | ||
|
|
@@ -238,7 +240,7 @@ describe( | |
| }); | ||
|
|
||
| cy.openPropertyPane(widgetName); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed input", "2"); | ||
| cy.selectDropdownValue(".t--property-control-decimalsallowed", "2"); | ||
| [ | ||
| //[input, expected] | ||
| ["100", "100"], | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ describe( | |||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| agHelper.AssertText( | ||||||||||||||||||||||||||
| commonlocators.filePickerDataFormat, | ||||||||||||||||||||||||||
| `${commonlocators.filePickerDataFormat} .rc-select-selection-item .ads-v2-text`, | ||||||||||||||||||||||||||
| "text", | ||||||||||||||||||||||||||
| "Array of Objects (CSV, XLS(X), JSON, TSV)", | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
|
Comment on lines
31
to
35
Contributor
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 Simplify the complex selector path. The selector path could be simplified by using a data-* attribute as per coding guidelines. - agHelper.AssertText(
- `${commonlocators.filePickerDataFormat} .rc-select-selection-item .ads-v2-text`,
- "text",
- "Array of Objects (CSV, XLS(X), JSON, TSV)",
- );
+ // Add data-testid to the element and use it directly
+ agHelper.AssertText(
+ "[data-testid=file-picker-format-text]",
+ "text",
+ "Array of Objects (CSV, XLS(X), JSON, TSV)",
+ );📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -52,13 +52,13 @@ describe( | |||||
|
|
||||||
| it("3. Validate DataType - NUMBER can be entered into Input widget", () => { | ||||||
| cy.openPropertyPane(widgetName); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype input", "Number"); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype", "Number"); | ||||||
|
|
||||||
| cy.get(".t--property-control-required label") | ||||||
| .last() | ||||||
| .click({ force: true }); | ||||||
|
|
||||||
| cy.selectDropdownValue(".t--property-control-datatype input", "Number"); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype", "Number"); | ||||||
|
Contributor
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 Remove duplicate dropdown selection. The dropdown value is already selected in line 55. This duplicate selection is unnecessary. -cy.selectDropdownValue(".t--property-control-datatype", "Number");📝 Committable suggestion
Suggested change
|
||||||
| [ | ||||||
| { | ||||||
| input: "invalid", | ||||||
|
|
@@ -101,7 +101,7 @@ describe( | |||||
|
|
||||||
| it("4. Validate DataType - PASSWORD can be entered into Input widget", () => { | ||||||
| cy.openPropertyPane(widgetName); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype input", "Password"); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype", "Password"); | ||||||
| [ | ||||||
| { | ||||||
| input: "test", | ||||||
|
|
@@ -136,7 +136,7 @@ describe( | |||||
|
|
||||||
| it("5. Validate DataType - EMAIL can be entered into Input widget", () => { | ||||||
| cy.openPropertyPane(widgetName); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype input", "Email"); | ||||||
| cy.selectDropdownValue(".t--property-control-datatype", "Email"); | ||||||
|
|
||||||
| cy.get(".t--property-control-required label") | ||||||
| .last() | ||||||
|
|
||||||
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.
Use data- attributes for selectors.*
According to the coding guidelines, use data-* attributes instead of class selectors.
Example refactor:
Also applies to: 39-39, 40-40, 41-41, 42-42, 43-43, 44-44