Skip to content

Commit

Permalink
chore: clean up e2eAnnotations.test.ts #213 (#281)
Browse files Browse the repository at this point in the history
* removed irrelevant tests from e2e annotations and added it to push_tests.yml

* merged tests, added back truncation tests, and removed annotation tests from makefiles

* removing

Co-authored-by: Alexander Tarashansky <[email protected]>
  • Loading branch information
atarashansky and Alexander Tarashansky authored Jul 27, 2022
1 parent 7d60bd0 commit 85b215b
Show file tree
Hide file tree
Showing 9 changed files with 308 additions and 682 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ jobs:
- name: Smoke tests (without annotations feature)
run: |
cd client && make smoke-test
./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,smokeTest
./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,smokeTest
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ unit-test-server:
smoke-test:
cd client && $(MAKE) smoke-test

.PHONY: smoke-test-annotations
smoke-test-annotations:
cd client && $(MAKE) smoke-test-annotations

# LINTING AND FORMATTING COMMANDS

.PHONY: fmt
Expand Down
9 changes: 0 additions & 9 deletions client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ smoke-test:
$(CXG_SERVER_PORT) \
'CXG_URL_BASE="http://localhost:$(CXG_SERVER_PORT)" npm run e2e -- --verbose --no-cache false'

# start an instance of the Explorer server and run the end-to-end annotations tests
.PHONY: smoke-test-annotations
smoke-test-annotations:
start_server_and_test \
'CXG_OPTIONS="" $(MAKE) start-server' \
$(CXG_SERVER_PORT) \
'CXG_URL_BASE="http://localhost:$(CXG_SERVER_PORT)" npm run e2e-annotations -- --verbose false'
rm -rf $(TMP_DIR)

.PHONY: unit-test
unit-test:
node node_modules/jest/bin/jest.js --testPathIgnorePatterns e2e
Expand Down
4 changes: 4 additions & 0 deletions client/__tests__/e2e/__snapshots__/e2e.test.ts.snap

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions client/__tests__/e2e/__snapshots__/e2eAnnotations.test.ts.snap

This file was deleted.

41 changes: 26 additions & 15 deletions client/__tests__/e2e/cellxgeneActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,27 @@ 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) {
export async function addGeneToSetAndExpand(genesetName: any, geneSymbol: any) {
/**
* this is an awful hack but for some reason, the add gene to set
* doesn't work each time. must repeat to get it to trigger.
* */
let z = 0;
while (z < 10) {
await addGeneToSet(genesetName, geneSymbol);
await expandGeneset(genesetName);
try {
await waitByClass("geneset-expand-is-expanded");
break;
} catch (TimeoutError) {
z += 1;
console.log(`trying again - ${z}`);
}
}
}
export async function expandGeneset(genesetName: string) {
const expand = await waitByID(`${genesetName}:geneset-expand`);
// @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
const notExpanded = await expand.$(
const notExpanded = await expand?.$(
"[data-testclass='geneset-expand-is-not-expanded']"
);
if (notExpanded) await clickOn(`${genesetName}:geneset-expand`);
Expand All @@ -251,10 +266,9 @@ export async function createGeneset(genesetName: any) {
await clickOnUntil("open-create-geneset-dialog", async () => {
await expect(page).toMatchElement(getTestId("create-geneset-input"));
});

await typeInto("create-geneset-input", genesetName);
// await typeInto("add-genes", "SIK1");
await clickOn("submit-geneset");
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.
Expand All @@ -280,7 +294,6 @@ export async function deleteGeneset(genesetName: any) {
await clickOn(targetId);

await assertGenesetDoesNotExist(genesetName);
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.
Expand Down Expand Up @@ -311,8 +324,10 @@ 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`;

await clickOn(`${genesetName}:add-new-gene-to-geneset`);
await clickOnUntil(`${genesetName}:add-new-gene-to-geneset`, async () => {
await expect(page).toMatchElement(getTestId("add-genes"));
});
assert(await isElementPresent(getTestId("add-genes"), {}));
await typeInto("add-genes", geneToAddToSet);
await clickOn(submitButton);
}
Expand All @@ -322,8 +337,6 @@ export async function removeGene(geneSymbol: any) {
const targetId = `delete-from-geneset:${geneSymbol}`;

await clickOn(targetId);

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.
Expand All @@ -347,10 +360,10 @@ export async function assertGeneDoesNotExist(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 expandGene(geneSymbol: any) {
await clickOn(`maximize-${geneSymbol}`);
}

/**
* CATEGORY
*/
Expand Down Expand Up @@ -378,8 +391,6 @@ export async function duplicateCategory(categoryName: any) {
getTestId(`${categoryName}:category-expand`)
);
});

await waitByClass("autosave-complete");
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
Expand Down
Loading

0 comments on commit 85b215b

Please sign in to comment.