package uk.ac.ebi.atlas.acceptance.selenium.tests.widget;

import org.junit.Test;
import uk.ac.ebi.atlas.acceptance.selenium.fixture.SeleniumFixture;
import uk.ac.ebi.atlas.acceptance.selenium.pages.BioEntityPage;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class WidgetGeneSetIT extends SeleniumFixture {

    private static final String GENESET = "REACT_1619";

    private BioEntityPage subject;

    @Override
    protected void getStartingPage() {
        subject = new BioEntityPage(driver, GENESET, "genesets", "openPanelIndex=1");
        subject.get();
    }

    @Test
    public void heatmapChangesOnClick() {
        assertThat(subject.isIndividualGenesVisible(), is(true));
        assertThat(subject.isGeneSetProfilesVisible(), is(false));
        subject.clickShowGeneSetProfiles();
        assertThat(subject.isIndividualGenesVisible(), is(false));
        assertThat(subject.isGeneSetProfilesVisible(), is(true));
    }

}

@@ -206,16 +206,70 @@
 ityPage;
+%0Aimport uk.ac.ebi.atlas.acceptance.utils.SeleniumUtil;
 %0A%0Aimport
@@ -722,24 +722,141 @@
 OnClick() %7B%0A
+        // wait for ajax widget to load%0A        SeleniumUtil.waitForElementByIdUntilVisible(driver, %22heatmap-div%22);%0A%0A
         asse

fix test - add spin wait