mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-08 21:58:12 +08:00
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:
+1
-1
@@ -16,6 +16,6 @@ summary test,,F5,
|
|||||||
summary test,,PIGU,
|
summary test,,PIGU,
|
||||||
geneset_to_delete,,,
|
geneset_to_delete,,,
|
||||||
geneset_to_edit,,,
|
geneset_to_edit,,,
|
||||||
fill_this_geneset,,RER1,
|
fill_this_geneset,,,
|
||||||
empty_this_geneset,,SIK1,
|
empty_this_geneset,,SIK1,
|
||||||
brush_this_gene,,SIK1,
|
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_delete'},
|
||||||
{'genes': [], 'geneset_description': '', 'geneset_name': 'geneset_to_edit'},
|
{'genes': [], 'geneset_description': '', 'geneset_name': 'geneset_to_edit'},
|
||||||
{
|
{
|
||||||
'genes': [{'gene_description': '', 'gene_symbol': 'RER1'}],
|
'genes': [],
|
||||||
'geneset_description': '',
|
'geneset_description': '',
|
||||||
'geneset_name': 'fill_this_geneset'
|
'geneset_name': 'fill_this_geneset'
|
||||||
},
|
},
|
||||||
@@ -485,7 +485,7 @@ summary test,,F5,\r
|
|||||||
summary test,,PIGU,\r
|
summary test,,PIGU,\r
|
||||||
geneset_to_delete,,,\r
|
geneset_to_delete,,,\r
|
||||||
geneset_to_edit,,,\r
|
geneset_to_edit,,,\r
|
||||||
fill_this_geneset,,RER1,\r
|
fill_this_geneset,,,\r
|
||||||
empty_this_geneset,,SIK1,\r
|
empty_this_geneset,,SIK1,\r
|
||||||
brush_this_gene,,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_delete"},
|
||||||
{"genes": [], "geneset_description": "", "geneset_name": "geneset_to_edit"},
|
{"genes": [], "geneset_description": "", "geneset_name": "geneset_to_edit"},
|
||||||
{
|
{
|
||||||
"genes": [{"gene_description": "", "gene_symbol": "RER1"}],
|
"genes": [],
|
||||||
"geneset_description": "",
|
"geneset_description": "",
|
||||||
"geneset_name": "fill_this_geneset",
|
"geneset_name": "fill_this_geneset",
|
||||||
},
|
},
|
||||||
@@ -651,7 +651,7 @@ summary test,,F5,\r
|
|||||||
summary test,,PIGU,\r
|
summary test,,PIGU,\r
|
||||||
geneset_to_delete,,,\r
|
geneset_to_delete,,,\r
|
||||||
geneset_to_edit,,,\r
|
geneset_to_edit,,,\r
|
||||||
fill_this_geneset,,RER1,\r
|
fill_this_geneset,,,\r
|
||||||
empty_this_geneset,,SIK1,\r
|
empty_this_geneset,,SIK1,\r
|
||||||
brush_this_gene,,SIK1,\r
|
brush_this_gene,,SIK1,\r
|
||||||
""",
|
""",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
getTestId,
|
getTestId,
|
||||||
getTestClass,
|
getTestClass,
|
||||||
getAllByClass,
|
getAllByClass,
|
||||||
|
clickOnUntil,
|
||||||
getOneElementInnerHTML,
|
getOneElementInnerHTML,
|
||||||
} from "./puppeteerUtils";
|
} from "./puppeteerUtils";
|
||||||
|
|
||||||
@@ -76,6 +77,11 @@ const brushThisGeneGeneset = "brush_this_gene";
|
|||||||
const geneBrushedCellCount = "109";
|
const geneBrushedCellCount = "109";
|
||||||
const subsetGeneBrushedCellCount = "96";
|
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.
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||||
async function setup(config: any) {
|
async function setup(config: any) {
|
||||||
await goToPage(appUrlBase);
|
await goToPage(appUrlBase);
|
||||||
@@ -177,7 +183,7 @@ describe.each([
|
|||||||
|
|
||||||
expect(genesHTML).toMatchSnapshot();
|
expect(genesHTML).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
test("create a new geneset", async () => {
|
test("create a new geneset and undo/redo", async () => {
|
||||||
if (config.withSubset) return;
|
if (config.withSubset) return;
|
||||||
|
|
||||||
await setup(config);
|
await setup(config);
|
||||||
@@ -187,19 +193,45 @@ describe.each([
|
|||||||
await createGeneset(genesetName);
|
await createGeneset(genesetName);
|
||||||
/* note: as of June 2021, the aria label is in the truncate component which clones the element */
|
/* note: as of June 2021, the aria label is in the truncate component which clones the element */
|
||||||
await assertGenesetExists(genesetName);
|
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 setup(config);
|
||||||
|
|
||||||
await editGenesetName(editableGenesetName, editText);
|
await editGenesetName(editableGenesetName, editText);
|
||||||
await assertGenesetExists(newGenesetName);
|
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;
|
if (config.withSubset) return;
|
||||||
|
|
||||||
await setup(config);
|
await setup(config);
|
||||||
|
|
||||||
await deleteGeneset(genesetToDeleteName);
|
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: true, tag: "subset" },
|
||||||
{ withSubset: false, tag: "whole" },
|
{ withSubset: false, tag: "whole" },
|
||||||
])("GENE crud operations and interactions", (config) => {
|
])("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 setup(config);
|
||||||
|
|
||||||
await addGeneToSet(setToAddGeneTo, geneToAddToSet);
|
await addGeneToSet(setToAddGeneTo, geneToAddToSet);
|
||||||
await expandGeneset(setToAddGeneTo);
|
await expandGeneset(setToAddGeneTo);
|
||||||
await assertGeneExistsInGeneset(geneToAddToSet);
|
await assertGeneExistsInGeneset(geneToAddToSet);
|
||||||
|
await clickOn("undo");
|
||||||
|
await assertGeneDoesNotExist(geneToAddToSet);
|
||||||
|
await clickOn("redo");
|
||||||
|
await assertGeneExistsInGeneset(geneToAddToSet);
|
||||||
});
|
});
|
||||||
test("expand gene and brush", async () => {
|
test("expand gene and brush", async () => {
|
||||||
await setup(config);
|
await setup(config);
|
||||||
@@ -243,7 +279,7 @@ describe.each([
|
|||||||
await colorByGene(geneToBrushAndColorBy);
|
await colorByGene(geneToBrushAndColorBy);
|
||||||
await assertColorLegendLabel(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
|
// We've already deleted the gene
|
||||||
if (config.withSubset) return;
|
if (config.withSubset) return;
|
||||||
|
|
||||||
@@ -252,6 +288,10 @@ describe.each([
|
|||||||
await expandGeneset(setToRemoveFrom);
|
await expandGeneset(setToRemoveFrom);
|
||||||
await removeGene(geneToRemove);
|
await removeGene(geneToRemove);
|
||||||
await assertGeneDoesNotExist(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}
|
onClick={this.onGenesetMenuClick}
|
||||||
>
|
>
|
||||||
<Truncate
|
<Truncate
|
||||||
|
isGenesetDescription
|
||||||
tooltipAddendum={
|
tooltipAddendum={
|
||||||
genesetDescription ? `: ${genesetDescription}` : ""
|
genesetDescription ? `: ${genesetDescription}` : ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
// 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) => {
|
export default (props: any) => {
|
||||||
const { children, tooltipAddendum = "" } = props;
|
const { children, isGenesetDescription, tooltipAddendum = "" } = props;
|
||||||
// Truncate only support a single child with a text child
|
// Truncate only support a single child with a text child
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -89,9 +89,22 @@ export default (props: any) => {
|
|||||||
"aria-label": originalString,
|
"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 (
|
return (
|
||||||
<Tooltip2
|
<Tooltip2
|
||||||
content={`${originalString}${tooltipAddendum}`}
|
content={
|
||||||
|
isGenesetDescription
|
||||||
|
? descriptionContent
|
||||||
|
: `${originalString}${tooltipAddendum}`
|
||||||
|
}
|
||||||
hoverOpenDelay={tooltipHoverOpenDelayQuick}
|
hoverOpenDelay={tooltipHoverOpenDelayQuick}
|
||||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||||
targetProps={{ style: children.props.style }}
|
targetProps={{ style: children.props.style }}
|
||||||
|
|||||||
Reference in New Issue
Block a user