-
Notifications
You must be signed in to change notification settings - Fork 13
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-1435 #1304
AG-1435 #1304
Conversation
hallieswan
commented
May 2, 2024
- bump playwright version
- add linting rule recommended in playwright best practices
- add e2e tests for GCT gene pinning
@@ -11,7 +11,8 @@ | |||
"parser": "@typescript-eslint/parser", | |||
"parserOptions": { | |||
"ecmaVersion": "latest", | |||
"sourceType": "module" | |||
"sourceType": "module", | |||
"project": ["./tsconfig.base.json"] |
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.
Setting the @typescript-eslint/no-floating-promises
rule causes this error: You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
, so specify a project.
@@ -54,7 +54,7 @@ | |||
"@angularclass/hmr": "^3.0.0", | |||
"@babel/plugin-proposal-decorators": "^7.18.10", | |||
"@ngtools/webpack": "^13.3.9", | |||
"@playwright/test": "^1.39.0", | |||
"@playwright/test": "^1.43.1", |
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.
Bump playwright version
// https://github.com/angular/angular/issues/45202 | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
router.navigate(['/about']); |
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.
router.navigate returns a Promise, but is not awaited in Agora or in the Angular docs. Per the referenced link, it's common practice to ignore the Promise, so disable the lint rule for these cases.
src/app/features/genes/components/gene-comparison-tool/gene-comparison-tool.component.html
Outdated
Show resolved
Hide resolved
beforeEach(waitForAsync(async () => { | ||
await TestBed.configureTestingModule({ |
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.
Await promise, so there is not a warning from newly enabled @typescript-eslint/no-floating-promises
rule
"compileOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": "./src", | ||
"outDir": "./dist/out-tsc", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": false, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"sourceMap": true, | ||
"declaration": false, | ||
"downlevelIteration": true, | ||
"experimentalDecorators": true, | ||
"moduleResolution": "node", | ||
"importHelpers": true, | ||
"target": "es2017", | ||
"module": "es2020", | ||
"lib": ["es2020", "dom"], | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"angularCompilerOptions": { | ||
"enableI18nLegacyMessageIdFormat": false, | ||
"strictInjectionParameters": true, | ||
"strictInputAccessModifiers": true, | ||
"strictTemplates": true | ||
}, |
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 tsconfig.json
"include": [ | ||
"./src/**/*.ts", | ||
"./src/**/*.html", | ||
"./src/**/*.scss", | ||
"./tests/**.ts", | ||
"./tests/**/**.ts", | ||
"playwright.config.ts" | ||
] |
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.
Specifies which files should be linted
"strictInputAccessModifiers": true, | ||
"strictTemplates": true | ||
}, | ||
"extends": "./tsconfig.base.json", |
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.
Extend the base tsconfig, so that an exclude block can still be used when bundling via webpack
@@ -7,11 +8,12 @@ test.describe('specific viewport block', () => { | |||
test('invalid gene results in a 404 redirect', async ({ page }) => { | |||
// go to invalid ENSG page | |||
await page.goto('/genes/ENSG00000000000'); | |||
await waitForSpinnerNotVisible(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.
Waiting for loader to be removed reduces flakiness when page takes a long time to load
|
||
// expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle('Agora'); | ||
|
||
// expect div for page not found content to be visible | ||
expect(page.locator('.page-not-found')).toBeVisible(); | ||
await expect(page.locator('.page-not-found')).toBeVisible(); |
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.
Fix warning from @typescript-eslint/no-floating-promises
-- toBeVisible is an auto-retrying assertion, so should be awaited
@@ -403,6 +403,7 @@ <h1 class="gct-heading h2">Gene Comparison Tool</h1> | |||
<div *ngIf="genesTable.filteredValue?.length"> | |||
<button | |||
class="pin-all-button" | |||
[disabled]="getPinDisabledStatus()" |
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.
Set the disabled property, rather than just a 'disabled' class, so that Playwright can confirm that the pin gene button is disabled when pinned gene limit has been reached.
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' | ||
} | ||
}, |
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.
Expect this test to fail -- since AG-1425, only genes will be pinned from an RNA url. ensembl id + uniprot id will be dropped.
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.
Looks great!
…d, add wait for spinner to stabilize tests