Skip to content

Commit

Permalink
AG-1435: updates based on AG-1425
Browse files Browse the repository at this point in the history
  • Loading branch information
hallieswan committed May 13, 2024
1 parent 43d3bb4 commit bbb8905
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ <h1 class="gct-heading h2">Gene Comparison Tool</h1>
<div *ngIf="genesTable.filteredValue?.length">
<button
class="pin-all-button"
[disabled]="pinnedItems.length >= maxPinnedGenes"
[disabled]="getPinDisabledStatus()"
[ngClass]="{
disabled: getPinDisabledStatus()
}"
Expand Down Expand Up @@ -472,7 +472,7 @@ <h1 class="gct-heading h2">Gene Comparison Tool</h1>
<div>
<button
(click)="onPinGeneClick(gene)"
[disabled]="pinnedItems.length >= maxPinnedGenes"
[disabled]="getPinDisabledStatus()"
[ngClass]="{
disabled: getPinDisabledStatus()
}"
Expand Down
25 changes: 4 additions & 21 deletions tests/gene-comparison-tool-pinning-cache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ test.describe('GCT: Caching pinned genes', () => {
});
});

test.fail(
test(
'Pinned proteins are maintained when switching between Protein subcategories',
async ({ page }) => {
const gene1 = geneWithMultipleProteinsTMT.name;
Expand All @@ -154,9 +154,7 @@ test.describe('GCT: Caching pinned genes', () => {
}

await test.step('confirm # genes and proteins pinned on Protein page', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, nGenes);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(page, nProteins);
await confirmPinnedItemsCount(page, nProteins);
});
Expand Down Expand Up @@ -184,9 +182,7 @@ test.describe('GCT: Caching pinned genes', () => {
);

await test.step('confirm same genes and proteins pinned on Protein page', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, nGenes);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(page, nProteins);
await confirmPinnedItemsCount(page, nProteins);

Expand All @@ -196,7 +192,7 @@ test.describe('GCT: Caching pinned genes', () => {
}
);

test.fail(
test(
'Pinned proteins are maintained when switching categories: Protein -> RNA -> Protein',
async ({ page }) => {
const gene1 = geneWithMultipleProteinsTMT.name;
Expand All @@ -220,9 +216,7 @@ test.describe('GCT: Caching pinned genes', () => {
}

await test.step('confirm # genes and proteins pinned on Protein page', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, nGenes);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(page, nProteins);
await confirmPinnedItemsCount(page, nProteins);
});
Expand All @@ -248,21 +242,17 @@ test.describe('GCT: Caching pinned genes', () => {
);

await test.step('confirm same genes and proteins pinned on Protein page', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, nGenes);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(page, nProteins);

// FIXME - the following steps will fail until the protein cache is maintained
// ...when switching from Protein -> RNA -> Protein (AG-1425)
await confirmPinnedItemsCount(page, nProteins);
await confirmPinnedProteins(page, gene1, proteins1);
await confirmPinnedProteins(page, gene2, proteins2);
});
}
);

test.fail(
test(
'Last pinned genes are maintained even if proteins were pinned initially',
async ({ page }) => {
const rnaCategoryGene = geneWithMultipleProteinsTMT.name;
Expand Down Expand Up @@ -312,11 +302,8 @@ test.describe('GCT: Caching pinned genes', () => {
GCT_PROTEIN_SUBCATEGORIES.SRM,
GCT_PROTEIN_SUBCATEGORIES.TMT
);
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, 1);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(page, rnaCategoryProteins.length);
// FIXME - will fail until all proteins for a gene are pinned (AG-1425)
await confirmPinnedProteins(page, rnaCategoryGene, rnaCategoryProteins);
});

Expand All @@ -335,7 +322,7 @@ test.describe('GCT: Caching pinned genes', () => {
}
);

test.fail(
test(
'Last pinned proteins are maintained even if genes were pinned initially',
async ({ page }) => {
const rnaCategoryGene = geneWithMultipleProteinsTMT.name;
Expand Down Expand Up @@ -375,9 +362,7 @@ test.describe('GCT: Caching pinned genes', () => {
await pinAllItemsViaSearchByGene(page, proteinCategoryGene);

await test.step('confirm pinned items', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, 1);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(
page,
proteinCategoryProteins.length
Expand Down Expand Up @@ -414,9 +399,7 @@ test.describe('GCT: Caching pinned genes', () => {
);

await test.step('confirm pinned items', async () => {
// FIXME - will fail until gene count is separated from protein count (AG-1425)
await expectPinnedGenesCountText(page, 1);
// FIXME - will fail until protein count is displayed (AG-1425)
await expectPinnedProteinsCountText(
page,
proteinCategoryProteins.length
Expand Down
37 changes: 17 additions & 20 deletions tests/gene-comparison-tool-pinning-url.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from './helpers/data';
import { expectGctPageLoaded, getGeneRowButtons } from './helpers/gct';
import {
closePinnedGeneWarningModal,
confirmPinnedItemsByGeneName,
confirmPinnedItemsCount,
expectPinnedGenesCountText,
Expand Down Expand Up @@ -141,7 +140,13 @@ test.describe('GCT: Pinning Genes from URL', () => {
});
});

test('when RNA url includes proteins, the related gene is pinned', async ({
test.fail('when RNA url includes proteins, the related gene is pinned', {
annotation: {
type: 'fail',
description: 'Since AG-1425, only genes will be pinned from RNA url'
}
},
async ({
page,
}) => {
const geneProteins = geneWithMultipleProteinsTMT.uniProtIds.map(
Expand All @@ -166,7 +171,12 @@ test.describe('GCT: Pinning Genes from URL', () => {
});

test.fail(
'when Protein url includes a gene, all related proteins are pinned',
'when Protein url includes a gene, all related proteins are pinned', {
annotation: {
type: 'fail',
description: 'Since AG-1425, only proteins will be pinned from Protein url'
}
},
async ({ page }) => {
const url = `${URL_GCT_PROTEIN_TMT}&${formatPinnedGenesQueryParam([
geneWithMultipleProteinsTMT.ensemblId,
Expand All @@ -184,7 +194,6 @@ test.describe('GCT: Pinning Genes from URL', () => {
geneWithMultipleProteinsTMT.uniProtIds.length
);

// FIXME - will fail until protein counts are separated from gene counts (AG-1425)
await test.step('confirm counts', async () => {
await confirmPinnedItemsCount(page, 5);
await expectPinnedGenesCountText(page, 1);
Expand All @@ -193,7 +202,7 @@ test.describe('GCT: Pinning Genes from URL', () => {
}
);

test.fail(
test(
'when Protein url includes 50 proteins from 50 unique genes, all proteins are pinned',
async ({ page }) => {
const url = `${URL_GCT_PROTEIN_TMT}&${formatPinnedGenesQueryParam(
Expand All @@ -209,13 +218,12 @@ test.describe('GCT: Pinning Genes from URL', () => {
await test.step('confirm counts', async () => {
await confirmPinnedItemsCount(page, 50);
await expectPinnedGenesCountText(page, 50);
// FIXME - will fail until protein counts are separated from gene counts (AG-1425)
await expectPinnedProteinsCountText(page, 50);
});
}
);

test.fail(
test(
'when Protein url includes >50 proteins from 50 unique genes, all proteins are pinned',
async ({ page }) => {
const fortyNineProteinsToUniqueGenes =
Expand All @@ -234,10 +242,6 @@ test.describe('GCT: Pinning Genes from URL', () => {

await page.goto(url);

// FIXME - remove this step once pinning is fixed so that modal does not
// appear when >50 proteins are pinned for 50 unique genes (AG-1425)
await closePinnedGeneWarningModal(page);

await expectGctPageLoaded(
page,
GCT_CATEGORIES.PROTEIN,
Expand All @@ -246,9 +250,7 @@ test.describe('GCT: Pinning Genes from URL', () => {

await test.step('confirm counts', async () => {
await expectPinnedGenesCountText(page, 50);
// FIXME - will fail until >50 proteins can be pinned for 50 unique genes (AG-1425)
await confirmPinnedItemsCount(page, allProteins.length);
// FIXME - will fail until protein counts are separated from gene counts (AG-1425)
await expectPinnedProteinsCountText(page, allProteins.length);
});

Expand All @@ -260,7 +262,7 @@ test.describe('GCT: Pinning Genes from URL', () => {
}
);

test.fail(
test(
'when Protein url includes proteins from 51 unique genes, only proteins from 50 genes are pinned',
async ({ page }) => {
const oneGeneWithManyProteins =
Expand All @@ -282,8 +284,6 @@ test.describe('GCT: Pinning Genes from URL', () => {

await page.goto(url);

await closePinnedGeneWarningModal(page);

await expectGctPageLoaded(
page,
GCT_CATEGORIES.PROTEIN,
Expand All @@ -292,9 +292,7 @@ test.describe('GCT: Pinning Genes from URL', () => {

await test.step('confirm counts', async () => {
await expectPinnedGenesCountText(page, 50);
// FIXME - will fail until >50 proteins can be pinned for 50 unique genes (AG-1425)
await confirmPinnedItemsCount(page, expectedPinnedProteins.length);
// FIXME - will fail until protein counts are separated from gene counts (AG-1425)
await expectPinnedProteinsCountText(
page,
expectedPinnedProteins.length
Expand All @@ -303,7 +301,7 @@ test.describe('GCT: Pinning Genes from URL', () => {
}
);

test.fail(
test(
'when Protein url includes invalid protein, that protein is dropped from the url',
async ({ page }) => {
const validGeneProtein = fiftyProteinsToFiftyUniqueGenesTMT[1];
Expand All @@ -326,7 +324,6 @@ test.describe('GCT: Pinning Genes from URL', () => {
await test.step('confirm only pinned 1 protein', async () => {
await expectPinnedGenesCountText(page, 1);
await confirmPinnedItemsCount(page, 1);
// FIXME - will fail until pinned protein text is added (AG-1425)
await expectPinnedProteinsCountText(page, 1);
});

Expand Down
6 changes: 4 additions & 2 deletions tests/helpers/gct-pinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ export const expectPinnedProteinsCountText = async (
page: Page,
nProteins: number
) => {
await expect(page.getByText(`Pinned Proteins (${nProteins})`)).toBeVisible();
await expect(
page.getByText(`${nProteins} Protein${nProteins > 1 ? 's' : ''}`)
).toBeVisible();
};

export const expectTooManyPinnedGenesToast = async (page: Page) => {
const alert = page.getByRole('alert');
await expect(alert).toHaveText(
'Only 50 genes were added, because you reached the maxium of 50 pinned genes. '
'Only 50 rows were added, because you reached the maximum of 50 pinned Ensembl identifiers.'
);
};

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/gct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const changeGctDropdown = async (
await test.step('wait for page to redirect', async () => {
await expect(() => {
expect(page.url()).not.toEqual(url);
}).toPass({ timeout: 45_000 });
}).toPass({ timeout: 60_000 });
});

// Handle case where listbox doesn't close after page redirects
Expand Down

0 comments on commit bbb8905

Please sign in to comment.