Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AG-1409 reset default sort bug #1306

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {

if (!this.sortField || !this.columns.includes(this.sortField)) {
this.sortField = this.columns[0];
this.sortOrder = -1;
}

const preSelection = this.helperService.getGCTSelection();
Expand Down
42 changes: 42 additions & 0 deletions tests/gene-comparison-tool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,46 @@ test.describe('specific viewport block', () => {
const dropdown = page.locator('#subCategory');
await expect(dropdown).toHaveText('Targeted Selected Reaction Monitoring (SRM)');
});

test('switching from RNA to Protein with RNA-specific column ordering reverts back to Risk Score descending', async ({ page }) => {
// set category for Protein - Differential Expression
await page.goto('/genes/comparison?sortField=FP&sortOrder=1');
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 150000});
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// Gene Comparison Overview tutorial modal
const tutorialModal = page.getByText('Gene Comparison Overview');
await expect(tutorialModal).toBeVisible({ timeout: 10000});

// close the Gene Comparison Overview tutorial modal
const closeButton = page.locator('.p-dialog-header-close-icon');
await closeButton.click();

// Gene Comparison Overview tutorial modal
await expect(tutorialModal).not.toBeVisible({ timeout: 10000});
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// sort by FP ascending
const FPColumn = page.getByText('FP');
// first click sorts descending
await FPColumn.click();
// second click sorts ascending
await FPColumn.click();

// expect url to be correct
expect(page.url()).toBe('http://localhost:8080/genes/comparison?sortField=FP&sortOrder=1');
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// change category to Protein
await page.locator('p-dropdown').filter({ hasText: 'RNA - Differential Expression' }).getByLabel('dropdown trigger').click();
await page.getByText('Protein - Differential Expression').click();
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// expect url to be correct
expect(page.url()).toBe('http://localhost:8080/genes/comparison?category=Protein+-+Differential+Expression');
sagely1 marked this conversation as resolved.
Show resolved Hide resolved

// expect sort arrow to be descending
await expect(
page.getByRole('columnheader', { name: 'RISK SCORE' }).locator('i')
).toHaveClass(/pi-sort-amount-down/);
});
});
Loading