Skip to content

Fix tricky field name test failures#2470

Merged
labkey-tchad merged 5 commits intodevelopfrom
fb_customizeViewTestFieldKey
May 30, 2025
Merged

Fix tricky field name test failures#2470
labkey-tchad merged 5 commits intodevelopfrom
fb_customizeViewTestFieldKey

Conversation

@labkey-tchad
Copy link
Copy Markdown
Member

Rationale

CustomizeViewTest

FieldKey didn't fully encode field keys. Now that it does, CustomizeViewTest.setColumns can end up double-encoding them. Test cases shouldn't pass encoded fieldKeys to that method.

  • stacktrace
    org.openqa.selenium.NoSuchElementException: Unable to find element: css=tr.x4-grid-data-row[data-recordid="LASTNAME\">'>'\"<$DSSCRIPT><IMG SRC=\"X\" ONERROR=\"ALERT('8(')\">"]
      at app//org.labkey.test.Locator.lambda$2(Locator.java:391)
      at java.base@17.0.7/java.util.Optional.orElseThrow(Optional.java:403)
      at app//org.labkey.test.Locator.findElement(Locator.java:390)
      at app//org.labkey.test.components.CustomizeView.expandPivots(CustomizeView.java:371)
      at app//org.labkey.test.components.CustomizeView.addItem(CustomizeView.java:382)
      at app//org.labkey.test.components.CustomizeView.addColumn(CustomizeView.java:397)
      at app//org.labkey.test.components.CustomizeView.addColumn(CustomizeView.java:318)
      at app//org.labkey.test.tests.CustomizeViewTest.setColumns(CustomizeViewTest.java:346)
      at app//org.labkey.test.tests.CustomizeViewTest.saveFilterTest(CustomizeViewTest.java:308)
    
ListLookupTest

The TSV Strings used for data import aren't properly quoted and end up importing nothing when the field name starts with a ". Need to use TestDataUtils to generate properly formatted TSVs.

  • stacktrace
    java.lang.AssertionError: List data not as expected after action. expected:<[{"は안%^Look From Lookup Field!#=1E2}]> but was:<[{"は안%^Look From Lookup Field!#= }]>
      at org.junit.Assert.fail(Assert.java:89)
      at org.junit.Assert.failNotEquals(Assert.java:835)
      at org.junit.Assert.assertEquals(Assert.java:120)
      at org.labkey.test.tests.list.ListLookupTest.validateListValues(ListLookupTest.java:272)
      at org.labkey.test.tests.list.ListLookupTest.testWithoutValidatorOrAlternateKeys(ListLookupTest.java:100)
    
GridPanelTest

DataRegionTable expects encoded fieldKeys. Updating doSetup to encode properly revealed numerous other failures. This test requires a significant overhaul to support tricky characters. Removing random character names temporarily.

  • stacktrace
    org.openqa.selenium.NoSuchElementException: Column header named Str[?,и# not found
    For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    Build info: version: '4.33.0', revision: '2c6aaad03a'
    System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.8.0-1029-aws', java.version: '17.0.7'
    Driver info: driver.version: unknown
      at app//org.labkey.test.Locator.findAnyElement(Locator.java:265)
      at app//org.labkey.test.util.DataRegionTable$Elements.getColumnHeader(DataRegionTable.java:1633)
      at app//org.labkey.test.util.DataRegionTable.openFilterDialog(DataRegionTable.java:1034)
      at app//org.labkey.test.util.DataRegionTable.setUpFilter(DataRegionTable.java:1101)
      at app//org.labkey.test.util.DataRegionTable.setUpFilter(DataRegionTable.java:1089)
      at app//org.labkey.test.util.DataRegionTable.setFilter(DataRegionTable.java:1058)
      at app//org.labkey.test.tests.component.GridPanelTest.createSmallSampleType(GridPanelTest.java:199)
      at app//org.labkey.test.tests.component.GridPanelTest.doSetup(GridPanelTest.java:135)
      at app//org.labkey.test.tests.component.GridPanelTest.setupProject(GridPanelTest.java:122)
    
Misc

Including the 👾 character in random field names breaks the Customize View dialog (issue). Removing temporarily to reduce test noise before we branch for 25.6.

Related Pull Requests

Changes

  • Remove unnecessary fieldKey encoding from CustomizeViewTest
  • Fix TSV generation in ListLookupTest
  • Revert addition of random field names to GridPanelTest
  • Exclude emoji character from random field names

Navigate to correct project before each test
53197: Field name with double byte character can cause client side exception in Firefox when trying to customize grid view.
Comment thread src/org/labkey/test/components/CustomizeView.java Outdated
Comment thread src/org/labkey/test/tests/component/GridPanelTest.java
Comment thread src/org/labkey/test/util/TestDataGenerator.java
@labkey-tchad
Copy link
Copy Markdown
Member Author

@labkey-tchad labkey-tchad merged commit 05b4b1c into develop May 30, 2025
8 checks passed
@labkey-tchad labkey-tchad deleted the fb_customizeViewTestFieldKey branch May 30, 2025 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants