mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 21:38:12 +08:00
Added @typescript-eslint/recommended config with suppressions (#2345)
* Disabled @blueprintjs/classes-constants. #2288. * thuang-eslint-bp-off (#2344) * Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288. * Added TS recommended, suppress lint errors codemod. * Added per-error/warning ignore for tests. * Added per-error/warning ignore for configuration. * Added per-error/warning ignore for src. Removed suppress package. * Minor linting. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
This commit is contained in:
co-authored by
Timmy Huang
parent
32f60a1547
commit
27575b8d86
@@ -18,6 +18,7 @@ import {
|
||||
|
||||
import { appUrlBase, TEST_EMAIL, TEST_PASSWORD } from "./config";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function drag(testId: any, start: any, end: any, lasso = false) {
|
||||
const layout = await waitByID(testId);
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
@@ -43,6 +44,7 @@ export async function drag(testId: any, start: any, end: any, lasso = false) {
|
||||
await page.mouse.up();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function clickOnCoordinate(testId: any, coord: any) {
|
||||
const layout = await expect(page).toMatchElement(getTestId(testId));
|
||||
const elBox = await layout.boxModel();
|
||||
@@ -56,7 +58,9 @@ export async function clickOnCoordinate(testId: any, coord: any) {
|
||||
await page.mouse.click(x, y);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getAllHistograms(testclass: any, testIds: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const histTestIds = testIds.map((tid: any) => `histogram-${tid}`);
|
||||
|
||||
// these load asynchronously, so we need to wait for each histogram individually,
|
||||
@@ -77,6 +81,7 @@ export async function getAllHistograms(testclass: any, testIds: any) {
|
||||
return testIDs.map((id) => id.replace(/^histogram-/, ""));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getAllCategoriesAndCounts(category: any) {
|
||||
// these load asynchronously, so we have to wait for the specific category.
|
||||
await waitByID(`category-${category}`);
|
||||
@@ -93,6 +98,7 @@ export async function getAllCategoriesAndCounts(category: any) {
|
||||
|
||||
const count = (row.querySelector(
|
||||
"[data-testclass='categorical-value-count']"
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
) as any).innerText;
|
||||
|
||||
return [cat, count];
|
||||
@@ -101,11 +107,13 @@ export async function getAllCategoriesAndCounts(category: any) {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getCellSetCount(num: any) {
|
||||
await clickOn(`cellset-button-${num}`);
|
||||
return getOneElementInnerText(`[data-testid='cellset-count-${num}']`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function resetCategory(category: any) {
|
||||
const checkboxId = `${category}:category-select`;
|
||||
await waitByID(checkboxId);
|
||||
@@ -125,9 +133,13 @@ export async function resetCategory(category: any) {
|
||||
if (isExpanded) await clickOn(`${category}:category-expand`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function calcCoordinate(
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
testId: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
xAsPercent: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
yAsPercent: any
|
||||
) {
|
||||
const el = await waitByID(testId);
|
||||
@@ -141,8 +153,11 @@ export async function calcCoordinate(
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function calcDragCoordinates(
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
testId: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
coordinateAsPercent: any
|
||||
) {
|
||||
return {
|
||||
@@ -159,6 +174,7 @@ export async function calcDragCoordinates(
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function selectCategory(category: any, values: any, reset = true) {
|
||||
if (reset) await resetCategory(category);
|
||||
|
||||
@@ -170,6 +186,7 @@ export async function selectCategory(category: any, values: any, reset = true) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function expandCategory(category: any) {
|
||||
const expand = await waitByID(`${category}:category-expand`);
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
@@ -179,6 +196,7 @@ export async function expandCategory(category: any) {
|
||||
if (notExpanded) await clickOn(`${category}:category-expand`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function clip(min = 0, max = 100) {
|
||||
await clickOn("visualization-settings");
|
||||
await clearInputAndTypeInto("clip-min-input", min);
|
||||
@@ -186,6 +204,7 @@ export async function clip(min = 0, max = 100) {
|
||||
await clickOn("clip-commit");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function createCategory(categoryName: any) {
|
||||
await clickOnUntil("open-annotation-dialog", async () => {
|
||||
await expect(page).toMatchElement(getTestId("new-category-name"));
|
||||
@@ -201,14 +220,17 @@ export async function createCategory(categoryName: any) {
|
||||
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function colorByGeneset(genesetName: any) {
|
||||
await clickOn(`${genesetName}:colorby-entire-geneset`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function colorByGene(gene: any) {
|
||||
await clickOn(`colorby-${gene}`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertColorLegendLabel(label: any) {
|
||||
const handle = await waitByID("continuous_legend_color_by_label");
|
||||
|
||||
@@ -220,6 +242,7 @@ export async function assertColorLegendLabel(label: any) {
|
||||
return expect(result).toBe(label);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function expandGeneset(genesetName: any) {
|
||||
const expand = await waitByID(`${genesetName}:geneset-expand`);
|
||||
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
|
||||
@@ -229,6 +252,7 @@ export async function expandGeneset(genesetName: any) {
|
||||
if (notExpanded) await clickOn(`${genesetName}:geneset-expand`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function createGeneset(genesetName: any) {
|
||||
await clickOnUntil("open-create-geneset-dialog", async () => {
|
||||
await expect(page).toMatchElement(getTestId("create-geneset-input"));
|
||||
@@ -239,6 +263,7 @@ export async function createGeneset(genesetName: any) {
|
||||
await waitByClass("autosave-complete");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function editGenesetName(genesetName: any, editText: any) {
|
||||
const editButton = `${genesetName}:edit-genesetName-mode`;
|
||||
const submitButton = `${genesetName}:submit-geneset`;
|
||||
@@ -250,6 +275,7 @@ export async function editGenesetName(genesetName: any, editText: any) {
|
||||
await clickOn(submitButton);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function deleteGeneset(genesetName: any) {
|
||||
const targetId = `${genesetName}:delete-geneset`;
|
||||
|
||||
@@ -263,6 +289,7 @@ export async function deleteGeneset(genesetName: any) {
|
||||
await waitByClass("autosave-complete");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertGenesetDoesNotExist(genesetName: any) {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
|
||||
const result = await isElementPresent(
|
||||
@@ -271,6 +298,7 @@ export async function assertGenesetDoesNotExist(genesetName: any) {
|
||||
await expect(result).toBe(false);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertGenesetExists(genesetName: any) {
|
||||
const handle = await waitByID(`${genesetName}:geneset-name`);
|
||||
|
||||
@@ -288,6 +316,7 @@ export async function assertGenesetExists(genesetName: any) {
|
||||
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function addGeneToSet(genesetName: any, geneToAddToSet: any) {
|
||||
const submitButton = `${genesetName}:submit-gene`;
|
||||
|
||||
@@ -296,6 +325,7 @@ export async function addGeneToSet(genesetName: any, geneToAddToSet: any) {
|
||||
await clickOn(submitButton);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function removeGene(geneSymbol: any) {
|
||||
const targetId = `delete-from-geneset:${geneSymbol}`;
|
||||
|
||||
@@ -304,6 +334,7 @@ export async function removeGene(geneSymbol: any) {
|
||||
await waitByClass("autosave-complete");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertGeneExistsInGeneset(geneSymbol: any) {
|
||||
const handle = await waitByID(`${geneSymbol}:gene-label`);
|
||||
|
||||
@@ -315,6 +346,7 @@ export async function assertGeneExistsInGeneset(geneSymbol: any) {
|
||||
return expect(result).toBe(geneSymbol);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertGeneDoesNotExist(geneSymbol: any) {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
|
||||
const result = await isElementPresent(getTestId(`${geneSymbol}:gene-label`));
|
||||
@@ -322,6 +354,7 @@ export async function assertGeneDoesNotExist(geneSymbol: any) {
|
||||
await expect(result).toBe(false);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function expandGene(geneSymbol: any) {
|
||||
await clickOn(`maximize-${geneSymbol}`);
|
||||
}
|
||||
@@ -332,6 +365,7 @@ export async function expandGene(geneSymbol: any) {
|
||||
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function duplicateCategory(categoryName: any) {
|
||||
await clickOn("open-annotation-dialog");
|
||||
|
||||
@@ -358,8 +392,11 @@ export async function duplicateCategory(categoryName: any) {
|
||||
await waitByClass("autosave-complete");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function renameCategory(
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
oldCategoryName: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
newCategoryName: any
|
||||
) {
|
||||
await clickOn(`${oldCategoryName}:see-actions`);
|
||||
@@ -371,6 +408,7 @@ export async function renameCategory(
|
||||
await clickOn(`${oldCategoryName}:submit-category-edit`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function deleteCategory(categoryName: any) {
|
||||
const targetId = `${categoryName}:delete-category`;
|
||||
|
||||
@@ -384,6 +422,7 @@ export async function deleteCategory(categoryName: any) {
|
||||
await assertCategoryDoesNotExist();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function createLabel(categoryName: any, labelName: any) {
|
||||
/**
|
||||
* (thuang): This explicit wait is needed, since currently showing
|
||||
@@ -409,15 +448,20 @@ export async function createLabel(categoryName: any, labelName: any) {
|
||||
await clickOn(`${categoryName}:submit-label`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function deleteLabel(categoryName: any, labelName: any) {
|
||||
await expandCategory(categoryName);
|
||||
await clickOn(`${categoryName}:${labelName}:see-actions`);
|
||||
await clickOn(`${categoryName}:${labelName}:delete-label`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function renameLabel(
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
categoryName: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
oldLabelName: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
newLabelName: any
|
||||
) {
|
||||
await expandCategory(categoryName);
|
||||
@@ -430,12 +474,14 @@ export async function renameLabel(
|
||||
await clickOn(`${categoryName}:${oldLabelName}:submit-label-edit`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function addGeneToSearch(geneName: any) {
|
||||
await typeInto("gene-search", geneName);
|
||||
await page.keyboard.press("Enter");
|
||||
await page.waitForSelector(`[data-testid='histogram-${geneName}']`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function subset(coordinatesAsPercent: any) {
|
||||
// In order to deselect the selection after the subset, make sure we have some clear part
|
||||
// of the scatterplot we can click on
|
||||
@@ -450,7 +496,9 @@ export async function subset(coordinatesAsPercent: any) {
|
||||
await clickOnCoordinate("layout-graph", clearCoordinate);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function setSellSet(cellSet: any, cellSetNum: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
const selections = cellSet.filter((sel: any) => sel.kind === "categorical");
|
||||
|
||||
for (const selection of selections) {
|
||||
@@ -460,18 +508,21 @@ export async function setSellSet(cellSet: any, cellSetNum: any) {
|
||||
await getCellSetCount(cellSetNum);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function runDiffExp(cellSet1: any, cellSet2: any) {
|
||||
await setSellSet(cellSet1, 1);
|
||||
await setSellSet(cellSet2, 2);
|
||||
await clickOn("diffexp-button");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function bulkAddGenes(geneNames: any) {
|
||||
await clickOn("section-bulk-add");
|
||||
await typeInto("input-bulk-add", geneNames.join(","));
|
||||
await page.keyboard.press("Enter");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function assertCategoryDoesNotExist(categoryName: any) {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 2 arguments, but got 1.
|
||||
const result = await isElementPresent(
|
||||
@@ -481,6 +532,7 @@ export async function assertCategoryDoesNotExist(categoryName: any) {
|
||||
await expect(result).toBe(false);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function login() {
|
||||
await goToPage(appUrlBase);
|
||||
|
||||
@@ -502,6 +554,7 @@ export async function login() {
|
||||
expect(page.url()).toContain(appUrlBase);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function logout() {
|
||||
await clickOnUntil("user-info", async () => {
|
||||
await waitByID("log-out");
|
||||
@@ -514,6 +567,7 @@ export async function logout() {
|
||||
await waitByID("log-in");
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function waitUntilFormFieldStable(selector: any) {
|
||||
const MAX_RETRY = 10;
|
||||
const WAIT_FOR_MS = 200;
|
||||
|
||||
@@ -76,6 +76,7 @@ const brushThisGeneGeneset = "brush_this_gene";
|
||||
const geneBrushedCellCount = "109";
|
||||
const subsetGeneBrushedCellCount = "96";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function setup(config: any) {
|
||||
await goToPage(appUrlBase);
|
||||
|
||||
@@ -150,6 +151,7 @@ describe.each([
|
||||
await expect(page).toClick(getTestClass("pop-1-geneset-expand"));
|
||||
|
||||
await page.waitForFunction(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(selector: any) => !document.querySelector(selector),
|
||||
{},
|
||||
getTestClass("gene-loading-spinner")
|
||||
@@ -165,6 +167,7 @@ describe.each([
|
||||
await expect(page).toClick(getTestClass("pop-2-geneset-expand"));
|
||||
|
||||
await page.waitForFunction(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(selector: any) => !document.querySelector(selector),
|
||||
{},
|
||||
getTestClass("gene-loading-spinner")
|
||||
@@ -362,9 +365,11 @@ describe.each([
|
||||
expect(actualLabelName).toBe(expectedLabelName);
|
||||
expect(actualLabelCount).toBe(expectedLabelCount);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function getInnerText(element: any, className: any) {
|
||||
return element.$eval(
|
||||
getTestClass(className),
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
(node: any) => node?.innerText
|
||||
);
|
||||
}
|
||||
@@ -531,6 +536,7 @@ describe.each([
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function assertCategoryExists(categoryName: any) {
|
||||
const handle = await waitByID(`${categoryName}:category-label`);
|
||||
|
||||
@@ -542,6 +548,7 @@ describe.each([
|
||||
return expect(result).toBe(categoryName);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function assertLabelExists(categoryName: any, labelName: any) {
|
||||
await expect(page).toMatchElement(
|
||||
getTestId(`${categoryName}:category-expand`)
|
||||
@@ -559,6 +566,7 @@ describe.each([
|
||||
).toBe(labelName);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
async function assertLabelDoesNotExist(categoryName: any, labelName: any) {
|
||||
await expandCategory(categoryName);
|
||||
const result = await page.$(
|
||||
|
||||
@@ -50,6 +50,7 @@ beforeEach(async () => {
|
||||
}
|
||||
const errorMsgText = await Promise.all(
|
||||
// TODO can we do this without internal properties?
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
msg.args().map((arg: any) => arg._remoteObject.description)
|
||||
);
|
||||
throw new Error(`Console error: ${errorMsgText}`);
|
||||
|
||||
@@ -1,30 +1,38 @@
|
||||
/* eslint-disable no-await-in-loop -- await in loop is needed to emulate sequential user actions */
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export function getTestId(id: any) {
|
||||
return `[data-testid='${id}']`;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export function getTestClass(className: any) {
|
||||
return `[data-testclass='${className}']`;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function waitByID(testId: any, props = {}) {
|
||||
return page.waitForSelector(getTestId(testId), props);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function waitByClass(testClass: any, props = {}) {
|
||||
return page.waitForSelector(`[data-testclass='${testClass}']`, props);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function waitForAllByIds(testIds: any) {
|
||||
await Promise.all(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
testIds.map((testId: any) => page.waitForSelector(getTestId(testId)))
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getAllByClass(testClass: any) {
|
||||
return page.$$(`[data-testclass=${testClass}]`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function typeInto(testId: any, text: any) {
|
||||
// blueprint's typeahead is treating typing weird, clicking & waiting first solves this
|
||||
// only works for text without special characters
|
||||
@@ -36,6 +44,7 @@ export async function typeInto(testId: any, text: any) {
|
||||
await page.type(selector, text);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function clearInputAndTypeInto(testId: any, text: any) {
|
||||
await waitByID(testId);
|
||||
const selector = getTestId(testId);
|
||||
@@ -49,6 +58,7 @@ export async function clearInputAndTypeInto(testId: any, text: any) {
|
||||
await page.type(selector, text);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function clickOn(testId: any, options = {}) {
|
||||
await expect(page).toClick(getTestId(testId), options);
|
||||
}
|
||||
@@ -57,6 +67,7 @@ export async function clickOn(testId: any, options = {}) {
|
||||
* (thuang): There are times when Puppeteer clicks on a button and the page doesn't respond.
|
||||
* So I added clickOnUntil() to retry clicking until a given condition is met.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function clickOnUntil(testId: any, assert: any) {
|
||||
const MAX_RETRY = 10;
|
||||
const WAIT_FOR_MS = 200;
|
||||
@@ -81,18 +92,22 @@ export async function clickOnUntil(testId: any, assert: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getOneElementInnerHTML(selector: any, options = {}) {
|
||||
await page.waitForSelector(selector, options);
|
||||
|
||||
return page.$eval(selector, (el) => el.innerHTML);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getOneElementInnerText(selector: any) {
|
||||
expect(page).toMatchElement(selector);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
return page.$eval(selector, (el) => (el as any).innerText);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function getElementCoordinates(testId: any) {
|
||||
return page.$eval(getTestId(testId), (elem) => {
|
||||
const { left, top } = elem.getBoundingClientRect();
|
||||
@@ -118,6 +133,7 @@ async function nameNewAnnotation() {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function goToPage(url: any) {
|
||||
await page.goto(url, {
|
||||
waitUntil: "networkidle0",
|
||||
@@ -127,6 +143,7 @@ export async function goToPage(url: any) {
|
||||
await clickTermsOfService();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
export async function isElementPresent(selector: any, options: any) {
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 2.
|
||||
return Boolean(await page.$(selector, options));
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
||||
const PuppeteerEnvironment = require("jest-environment-puppeteer");
|
||||
require("jest-circus");
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
||||
const ENV_DEFAULT = require("../../../environment.default.json");
|
||||
|
||||
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'takeScreen... Remove this comment to see the full error message
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
||||
const takeScreenshot = require("./takeScreenshot");
|
||||
|
||||
class ScreenshotEnvironment extends PuppeteerEnvironment {
|
||||
|
||||
Reference in New Issue
Block a user