Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Jan 22, 2024
1 parent 217e878 commit 4b0ff1f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public class StaticRefCacheMapUtil implements CacheMapUtil {
static Map<String, MolecularProfile> molecularProfileCache;
static Map<String, SampleList> sampleListCache;
static Map<String, CancerStudy> cancerStudyCache;
static Map<String, String> genericAssayStableIdToMolecularProfileIdCache;

@PostConstruct
private void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.cbioportal.persistence.util.CacheUtils;
import org.cbioportal.service.CacheService;
import org.cbioportal.service.exception.CacheOperationException;
import org.cbioportal.utils.config.annotation.ConditionalOnProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class AbstractContainerTest {
public final static int MOCKSERVER_PORT = 8085;
public final static String DOWNLOAD_FOLDER = "/tmp/browser_downloads";

@Value("${user.home:/tmp/chrome_vids}")
private String chromeVidsFolder;

private static final String SESSION_IMAGE_VERSION = "docker.io/cbioportal/session-service:0.6.1";
private static final String MONGO_IMAGE_VERSION = "docker.io/mongo:3.7.9";
private static final String KEYCLOAK_IMAGE_VERSION = "quay.io/keycloak/keycloak:23.0";
Expand Down Expand Up @@ -103,10 +100,10 @@ public class AbstractContainerTest {
options.setExperimentalOption("prefs", prefs);

chromedriverContainer = new BrowserWebDriverContainer<>()
.withCapabilities(options)
// activate this to record movies of the tests (great for debugging)
// .withRecordingMode(RECORD_ALL, new File(chromeVidsFolder))
.withAccessToHost(true)
.withCapabilities(options);
.withRecordingMode(RECORD_ALL, new File("/home/pnp300/"))
.withAccessToHost(true);

sessionServiceContainer.start();
mongoContainer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public static void testLogin(String cbioUrl, BrowserWebDriverContainer chromedri
performLogin(cbioUrl, driver);
WebElement loggedInButton = driver.findElement(By.id("dat-dropdown"));
Assertions.assertEquals("Logged in as testuser@thehyve.nl", loggedInButton.getText());
new WebDriverWait(driver, Duration.ofSeconds(20)).until(
ExpectedConditions.presenceOfElementLocated(By.xpath("//span[.='Breast Invasive Carcinoma (TCGA,Nature 2012)']")));
Assertions.assertDoesNotThrow(
() -> driver.findElement(By.xpath("//span[.='Breast Invasive Carcinoma (TCGA,Nature 2012)']")),
"Study could not be found on the landing page. Permissions are not correctly passed from IDP to client.");
Expand Down Expand Up @@ -100,6 +102,7 @@ public static void testLoginAgain(String cbioUrl, BrowserWebDriverContainer chro

private static void performLogin(String url, RemoteWebDriver driver) {
driver.get(url);
// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try {
// when the cbioportal logo is visible, skip login
driver.findElement(By.id("cbioportal-logo"));
Expand All @@ -112,6 +115,7 @@ private static void performLogin(String url, RemoteWebDriver driver) {
loginButton.click();
}
// wait for the page to load
// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
new WebDriverWait(driver, Duration.ofSeconds(20)).until(
ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@data-test='cancerTypeListContainer']")));
}
Expand All @@ -124,7 +128,9 @@ private static boolean containerFileExists(
Container.ExecResult r = container.execInContainer("/bin/sh", "-c",
"if [ -f " + path
+ " ] ; then echo '0' ; else (>&2 echo '1') ; fi");
return !r.getStderr().contains("1");
boolean fileNotFound = r.getStderr().contains("1");
container.execInContainer("rm -f " + path);
return !fileNotFound;
}

private static Callable<Boolean> downloadedFile(GenericContainer chromedriverContainer) {
Expand Down

0 comments on commit 4b0ff1f

Please sign in to comment.