Skip to content

Commit 227e3a6

Browse files
committed
disable animation in playwright tests
1 parent 3c4168e commit 227e3a6

7 files changed

Lines changed: 26 additions & 5 deletions

File tree

webui/e2e/dashboard-demo/dashboard.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '../models/fixture-dashboard'
1+
import { test, expect } from '../models/fixture-website'
22
import { getCellByColumnName } from '../helpers/table'
33

44
test.use({ colorScheme: 'light' })

webui/e2e/dashboard-demo/kafka.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '../models/fixture-dashboard'
1+
import { test, expect } from '../models/fixture-website'
22
import { getCellByColumnName } from '../helpers/table'
33

44
test.use({ colorScheme: 'light' })

webui/e2e/dashboard-demo/ldap.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '../models/fixture-dashboard'
1+
import { test, expect } from '../models/fixture-website'
22
import { getCellByColumnName } from '../helpers/table'
33

44
test.use({ colorScheme: 'light' })

webui/e2e/dashboard-demo/mail.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '../models/fixture-dashboard'
1+
import { test, expect } from '../models/fixture-website'
22
import { getCellByColumnName } from '../helpers/table'
33

44
test.use({ colorScheme: 'light' })

webui/e2e/dashboard-demo/petstore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from '../models/fixture-dashboard'
1+
import { test, expect } from '../models/fixture-website'
22
import { getCellByColumnName } from '../helpers/table'
33

44
test.use({ colorScheme: 'light' })

webui/e2e/models/fixture-website.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ type WebsiteFixture = {
88
export { expect } from '@playwright/test'
99

1010
export const test = base.extend<WebsiteFixture>({
11+
context: async ({ context }, use) => {
12+
await context.addInitScript(() => {
13+
const addNoMotionClass = () => {
14+
document.body.classList.add('no-motion');
15+
};
16+
document.addEventListener('DOMContentLoaded', addNoMotionClass);
17+
});
18+
await use(context);
19+
},
20+
1121
home: async ({page}, use) => {
1222
const home = new HomeModel(page)
1323
await use(home)

webui/src/assets/main.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,15 @@ i.icon {
116116
.form-select:focus {
117117
border-color: var(--form-color-border-active);
118118
box-shadow: 0 0 0 0.2rem rgba(234, 186, 171, 0.25)
119+
}
120+
/* class to disable all animations for Playwright tests */
121+
.no-motion {
122+
*,
123+
*::before,
124+
*::after {
125+
animation-duration: 0s !important;
126+
transition-duration: 0s !important;
127+
animation: none !important;
128+
transition: none !important;
129+
}
119130
}

0 commit comments

Comments
 (0)