-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(agora): migrate Agora e2e tests (AG-1609) #2965
base: main
Are you sure you want to change the base?
Conversation
…s until AG-1618 fixed
… starts and waits for agora-apex before running tests
"project": "./apps/agora/app/tsconfig.*?.json" | ||
}, | ||
"rules": { | ||
"@typescript-eslint/no-floating-promises": "error", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommended by Playwright's best practices
}, | ||
"rules": { | ||
"@typescript-eslint/no-floating-promises": "error", | ||
"playwright/no-nested-step": "off", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I often use nested steps to better organize complicated test, e.g. step to wait for GCT page to load, step to close GCT help dialog, step to change GCT dropdown, etc... it's helpful for identifying failures in long running tests with many actions. If we land on a different convention in the future, we can turn on this rule!
"rules": { | ||
"@typescript-eslint/no-floating-promises": "error", | ||
"playwright/no-nested-step": "off", | ||
"playwright/no-conditional-in-test": "off", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found conditionals to be useful to handle temporary components, such as auto-closing toasts, where the environment can impact whether the component is still visible when the test reaches the step to dismiss it.
"@typescript-eslint/no-floating-promises": "error", | ||
"playwright/no-nested-step": "off", | ||
"playwright/no-conditional-in-test": "off", | ||
"playwright/expect-expect": "off" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule enforces that every test has at least one expect
call. Many of our tests use functions to encapsulate expectations rather than calling expect
directly. We should be able to specify these functions in the rule configuration, but I was unable to get this working, so turning off for now.
test('has title', async ({ page }) => { | ||
await page.goto('/genes/ENSG00000178209/similar'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle('Agora'); | ||
}); | ||
|
||
test('has true and false values for nominated target column', async ({ page }) => { | ||
await page.goto('/genes/ENSG00000178209/similar'); | ||
|
||
await expect(page.locator('table')).toBeVisible(); | ||
|
||
// sort forward on nominated target | ||
await page.getByRole('cell', { name: 'Nominated Target' }).click(); | ||
|
||
const cell = await page.getByRole('row').nth(1).getByRole('cell').nth(1).innerText(); | ||
expect(cell).not.toBe(''); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from similar-genes.spec.ts
to colocate all similar genes tests within one file.
@@ -0,0 +1,30 @@ | |||
import { expect, test } from '@playwright/test'; | |||
|
|||
test('can search for gene', async ({ page }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as a proof of concept e2e test in Agora.
Description
Migrates Agora end-to-end tests to the monorepo.
Related Issue
Changelog
pnpm update @playwright/test --latest
workspace-install
Preview
Run e2e tests when agora containers are not yet running -- Playwright will start the services before running the tests:
Run e2e tests when agora containers are already running -- Playwright will reuse the existing services:
Current Playwright report: