4949import org .labkey .test .components .snd .PackageViewerResult ;
5050import org .labkey .test .components .snd .ProjectViewerResult ;
5151import org .labkey .test .components .snd .SuperPackageRow ;
52+ import org .labkey .test .pages .query .SourceQueryPage ;
5253import org .labkey .test .pages .snd .EditCategoriesPage ;
5354import org .labkey .test .pages .snd .EditPackagePage ;
5455import org .labkey .test .pages .snd .EditProjectPage ;
@@ -2101,7 +2102,7 @@ public void reviseProjectViaUI() throws Exception
21012102 assertFalse ("Unassigned package found assigned." , viewPage .isAssignedPackagePresent (UITEST_PROJECT_SUBPKG2 ));
21022103 }
21032104
2104- private boolean runTestsInAPIFrameWork ()
2105+ private void runTestsInAPIFrameWork ()
21052106 {
21062107 log ("Launching the Testing framework" );
21072108 goToProjectHome ();
@@ -2112,7 +2113,7 @@ private boolean runTestsInAPIFrameWork()
21122113 clickButton ("Run tests" , 0 );
21132114 waitForText ("Total tests:" , 1 , WAIT_FOR_PAGE );
21142115
2115- return isTextPresent ("Complete" ,"Failed tests: 0" );
2116+ assertTextPresent ("Complete" ,"Failed tests: 0" );
21162117 }
21172118
21182119 private String getPermissionTableValue (int row , int col )
@@ -2210,9 +2211,9 @@ public void categoryPermissionsUI() throws Exception
22102211 @ Test
22112212 public void testQueryProvisionedSnapshot ()
22122213 {
2213- String SOURCE_QUERY_NAME = "SND: Source query" ;
2214- String SNAPSHOT_NAME = SOURCE_QUERY_NAME + " Snapshot" ;
2215- String SOURCE_QUERY = "SELECT\n " +
2214+ String sourceQueryName = "SND: Source query" ;
2215+ String snapshotName = sourceQueryName + " Snapshot" ;
2216+ String sourceQuery = "SELECT\n " +
22162217 "lsid AS _key,\n " +
22172218 "SubjectId AS participantid,\n " +
22182219 "date,\n " +
@@ -2223,13 +2224,12 @@ public void testQueryProvisionedSnapshot()
22232224 "kit_type\n " +
22242225 "FROM SND.Categories.Sodium\n " ;
22252226
2226- String UPDATED_SOURCE_QUERY = SOURCE_QUERY .replace (
2227+ String updatedSourceQuery = sourceQuery .replace (
22272228 "amount," ,
22282229 "'8976' AS amount," );
22292230
22302231 log ("Run the tests from the framework for set up" );
2231- if (!runTestsInAPIFrameWork ())
2232- Assert .fail ("Tests failed in the framework" );
2232+ runTestsInAPIFrameWork ();
22332233
22342234 log ("Enable Allow query based dataset snapshots" );
22352235 OptionalFeatureHelper .enableOptionalFeature (createDefaultConnection (), "queryBasedDatasets" );
@@ -2248,12 +2248,12 @@ public void testQueryProvisionedSnapshot()
22482248
22492249 log ("Create source query from study" );
22502250 goToSchemaBrowser ();
2251- createNewQuery ("study" );
2252- setFormElement ( Locator . id ( "ff_newQueryName" ), SOURCE_QUERY_NAME );
2253- selectOptionByText ( Locator . name ( "ff_baseTableName" ), " DataSets" );
2254- clickButton ( "Create and Edit Source" );
2255- setCodeEditorValue ( "queryText" , SOURCE_QUERY );
2256- clickButton ( "Save & Finish" );
2251+ SourceQueryPage querySourcePage = createNewQuery ("study" , null )
2252+ . setName ( sourceQueryName )
2253+ . setBaseTable ( " DataSets" )
2254+ . clickCreate ( );
2255+ querySourcePage . setSource ( sourceQuery )
2256+ . clickSaveAndFinish ( );
22572257
22582258 log ("Create the snapshot" );
22592259 DataRegionTable queryTable = new DataRegionTable .DataRegionFinder (getDriver ()).withName ("query" ).waitFor ();
@@ -2263,7 +2263,7 @@ public void testQueryProvisionedSnapshot()
22632263
22642264 log ("Verify the dataset snapshot" );
22652265 goToProjectHome ();
2266- clickAndWait (Locator .linkWithText (SNAPSHOT_NAME ));
2266+ clickAndWait (Locator .linkWithText (snapshotName ));
22672267 DataRegionTable dataRegionTable = new DataRegionTable .DataRegionFinder (getDriver ()).withName ("Dataset" ).waitFor ();
22682268 Assert .assertEquals ("Incorrect number of rows" , 3 , dataRegionTable .getDataRowCount ());
22692269 Assert .assertEquals ("Incorrect column titles" , Arrays .asList ("ParticipantId" , "_key" , "date" , "amount" , "units" , "kit_type" ),
@@ -2272,13 +2272,12 @@ public void testQueryProvisionedSnapshot()
22722272
22732273 log ("Edit the source query and verify snapshot is updated" );
22742274 goToSchemaBrowser ();
2275- selectQuery ("study" , SOURCE_QUERY_NAME );
2276- clickAndWait (Locator .linkContainingText ("edit source" ));
2277- setCodeEditorValue ("queryText" , UPDATED_SOURCE_QUERY );
2278- clickButton ("Save & Finish" );
2275+ querySourcePage = editSource ("study" , sourceQueryName );
2276+ querySourcePage .setSource (updatedSourceQuery )
2277+ .clickSaveAndFinish ();
22792278
22802279 goToProjectHome ();
2281- clickAndWait (Locator .linkWithText (SNAPSHOT_NAME ));
2280+ clickAndWait (Locator .linkWithText (snapshotName ));
22822281 dataRegionTable = new DataRegionTable .DataRegionFinder (getDriver ()).withName ("Dataset" ).waitFor ();
22832282 Assert .assertEquals ("Incorrect value in amount column" , Arrays .asList ("8976" , "8976" , "8976" ), dataRegionTable .getColumnDataAsText ("amount" ));
22842283 }
0 commit comments