chore: custom eslint rule which complains about flaky non-retryable playwright assertions

This commit is contained in:
Alessio Gravili
2024-03-20 22:51:27 -04:00
parent f55c28352e
commit 27dfa41b67
9 changed files with 227 additions and 112 deletions

View File

@@ -35,7 +35,7 @@ module.exports = {
},
},
{
files: ['**/int.spec.ts'],
files: ['**/*.int.spec.ts', '**/int.spec.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
@@ -44,8 +44,9 @@ module.exports = {
},
},
{
extends: ['plugin:playwright/playwright-test'],
files: ['**/e2e.spec.ts'],
extends: ['plugin:playwright/recommended'],
plugins: ['payload'],
files: ['**/*.e2e.spec.ts', '**/e2e.spec.ts', 'helpers.ts'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-use-before-define': 'off',
@@ -55,6 +56,8 @@ module.exports = {
'jest/prefer-strict-equal': 'off',
'jest/require-top-level-describe': 'off',
'jest-dom/prefer-to-have-attribute': 'off',
'playwright/prefer-web-first-assertions': 'error',
'payload/no-non-retryable-assertions': 'error',
},
},
{

View File

@@ -5,7 +5,7 @@ import { expect, test } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
import { initPageConsoleErrorCatch, login, saveDocAndAssert } from '../helpers.js'
import { delayNetwork, initPageConsoleErrorCatch, login, saveDocAndAssert } from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
import config from './config.js'
@@ -42,6 +42,8 @@ describe('auth', () => {
page = await context.newPage()
initPageConsoleErrorCatch(page)
//await delayNetwork({ context, page, delay: 'Fast 3G' })
await login({
page,
serverURL,

View File

@@ -33,6 +33,8 @@
"@payloadcms/translations": "workspace:*",
"@payloadcms/ui": "workspace:*",
"create-payload-app": "workspace:*",
"eslint-plugin-playwright": "1.5.3",
"eslint-plugin-payload": "workspace:*",
"payload": "workspace:*"
}
}