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 all 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 @@

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

const preSelection = this.helperService.getGCTSelection();
Expand Down Expand Up @@ -993,7 +994,7 @@
}

copyUrl() {
navigator.clipboard.writeText(window.location.href);

Check warning on line 997 in src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
const self = this;
this.messageService.clear();
this.messageService.add({
Expand Down
55 changes: 50 additions & 5 deletions tests/gene-comparison-tool.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,75 @@
import { test, expect } from '@playwright/test';
import { URL_GCT_PROTEIN } from './helpers/constants';
import { GCT_CATEGORIES, URL_GCT_PROTEIN } from './helpers/constants';
import { waitForSpinnerNotVisible } from './helpers/utils';
import { baseURL } from '../playwright.config';
import { changeGctCategory, closeGctHelpDialog } from './helpers/gct';

const URL_GCT = '/genes/comparison';
const URL_RNA = '/genes/comparison?';
const URL_PROTEIN = '/genes/comparison?category=Protein+-+Differential+Expression';

test.describe('specific viewport block', () => {
test.slow();
test.use({ viewport: { width: 1600, height: 1200 } });

test('has title', async ({ page }) => {
await page.goto(URL_GCT_PROTEIN);
await page.goto(`${ URL_GCT }`);

// wait for page to load (i.e. spinner to disappear)
await waitForSpinnerNotVisible(page, 250000);
await waitForSpinnerNotVisible(page, 250_000);

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle('Gene Comparison | Visual comparison tool for AD genes');
});

test('sub-category is SRM by default', async ({ page }) => {
test('protein has sub-category of SRM by default', async ({ page }) => {
// set category for Protein - Differential Expression
await page.goto(URL_GCT_PROTEIN);

// wait for page to load (i.e. spinner to disappear)
await waitForSpinnerNotVisible(page, 150000);
await waitForSpinnerNotVisible(page, 150_000);

// expect sub-category dropdown to be SRM
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 to RNA
await page.goto(`${ URL_RNA }`);

// wait for page to load (i.e. spinner to disappear)
await waitForSpinnerNotVisible(page, 150_000);

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

// close the Gene Comparison Overview tutorial modal
await closeGctHelpDialog(page);

// Gene Comparison Overview tutorial modal
await expect(tutorialModal).not.toBeVisible({ timeout: 10_000});

// 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(`${ baseURL }${ URL_RNA }sortField=FP&sortOrder=1`);

// change category to Protein
await changeGctCategory(page, GCT_CATEGORIES.RNA, GCT_CATEGORIES.PROTEIN);

// expect url to be correct
expect(page.url()).toBe(`${ baseURL }${ URL_PROTEIN }`);

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