|
| 1 | +const alerts = [ |
| 2 | + { |
| 3 | + name: 'Success', |
| 4 | + path: 'design-system-alert--success', |
| 5 | + class: '.Alert__title', |
| 6 | + }, |
| 7 | + { |
| 8 | + name: 'Info', |
| 9 | + path: 'design-system-alert--info', |
| 10 | + class: '.Alert__title', |
| 11 | + }, |
| 12 | + { |
| 13 | + name: 'Announcement', |
| 14 | + path: 'design-system-alert--announcement', |
| 15 | + class: '.Alert__title', |
| 16 | + }, |
| 17 | + { |
| 18 | + name: 'Error', |
| 19 | + path: 'design-system-alert--error', |
| 20 | + class: '.Alert__title', |
| 21 | + }, |
| 22 | + { |
| 23 | + name: 'Warning', |
| 24 | + path: 'design-system-alert--warning', |
| 25 | + class: '.Alert__title', |
| 26 | + }, |
| 27 | + { |
| 28 | + name: 'With Dismiss', |
| 29 | + path: 'design-system-alert--with-dismiss', |
| 30 | + class: '.Alert__title', |
| 31 | + match: 'Default title', |
| 32 | + }, |
| 33 | + { |
| 34 | + name: 'With Call To Action', |
| 35 | + path: 'design-system-alert--with-call-to-action', |
| 36 | + class: '.Alert__title', |
| 37 | + match: 'Success title', |
| 38 | + }, |
| 39 | +]; |
| 40 | + |
| 41 | +describe('Alert', () => { |
| 42 | + alerts.forEach((test) => { |
| 43 | + it(test.name, () => { |
| 44 | + cy.visit(test.path); |
| 45 | + const match = test.match ? test.match : test.name; |
| 46 | + cy.get('#storybook-preview-iframe').iframe().find(test.class).should('contain', match); |
| 47 | + cy.percySnapshot(test.path); |
| 48 | + }); |
| 49 | + }); |
| 50 | +}); |
0 commit comments