genesets e2e tests, undo/redo (#2327)

* undo redo create

* edit undo redo

* all tests pass, add, edit

* description

* remove RER1

* remove rer1

* remove from hosted
This commit is contained in:
Colin Megill
2021-07-30 16:52:49 -07:00
committed by GitHub
parent 5ab96ed360
commit 01d34580b9
6 changed files with 66 additions and 12 deletions
+1 -1
View File
@@ -16,6 +16,6 @@ summary test,,F5,
summary test,,PIGU,
geneset_to_delete,,,
geneset_to_edit,,,
fill_this_geneset,,RER1,
fill_this_geneset,,,
empty_this_geneset,,SIK1,
brush_this_gene,,SIK1,
1 # Test fixture
16 summary test,,PIGU,
17 geneset_to_delete,,,
18 geneset_to_edit,,,
19 fill_this_geneset,,RER1, fill_this_geneset,,,
20 empty_this_geneset,,SIK1,
21 brush_this_gene,,SIK1,
@@ -444,7 +444,7 @@ class EndPointsCxg(EndPoints):
{'genes': [], 'geneset_description': '', 'geneset_name': 'geneset_to_delete'},
{'genes': [], 'geneset_description': '', 'geneset_name': 'geneset_to_edit'},
{
'genes': [{'gene_description': '', 'gene_symbol': 'RER1'}],
'genes': [],
'geneset_description': '',
'geneset_name': 'fill_this_geneset'
},
@@ -485,7 +485,7 @@ summary test,,F5,\r
summary test,,PIGU,\r
geneset_to_delete,,,\r
geneset_to_edit,,,\r
fill_this_geneset,,RER1,\r
fill_this_geneset,,,\r
empty_this_geneset,,SIK1,\r
brush_this_gene,,SIK1,\r
"""
@@ -609,7 +609,7 @@ class EndPointsAnnDataGenesets(unittest.TestCase, EndPoints):
{"genes": [], "geneset_description": "", "geneset_name": "geneset_to_delete"},
{"genes": [], "geneset_description": "", "geneset_name": "geneset_to_edit"},
{
"genes": [{"gene_description": "", "gene_symbol": "RER1"}],
"genes": [],
"geneset_description": "",
"geneset_name": "fill_this_geneset",
},
@@ -651,7 +651,7 @@ summary test,,F5,\r
summary test,,PIGU,\r
geneset_to_delete,,,\r
geneset_to_edit,,,\r
fill_this_geneset,,RER1,\r
fill_this_geneset,,,\r
empty_this_geneset,,SIK1,\r
brush_this_gene,,SIK1,\r
""",
+45 -5
View File
@@ -12,6 +12,7 @@ import {
getTestId,
getTestClass,
getAllByClass,
clickOnUntil,
getOneElementInnerHTML,
} from "./puppeteerUtils";
@@ -76,6 +77,11 @@ const brushThisGeneGeneset = "brush_this_gene";
const geneBrushedCellCount = "109";
const subsetGeneBrushedCellCount = "96";
const genesetDescriptionID =
"geneset-description-tooltip-fourth_gene_set: fourth description";
const genesetDescriptionString = "fourth_gene_set: fourth description";
const genesetToCheckForDescription = "fourth_gene_set";
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
async function setup(config: any) {
await goToPage(appUrlBase);
@@ -177,7 +183,7 @@ describe.each([
expect(genesHTML).toMatchSnapshot();
});
test("create a new geneset", async () => {
test("create a new geneset and undo/redo", async () => {
if (config.withSubset) return;
await setup(config);
@@ -187,19 +193,45 @@ describe.each([
await createGeneset(genesetName);
/* note: as of June 2021, the aria label is in the truncate component which clones the element */
await assertGenesetExists(genesetName);
await clickOn("undo");
await assertGenesetDoesNotExist(genesetName);
await clickOn("redo");
await assertGenesetExists(genesetName);
});
test("edit geneset name", async () => {
test("edit geneset name and undo/redo", async () => {
await setup(config);
await editGenesetName(editableGenesetName, editText);
await assertGenesetExists(newGenesetName);
await clickOn("undo");
await assertGenesetExists(editableGenesetName);
await clickOn("redo");
await assertGenesetExists(newGenesetName);
});
test("delete a geneset", async () => {
test("delete a geneset and undo/redo", async () => {
if (config.withSubset) return;
await setup(config);
await deleteGeneset(genesetToDeleteName);
await clickOn("undo");
await assertGenesetExists(genesetToDeleteName);
await clickOn("redo");
await assertGenesetDoesNotExist(genesetToDeleteName);
});
test("geneset description", async () => {
if (config.withSubset) return;
await setup(config);
await clickOnUntil(
`${genesetToCheckForDescription}:geneset-expand`,
async () => {
expect(page).toMatchElement(getTestId(genesetDescriptionID), {
text: genesetDescriptionString,
});
}
);
});
});
@@ -207,12 +239,16 @@ describe.each([
{ withSubset: true, tag: "subset" },
{ withSubset: false, tag: "whole" },
])("GENE crud operations and interactions", (config) => {
test("add a gene to geneset", async () => {
test("add a gene to geneset and undo/redo", async () => {
await setup(config);
await addGeneToSet(setToAddGeneTo, geneToAddToSet);
await expandGeneset(setToAddGeneTo);
await assertGeneExistsInGeneset(geneToAddToSet);
await clickOn("undo");
await assertGeneDoesNotExist(geneToAddToSet);
await clickOn("redo");
await assertGeneExistsInGeneset(geneToAddToSet);
});
test("expand gene and brush", async () => {
await setup(config);
@@ -243,7 +279,7 @@ describe.each([
await colorByGene(geneToBrushAndColorBy);
await assertColorLegendLabel(geneToBrushAndColorBy);
});
test("delete gene from geneset", async () => {
test("delete gene from geneset and undo/redo", async () => {
// We've already deleted the gene
if (config.withSubset) return;
@@ -252,6 +288,10 @@ describe.each([
await expandGeneset(setToRemoveFrom);
await removeGene(geneToRemove);
await assertGeneDoesNotExist(geneToRemove);
await clickOn("undo");
await assertGeneExistsInGeneset(geneToRemove);
await clickOn("redo");
await assertGeneDoesNotExist(geneToRemove);
});
});
@@ -90,6 +90,7 @@ class GeneSet extends React.Component<{}, State> {
onClick={this.onGenesetMenuClick}
>
<Truncate
isGenesetDescription
tooltipAddendum={
genesetDescription ? `: ${genesetDescription}` : ""
}
+15 -2
View File
@@ -34,7 +34,7 @@ const SECOND_HALF_INNER_STYLE = {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
export default (props: any) => {
const { children, tooltipAddendum = "" } = props;
const { children, isGenesetDescription, tooltipAddendum = "" } = props;
// Truncate only support a single child with a text child
if (
@@ -89,9 +89,22 @@ export default (props: any) => {
"aria-label": originalString,
})
);
// we need an ID to check for this content, since this is the only place the geneset description appears
const descriptionContent = (
<span
test-id={`geneset-description-tooltip-${originalString}${tooltipAddendum}`}
>
{originalString}
{tooltipAddendum}
</span>
);
return (
<Tooltip2
content={`${originalString}${tooltipAddendum}`}
content={
isGenesetDescription
? descriptionContent
: `${originalString}${tooltipAddendum}`
}
hoverOpenDelay={tooltipHoverOpenDelayQuick}
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
targetProps={{ style: children.props.style }}