Skip to content

Commit

Permalink
Fix AF tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Benjamin committed Mar 27, 2024
1 parent 284a49b commit 0a028e9
Showing 1 changed file with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ private void testFullTextSearch() throws Exception
String sessionId = info.getKey();
String trackId = info.getValue();


// all
// this should return 143 results. We can't make any other assumptions about the content
String url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=143";
Expand All @@ -580,7 +581,6 @@ private void testFullTextSearch() throws Exception
JSONArray jsonArray = mainJsonObject.getJSONArray("data");
Assert.assertEquals(143, jsonArray.length());


// stringType:
// ref equals A
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3AA";
Expand Down Expand Up @@ -1167,23 +1167,6 @@ private void testFullTextSearch() throws Exception
previousGenomicPosition = currentGenomicPosition;
}

// Genomic position sort descending
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortReverse=true";
beginAt(url);
waitForText("data");
waitAndClick(Locator.tagWithId("a", "rawdata-tab"));
jsonString = getText(Locator.tagWithClass("pre", "data"));
mainJsonObject = new JSONObject(jsonString);
jsonArray = mainJsonObject.getJSONArray("data");

previousGenomicPosition = Long.MAX_VALUE;
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
long currentGenomicPosition = jsonObject.getLong("genomicPosition");
Assert.assertTrue(currentGenomicPosition <= previousGenomicPosition);
previousGenomicPosition = currentGenomicPosition;
}

// Sort by alt, ascending
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=alt";
beginAt(url);
Expand Down Expand Up @@ -1219,7 +1202,7 @@ private void testFullTextSearch() throws Exception
}

// Sort by af, ascending
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=af";
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=AF";
beginAt(url);
waitForText("data");
waitAndClick(Locator.tagWithId("a", "rawdata-tab"));
Expand All @@ -1230,13 +1213,13 @@ private void testFullTextSearch() throws Exception
double previousAf = -1.0;
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
double currentAf = jsonObject.getDouble("af");
double currentAf = jsonObject.getDouble("AF");
Assert.assertTrue(currentAf >= previousAf);
previousAf = currentAf;
}

// Sort by af, descending
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=af&sortReverse=true";
url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=AF&sortReverse=true";
beginAt(url);
waitForText("data");
waitAndClick(Locator.tagWithId("a", "rawdata-tab"));
Expand All @@ -1247,7 +1230,7 @@ private void testFullTextSearch() throws Exception
previousAf = 2.0; // Assuming 'af' is <= 1.0
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
double currentAf = jsonObject.getDouble("af");
double currentAf = jsonObject.getDouble("AF");
Assert.assertTrue(currentAf <= previousAf);
previousAf = currentAf;
}
Expand Down

0 comments on commit 0a028e9

Please sign in to comment.