test(app): shell proof of the sheet list search, sort and dates
admin-sheets-list.spec.ts (sandbox, fr and en, desktop and 375 px): three
draft sheets of this run, the oldest saved last; search, count line against
the list answer of the same load, order by last modification then by name,
the Paris date format, a search cut at 100 characters and its clearing, axe
and no sideways scroll on the searched list, the empty state and
/app/admin; the home's latest changes. Teardown soft-deletes only the ids
this run created (D7).
allSheetsLink (e2e/support/admin.ts): the sheets card link named
admin.home.all_sheets or admin.home.see_all with any number.
R-24, locators rewritten (assertions unchanged):
- admin.spec.ts A1: areaCard(...).getByRole('link', { name:
dict['admin.home.all_sheets'] }) -> allSheetsLink(areaCard(...), dict)
- admin.spec.ts access per right: sheets.getByRole('link', { name:
dict['admin.home.all_sheets'] }) -> allSheetsLink(sheets, dict)
- editor-journey.spec.ts createSheetFromAdmin: section locator
.getByRole('link', { name: dict['admin.home.all_sheets'] }) ->
allSheetsLink(section locator, dict)
This commit is contained in:
1 parent
2326e1cb15
commit
b4a5254068
4 files changed
+353
-11
No files matched your search
@@ -173,3 +173,20 @@ export async function stepUpAdmin(page: Page, dict: Dict, secret: string) {
|
||||
}
|
||||
await expect(stepUpHeading(page, dict)).toBeHidden()
|
||||
}
|
||||
|
||||
const escaped = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
|
||||
/**
|
||||
* The link of the sheets card to the full list: « Toutes les fiches officielles »
|
||||
* for zero or one sheet, « Voir les {count} fiches » from two (R3, D6), any number.
|
||||
*/
|
||||
export function allSheetsLink(scope: Page | Locator, dict: Dict): Locator {
|
||||
const seeAll = escaped(dict['admin.home.see_all']).replace(
|
||||
'\\{count\\}',
|
||||
'\\d+',
|
||||
)
|
||||
const name = new RegExp(
|
||||
`^(${escaped(dict['admin.home.all_sheets'])}|${seeAll})$`,
|
||||
)
|
||||
return scope.getByRole('link', { name })
|
||||
}
|
||||
Reference in new issue
Block a user