diff --git a/modules/simpletest/resources/views/QWPDemo.html b/modules/simpletest/resources/views/QWPDemo.html index cfb0f9e307..7aa5927b42 100644 --- a/modules/simpletest/resources/views/QWPDemo.html +++ b/modules/simpletest/resources/views/QWPDemo.html @@ -44,6 +44,7 @@
Filter on "Sort" column
Use onRender via ButtonBarOptions
Exclude "skipPrefixes"
+
Show All Rows Limit (Regression #48715)
Get Selected (Regression #41705)
@@ -67,7 +68,11 @@ LABKEY.Domain.get(function() { LABKEY.Domain.get(function() { LABKEY.Domain.get(function() { - showPopulateSuccess(true); + LABKEY.Domain.get(function() { + showPopulateSuccess(true); + }, function() { + showPopulateButton(true); + }, 'Samples', 'sampleDataTest5k'); }, function() { showPopulateButton(true); }, 'Samples', 'sampleDataTest3'); diff --git a/modules/simpletest/resources/web/simpletest/QWPDemo.js b/modules/simpletest/resources/web/simpletest/QWPDemo.js index 5fa3867237..8451123500 100644 --- a/modules/simpletest/resources/web/simpletest/QWPDemo.js +++ b/modules/simpletest/resources/web/simpletest/QWPDemo.js @@ -32,7 +32,8 @@ testFilterOnSortColumn: testFilterOnSortColumn, testButtonBarConfig: testButtonBarConfig, testRespectExcludingPrefixes: testRespectExcludingPrefixes, - testGetSelected: testGetSelected + testAllRowsLimit: testAllRowsLimit, + testGetSelected: testGetSelected, }; var PAGE_OFFSET = 4; @@ -136,11 +137,11 @@ renderTo: RENDERTO, success: function() { var results = $("a:contains('sampleDataTest')"); - if (!results || results.length < 3) { + if (!results || results.length < 4) { alert('Failed to list out all queries in Samples schema'); } else { - LABKEY.Utils.signalWebDriverTest("testSchemaOnly"); + LABKEY.Utils.signalWebDriverTest('testSchemaOnly'); } }, failure: function() { @@ -764,6 +765,7 @@ } function testShowAllTotalRows() { + var loadCount = 0; new LABKEY.QueryWebPart({ title: 'Show All Rows', schemaName: 'Samples', @@ -774,17 +776,19 @@ }, listeners: { render: function(dr) { - if (dr.maxRows != -1) { + loadCount++; + + if (loadCount === 1) { dr.showAllRows(); - } - else { - if (!dr.totalRows) - { + } else if (loadCount === 2) { + if (!dr.totalRows) { alert('Failed test: Show All Rows. totalRows is not set correctly with Show All.'); + return; } - else { - LABKEY.Utils.signalWebDriverTest("testShowAllTotalRows"); - } + + LABKEY.Utils.signalWebDriverTest('testShowAllTotalRows'); + } else { + alert('Failed test: Unexpected number of requests made.'); } } } @@ -982,6 +986,58 @@ }); } + // Issue 48715: Limit Data Region "Show all" to a maximum number of rows + function testAllRowsLimit() { + var loadCount = 0; + new LABKEY.QueryWebPart({ + title: 'Show All Rows Limit (Regression #48715)', + schemaName: 'Samples', + queryName: 'sampleDataTest5k', + removeableFilters: [ + // Initialize with a user filter + LABKEY.Filter.create('Name', 'Sample 5k-5000') + ], + renderTo: RENDERTO, + failure: function() { + alert('Failed test: testAllRowsLimit failed to load'); + }, + listeners: { + render: function(qwp) { + loadCount++; + + if (loadCount === 1) { + // Set the QWP to show all rows + qwp.showAllRows(); + } else if (loadCount === 2) { + // Clear the user filter + qwp.clearFilter('Name'); + } else if (loadCount === 3) { + if (qwp.totalRows !== 5_001) { + alert('Failed test: Expected 5,001 results in query.'); + return; + } + + if (qwp.maxRows !== 5_000) { + alert('Failed test: Expected maxRows to be set to 5,000'); + return; + } + + // Expect to be bound by the "Show all" configuration displaying a maximum amount of rows + const message = qwp.getMessage('info'); + if (!message || message.indexOf('Displaying the first 5,000 rows. Use paging to see more results.') === -1) { + alert('Failed test: Expected message regarding "Show all" boundary did not appear.'); + return; + } + + LABKEY.Utils.signalWebDriverTest('testAllRowsLimit'); + } else { + alert('Failed test: Unexpected number of requests made.'); + } + } + } + }); + } + function testGetSelected() { var loadCount = 0; new LABKEY.QueryWebPart({ diff --git a/modules/simpletest/resources/web/simpletest/QWPDemoData.js b/modules/simpletest/resources/web/simpletest/QWPDemoData.js index 45a215222e..be23504707 100644 --- a/modules/simpletest/resources/web/simpletest/QWPDemoData.js +++ b/modules/simpletest/resources/web/simpletest/QWPDemoData.js @@ -93,10 +93,17 @@ function setUpDomains() { {"Alias": 'alias 6', "Id": 6, "Sort": 50, "Tag": 'blue'}]; var rows2 =[ {"Alias": 'alias 2-1', "Id": 201, "Sort": 1000, "Tag": 'square'}]; var rows3 =[ {"Alias": 'alias 3-1', "Id": 301, "Sort": 500, "Tag": 'Hispanic'}]; + const manyRows = []; + const numRows = 5_001; + for (let i = 0; i < numRows; i++) { + manyRows.push({ Alias: `alias 5k-${i}`, Id: numRows + i, Name: `Sample 5k-${i}`, Sort: numRows + i, Tag: 'many rows' }); + } sampleSetDomainTypeTest('sampleDataTest1', rows1, 'A sample type with color tags', function() { sampleSetDomainTypeTest('sampleDataTest2', rows2, 'A sample type with shape tags', function(){ sampleSetDomainTypeTest('sampleDataTest3', rows3, 'A sample type with race tags', function(){ - location.reload(); + sampleSetDomainTypeTest('sampleDataTest5k', manyRows, `A sample type with ${manyRows.length.toLocaleString()} rows`, function(){ + location.reload(); + }); }); }); }, ([ @@ -113,7 +120,7 @@ function setUpDomains() { function dropDomains() { var completeCt = 0; - var queries = ["sampleDataTest1", "sampleDataTest2", "sampleDataTest3"]; + var queries = ['sampleDataTest1', 'sampleDataTest2', 'sampleDataTest3', 'sampleDataTest5k']; var dropSuccess = function() { dropComplete('dropped'); }; diff --git a/src/org/labkey/test/tests/AbstractQWPTest.java b/src/org/labkey/test/tests/AbstractQWPTest.java index 97d9288978..e1e7ca927a 100644 --- a/src/org/labkey/test/tests/AbstractQWPTest.java +++ b/src/org/labkey/test/tests/AbstractQWPTest.java @@ -22,7 +22,9 @@ import org.openqa.selenium.Alert; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; +import java.time.Duration; import java.util.List; import static org.junit.Assert.assertEquals; @@ -44,7 +46,7 @@ protected void testQWPDemoPage() waitForElement(Locator.button("Populate test data")); clickButton("Populate test data"); WebElement populateMessage = Locator.id("populatemessage").waitForElement(shortWait()); - longWait().until(ExpectedConditions.visibilityOf(populateMessage)).getText(); + new WebDriverWait(getDriver(), Duration.ofSeconds(60)).until(ExpectedConditions.visibilityOf(populateMessage)).getText(); assertEquals("Test data is populated!", populateMessage.getText()); log("Testing " + QWP_SCHEMA_LISTING.getLeft()); diff --git a/src/org/labkey/test/tests/DataRegionTest.java b/src/org/labkey/test/tests/DataRegionTest.java index a255f0ee6b..5443a11aaa 100644 --- a/src/org/labkey/test/tests/DataRegionTest.java +++ b/src/org/labkey/test/tests/DataRegionTest.java @@ -77,6 +77,7 @@ public class DataRegionTest extends AbstractQWPTest Pair.of("Filter on \"Sort\" column", "testFilterOnSortColumn"), Pair.of("Use onRender via ButtonBarOptions", "testButtonBarConfig"), Pair.of("Exclude \"skipPrefixes\"", "testRespectExcludingPrefixes"), + Pair.of("Show All Rows Limit (Regression #48715)", "testAllRowsLimit"), Pair.of("Get Selected (Regression #41705)", "testGetSelected") );