|
1 | 1 | import App from './App.vue'
|
2 | 2 | import { getRandomIntInclusive, isFirefox } from '../cypress/support/component'
|
3 | 3 |
|
| 4 | +beforeEach(() => { |
| 5 | + /** |
| 6 | + * For some unknown reason on Cypress Firefox >=124 (only on CI) reduced motion is always set to 'reduce', |
| 7 | + * using this stub to force it to return true. |
| 8 | + */ |
| 9 | + if (isFirefox) { |
| 10 | + cy.stub(window, 'matchMedia').withArgs('(prefers-reduced-motion: reduce)').returns({ |
| 11 | + matches: false, |
| 12 | + }) |
| 13 | + } |
| 14 | +}) |
| 15 | + |
4 | 16 | it('Should be able to set different tag name', () => {
|
5 | 17 | cy.mount(App, {
|
6 | 18 | props: {
|
@@ -113,42 +125,39 @@ it('Should update data-collapse attribute properly', () => {
|
113 | 125 | }
|
114 | 126 | })
|
115 | 127 |
|
116 |
| -// Bugged CI test, works locally and with any other browser |
117 |
| -if (!isFirefox) { |
118 |
| - describe('Should execute callbacks properly', () => { |
119 |
| - function testCallbacks(isLastActionExpand: boolean) { |
120 |
| - const repeatEven = getRandomIntInclusive(10, 20) * 2 |
121 |
| - for (let i = 0; i < repeatEven; i++) { |
122 |
| - cy.get('#TriggerButton').click().wait(50) |
123 |
| - } |
124 |
| - |
125 |
| - cy.get('#CountExpand') |
126 |
| - .should('have.text', `${repeatEven / 2}`) |
127 |
| - .get('#CountExpanded') |
128 |
| - .should('have.text', isLastActionExpand ? '0' : '1') |
129 |
| - .get('#CountCollapse') |
130 |
| - .should('have.text', `${repeatEven / 2}`) |
131 |
| - .get('#CountCollapsed') |
132 |
| - .should('have.text', isLastActionExpand ? '1' : '0') |
| 128 | +describe('Should execute callbacks properly', () => { |
| 129 | + function testCallbacks(isLastActionExpand: boolean) { |
| 130 | + const repeatEven = getRandomIntInclusive(10, 20) * 2 |
| 131 | + for (let i = 0; i < repeatEven; i++) { |
| 132 | + cy.get('#TriggerButton').click().wait(50) |
133 | 133 | }
|
134 | 134 |
|
135 |
| - it('Expand as last action', () => { |
136 |
| - cy.mount(App) |
| 135 | + cy.get('#CountExpand') |
| 136 | + .should('have.text', `${repeatEven / 2}`) |
| 137 | + .get('#CountExpanded') |
| 138 | + .should('have.text', isLastActionExpand ? '0' : '1') |
| 139 | + .get('#CountCollapse') |
| 140 | + .should('have.text', `${repeatEven / 2}`) |
| 141 | + .get('#CountCollapsed') |
| 142 | + .should('have.text', isLastActionExpand ? '1' : '0') |
| 143 | + } |
137 | 144 |
|
138 |
| - testCallbacks(true) |
139 |
| - }) |
| 145 | + it('Expand as last action', () => { |
| 146 | + cy.mount(App) |
140 | 147 |
|
141 |
| - it('Collapse as last action', () => { |
142 |
| - cy.mount(App, { |
143 |
| - props: { |
144 |
| - initialValue: true, |
145 |
| - }, |
146 |
| - }) |
| 148 | + testCallbacks(true) |
| 149 | + }) |
147 | 150 |
|
148 |
| - testCallbacks(false) |
| 151 | + it('Collapse as last action', () => { |
| 152 | + cy.mount(App, { |
| 153 | + props: { |
| 154 | + initialValue: true, |
| 155 | + }, |
149 | 156 | })
|
| 157 | + |
| 158 | + testCallbacks(false) |
150 | 159 | })
|
151 |
| -} |
| 160 | +}) |
152 | 161 |
|
153 | 162 | describe('With baseHeight > 0', () => {
|
154 | 163 | it('Should have correct styles if collapsed on mount', () => {
|
|
0 commit comments