Conversation
hallieswan
commented
May 2, 2024
- bump playwright version
- add linting rule recommended in playwright best practices
- add e2e tests for GCT gene pinning
| "ecmaVersion": "latest", | ||
| "sourceType": "module" | ||
| "sourceType": "module", | ||
| "project": ["./tsconfig.base.json"] |
There was a problem hiding this comment.
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.
| "@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.
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.
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.
| beforeEach(waitForAsync(async () => { | ||
| await TestBed.configureTestingModule({ |
There was a problem hiding this comment.
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.
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.
Specifies which files should be linted
| "strictInputAccessModifiers": true, | ||
| "strictTemplates": true | ||
| }, | ||
| "extends": "./tsconfig.base.json", |
There was a problem hiding this comment.
Extend the base tsconfig, so that an exclude block can still be used when bundling via webpack
| 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.
Waiting for loader to be removed reduces flakiness when page takes a long time to load
|
|
||
| // 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.
Fix warning from @typescript-eslint/no-floating-promises -- toBeVisible is an auto-retrying assertion, so should be awaited
| <div *ngIf="genesTable.filteredValue?.length"> | ||
| <button | ||
| class="pin-all-button" | ||
| [disabled]="getPinDisabledStatus()" |
There was a problem hiding this comment.
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.
Expect this test to fail -- since AG-1425, only genes will be pinned from an RNA url. ensembl id + uniprot id will be dropped.
…d, add wait for spinner to stabilize tests