Skip to content

Commit

Permalink
AG-1408: add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
hallieswan committed Apr 26, 2024
1 parent 201616c commit 23f53ab
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
7 changes: 3 additions & 4 deletions tests/gene-comparison-tool.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
import { waitForSpinnerNotVisible } from './helpers/utils';

test.describe('specific viewport block', () => {
test.slow();
Expand All @@ -8,8 +9,7 @@ test.describe('specific viewport block', () => {
await page.goto('/genes/comparison?category=Protein+-+Differential+Expression');

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 250000});
await waitForSpinnerNotVisible(page);

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle('Gene Comparison | Visual comparison tool for AD genes');
Expand All @@ -20,8 +20,7 @@ test.describe('specific viewport block', () => {
await page.goto('/genes/comparison?category=Protein+-+Differential+Expression');

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 150000});
await waitForSpinnerNotVisible(page, 150000);

// expect sub-category dropdown to be SRM
const dropdown = page.locator('#subCategory');
Expand Down
12 changes: 12 additions & 0 deletions tests/gene-details.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
import { waitForSpinnerNotVisible } from './helpers/utils';

test.describe('specific viewport block', () => {
test.slow();
Expand All @@ -14,4 +15,15 @@ test.describe('specific viewport block', () => {
// expect div for page not found content to be visible
expect(page.locator('.page-not-found')).toBeVisible();
});

test('consistency of change section heading is visible when using anchor link', async ({ page}) => {
await page.goto(
'/genes/ENSG00000178209/evidence/rna?model=AD Diagnosis males and females#consistency-of-change'
);

await waitForSpinnerNotVisible(page);

const header = page.getByRole('heading', { name: 'Consistency of Change in Expression'});
expect(header).toBeInViewport();
});
});
7 changes: 3 additions & 4 deletions tests/gene-resources.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
import { waitForSpinnerNotVisible } from './helpers/utils';

test.describe('specific viewport block', () => {
test.slow();
Expand All @@ -8,8 +9,7 @@ test.describe('specific viewport block', () => {
await page.goto('/genes/ENSG00000178209/resources');

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 250000});
await waitForSpinnerNotVisible(page);

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle('Agora');
Expand All @@ -20,8 +20,7 @@ test.describe('specific viewport block', () => {
await page.goto('/genes/ENSG00000178209/resources');

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 150000});
await waitForSpinnerNotVisible(page, 150000);

// expect link named 'Visit AMP-PD'
const link = page.getByRole('link', { name: 'Visit AMP-PD' });
Expand Down
7 changes: 7 additions & 0 deletions tests/helpers/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Page, expect } from '@playwright/test';

export const waitForSpinnerNotVisible = async (page: Page, timeout = 250000) => {
await expect(
page.locator('div:nth-child(4) > div > .spinner')
).not.toBeVisible({ timeout: timeout });
};

0 comments on commit 23f53ab

Please sign in to comment.