refactor categorical controls state (#1549)

* refactor categorical controls state

* lint

* fix race condition in tests

* fix typo

* add missing update on subset

* remove obsolete code

* update jest and puppeteer major version; update all minors

* update when label changes

* remove lint from tests; increase timeouts in e2e tests

* changes in response to PR review

* lint

* more PR comment changes

* more PR comment fixes

* lint

* more PR comment resolutions
This commit is contained in:
Bruce Martin
2020-06-10 12:56:38 -07:00
committed by GitHub
parent f063708b33
commit bc7a712048
25 changed files with 5097 additions and 3510 deletions
+9 -12
View File
@@ -1,8 +1,8 @@
/*
Tests included in this file are specific to annotation features
*/
import { appUrlBase, DATASET } from "./config";
import { setupTestBrowser } from "./testBrowser";
import { appUrlBase, DATASET, DEBUG } from "./config";
import setupTestBrowser from "./testBrowser";
import { datasets } from "./data";
let browser;
@@ -15,8 +15,8 @@ beforeAll(async () => {
[browser, page, utils, actions] = await setupTestBrowser();
});
afterAll(() => {
if (browser !== undefined) browser.close();
afterAll(async () => {
if (!DEBUG && browser !== undefined) await browser.close();
});
describe.each([
@@ -28,6 +28,7 @@ describe.each([
beforeEach(async () => {
await page.goto(appUrlBase);
// wait for the page to load
await utils.waitByClass("autosave-complete");
// setup the test fixtures
@@ -238,13 +239,9 @@ describe.each([
}
async function deleteCategoryIfExists(categoryName) {
try {
const category = await page.waitForSelector(
`[data-testid='${categoryName}:category-expand']`,
{ timeout: 200 }
);
if (category !== null) return await actions.deleteCategory(categoryName);
} catch {}
return null;
const handle = await page.$(
`[data-testid='${categoryName}:category-expand']`
);
if (handle) await actions.deleteCategory(categoryName);
}
});