mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 10:38:12 +08:00
Add clipping test to smoke tests (#757)
* Add clipping test to smoke tests * devtools on in debug
This commit is contained in:
@@ -108,6 +108,15 @@ export const datasets = {
|
|||||||
count: "24"
|
count: "24"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
clip: {
|
||||||
|
min: "30",
|
||||||
|
max: "70",
|
||||||
|
metadata: "n_genes",
|
||||||
|
gene: "S100A8",
|
||||||
|
"coordinates-as-percent": { x1: 0.25, y1: 0.5, x2: 0.55, y2: 0.5 },
|
||||||
|
count: "392",
|
||||||
|
"gene-cell-count": "421"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ describe("diffexp", async () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//
|
|
||||||
|
|
||||||
describe("subset/reset", async () => {
|
describe("subset/reset", async () => {
|
||||||
test("subset - cell count matches", async () => {
|
test("subset - cell count matches", async () => {
|
||||||
@@ -271,6 +270,38 @@ describe("scatter plot", async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("clipping", async () => {
|
||||||
|
test("clip continuous", async () => {
|
||||||
|
await cxgActions.clip(data.clip.min, data.clip.max)
|
||||||
|
const histId = `histogram-${data.clip.metadata}-plot-brush`;
|
||||||
|
const coords = await cxgActions.calcDragCoordinates(
|
||||||
|
histId,
|
||||||
|
data.clip["coordinates-as-percent"]
|
||||||
|
);
|
||||||
|
await cxgActions.drag(histId, coords.start, coords.end);
|
||||||
|
const cellCount = await cxgActions.cellSet(1);
|
||||||
|
expect(cellCount).toBe(data.clip.count);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
test("clip gene", async () => {
|
||||||
|
await utils.typeInto("gene-search", data.clip.gene);
|
||||||
|
await page.keyboard.press("Enter");
|
||||||
|
await page.waitForSelector(
|
||||||
|
`[data-testid='histogram-${data.clip.gene}']`
|
||||||
|
);
|
||||||
|
await cxgActions.clip(data.clip.min, data.clip.max)
|
||||||
|
const histId = `histogram-${data.clip.gene}-plot-brush`;
|
||||||
|
const coords = await cxgActions.calcDragCoordinates(
|
||||||
|
histId,
|
||||||
|
data.clip["coordinates-as-percent"]
|
||||||
|
);
|
||||||
|
await cxgActions.drag(histId, coords.start, coords.end);
|
||||||
|
const cellCount = await cxgActions.cellSet(1);
|
||||||
|
expect(cellCount).toBe(data.clip["gene-cell-count"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// interact with UI elements just that they do not break
|
// interact with UI elements just that they do not break
|
||||||
describe("ui elements don't error", async () => {
|
describe("ui elements don't error", async () => {
|
||||||
test("color by", async () => {
|
test("color by", async () => {
|
||||||
|
|||||||
@@ -16,10 +16,25 @@ export const puppeteerUtils = puppeteerPage => ({
|
|||||||
async typeInto(testid, text) {
|
async typeInto(testid, text) {
|
||||||
// only works for text without special characters
|
// only works for text without special characters
|
||||||
await this.waitByID(testid);
|
await this.waitByID(testid);
|
||||||
|
const selector = `[data-testid='${testid}']`;
|
||||||
// type ahead can be annoying if you don't pause before you type
|
// type ahead can be annoying if you don't pause before you type
|
||||||
await puppeteerPage.click(`[data-testid='${testid}']`);
|
await puppeteerPage.click(selector);
|
||||||
await puppeteerPage.waitFor(200);
|
await puppeteerPage.waitFor(200);
|
||||||
await puppeteerPage.type(`[data-testid='${testid}']`, text);
|
await puppeteerPage.type(selector, text);
|
||||||
|
},
|
||||||
|
|
||||||
|
async clearInputAndTypeInto(testid, text) {
|
||||||
|
await this.waitByID(testid);
|
||||||
|
const selector = `[data-testid='${testid}']`;
|
||||||
|
// only works for text without special characters
|
||||||
|
// type ahead can be annoying if you don't pause before you type
|
||||||
|
await puppeteerPage.click(selector);
|
||||||
|
await puppeteerPage.waitFor(200);
|
||||||
|
// select all
|
||||||
|
|
||||||
|
await puppeteerPage.click(selector, {clickCount: 3})
|
||||||
|
await puppeteerPage.keyboard.type("Backspace")
|
||||||
|
await puppeteerPage.type(selector, text);
|
||||||
},
|
},
|
||||||
|
|
||||||
async clickOn(testid) {
|
async clickOn(testid) {
|
||||||
@@ -161,5 +176,13 @@ export const cellxgeneActions = puppeteerPage => ({
|
|||||||
await puppeteerUtils(puppeteerPage).clickOn("reset");
|
await puppeteerUtils(puppeteerPage).clickOn("reset");
|
||||||
// loading state never actually happens, reset is too fast
|
// loading state never actually happens, reset is too fast
|
||||||
await page.waitFor(200);
|
await page.waitFor(200);
|
||||||
|
},
|
||||||
|
|
||||||
|
async clip(min = 0, max = 100) {
|
||||||
|
await puppeteerUtils(puppeteerPage).clickOn("visualization-settings");
|
||||||
|
await puppeteerUtils(puppeteerPage).clearInputAndTypeInto("clip-min-input", min);
|
||||||
|
await puppeteerUtils(puppeteerPage).clearInputAndTypeInto("clip-max-input", max);
|
||||||
|
await puppeteerUtils(puppeteerPage).clickOn("clip-commit");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Generated
+9
-9
@@ -11318,9 +11318,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"puppeteer": {
|
"puppeteer": {
|
||||||
"version": "1.12.2",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2.tgz",
|
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-1.15.0.tgz",
|
||||||
"integrity": "sha512-xWSyCeD6EazGlfnQweMpM+Hs6X6PhUYhNTHKFj/axNZDq4OmrVERf70isBf7HsnFgB3zOC1+23/8+wCAZYg+Pg==",
|
"integrity": "sha512-D2y5kwA9SsYkNUmcBzu9WZ4V1SGHiQTmgvDZSx6sRYFsgV25IebL4V6FaHjF6MbwLK9C6f3G3pmck9qmwM8H3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
@@ -11343,15 +11343,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mime": {
|
"mime": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.2.tgz",
|
||||||
"integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==",
|
"integrity": "sha512-zJBfZDkwRu+j3Pdd2aHsR5GfH2jIWhmL1ZzBoc+X+3JEti2hbArWcyJ+1laC1D2/U/W1a/+Cegj0/OnEU2ybjg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "6.1.4",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||||
"integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==",
|
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-limiter": "~1.0.0"
|
"async-limiter": "~1.0.0"
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@
|
|||||||
"jest-puppeteer": "^4.1.0",
|
"jest-puppeteer": "^4.1.0",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"mini-css-extract-plugin": "^0.4.1",
|
"mini-css-extract-plugin": "^0.4.1",
|
||||||
"puppeteer": "^1.12.1",
|
"puppeteer": "^1.15.0",
|
||||||
"rimraf": "^2.6.3",
|
"rimraf": "^2.6.3",
|
||||||
"serve-favicon": "^2.3.0",
|
"serve-favicon": "^2.3.0",
|
||||||
"start-server-and-test": "^1.7.11",
|
"start-server-and-test": "^1.7.11",
|
||||||
|
|||||||
@@ -898,6 +898,7 @@ class Graph extends React.Component {
|
|||||||
target={
|
target={
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
data-testid="visualization-settings"
|
||||||
className={`bp3-button bp3-icon-timeline-bar-chart ${activeClipClass}`}
|
className={`bp3-button bp3-icon-timeline-bar-chart ${activeClipClass}`}
|
||||||
style={{
|
style={{
|
||||||
cursor: "pointer"
|
cursor: "pointer"
|
||||||
@@ -929,6 +930,7 @@ class Graph extends React.Component {
|
|||||||
>
|
>
|
||||||
<NumericInput
|
<NumericInput
|
||||||
style={{ width: 50 }}
|
style={{ width: 50 }}
|
||||||
|
data-testid={"clip-min-input"}
|
||||||
onValueChange={this.handleClipPercentileMinValueChange}
|
onValueChange={this.handleClipPercentileMinValueChange}
|
||||||
onKeyPress={this.handleClipOnKeyPress}
|
onKeyPress={this.handleClipOnKeyPress}
|
||||||
value={clipMin}
|
value={clipMin}
|
||||||
@@ -949,6 +951,7 @@ class Graph extends React.Component {
|
|||||||
<span style={{ marginRight: 5, marginLeft: 5 }}> - </span>
|
<span style={{ marginRight: 5, marginLeft: 5 }}> - </span>
|
||||||
<NumericInput
|
<NumericInput
|
||||||
style={{ width: 50 }}
|
style={{ width: 50 }}
|
||||||
|
data-testid={"clip-max-input"}
|
||||||
onValueChange={this.handleClipPercentileMaxValueChange}
|
onValueChange={this.handleClipPercentileMaxValueChange}
|
||||||
onKeyPress={this.handleClipOnKeyPress}
|
onKeyPress={this.handleClipOnKeyPress}
|
||||||
value={clipMax}
|
value={clipMax}
|
||||||
@@ -968,6 +971,7 @@ class Graph extends React.Component {
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
data-testid="clip-commit"
|
||||||
className="bp3-button"
|
className="bp3-button"
|
||||||
disabled={this.isClipDisabled()}
|
disabled={this.isClipDisabled()}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user