editor.test.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. jest.setTimeout(30000);
  2. describe('Editor', () => {
  3. const globalEditorExcludes =
  4. '.skiplink, .sidebar__collapse-toggle, #wagtail-sidebar, li[aria-controls^="tab-"]';
  5. beforeAll(async () => {
  6. await page.goto(`${TEST_ORIGIN}/admin/pages/add/demosite/standardpage/2/`);
  7. });
  8. it('has the right heading', async () => {
  9. const pageHeader = await page.$('h1');
  10. const pageHeaderValue = await pageHeader.evaluate((el) => el.textContent);
  11. expect(pageHeaderValue).toContain('New: Standard page');
  12. });
  13. it('axe', async () => {
  14. await expect(page).toPassAxeTests({
  15. exclude: `${globalEditorExcludes}, [aria-describedby^="placeholder-"]`,
  16. });
  17. });
  18. it('axe InlinePanel', async () => {
  19. const toggle = await page.$('.sidebar__collapse-toggle');
  20. toggle.click();
  21. const trigger = await page.$('#id_carousel_items-ADD');
  22. trigger.click();
  23. await expect(page).toPassAxeTests({
  24. exclude: `${globalEditorExcludes}, [aria-describedby^="placeholder-"]`,
  25. });
  26. });
  27. it.skip('axe embed chooser', async () => {
  28. const trigger = await page.$('.Draftail-Editor [name="EMBED"]');
  29. await Promise.all([
  30. trigger.click(),
  31. page.waitForSelector('.embed-form', { visible: true }),
  32. ]);
  33. await expect(page).toPassAxeTests({
  34. exclude: `${globalEditorExcludes}, [aria-describedby^="placeholder-"], .modal`,
  35. });
  36. await Promise.all([
  37. await page.keyboard.press('Escape'),
  38. page.waitForSelector('.Draftail-Editor--readonly', { hidden: true }),
  39. ]);
  40. });
  41. it.skip('axe image chooser', async () => {
  42. const trigger = await page.$('.Draftail-Editor [name="IMAGE"]');
  43. await Promise.all([
  44. trigger.click(),
  45. page.waitForSelector('.image-search', { visible: true }),
  46. ]);
  47. await expect(page).toPassAxeTests({
  48. exclude: `${globalEditorExcludes}, [aria-describedby^="placeholder-"], .modal`,
  49. });
  50. await Promise.all([
  51. await page.keyboard.press('Escape'),
  52. page.waitForSelector('.Draftail-Editor--readonly', { hidden: true }),
  53. ]);
  54. });
  55. it.skip('axe page chooser', async () => {
  56. const trigger = await page.$('.Draftail-Editor [name="LINK"]');
  57. await Promise.all([
  58. trigger.click(),
  59. page.waitForSelector('.page-results', { visible: true }),
  60. ]);
  61. await expect(page).toPassAxeTests({
  62. exclude: `${globalEditorExcludes}, [aria-describedby^="placeholder-"], .modal`,
  63. });
  64. await Promise.all([
  65. await page.keyboard.press('Escape'),
  66. page.waitForSelector('.Draftail-Editor--readonly', { hidden: true }),
  67. ]);
  68. });
  69. });