Skip to content

Commit 000ebd2

Browse files
committed
test: add visual regression tests for Tooltip
1 parent 0a28914 commit 000ebd2

File tree

7 files changed

+227
-11
lines changed

7 files changed

+227
-11
lines changed

regression-test/cypress/e2e/spec.cy.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function terminalLog(violations: Result[]) {
6565
const axeOptions: { runOnly: RunOnly } = {
6666
runOnly: {
6767
type: 'tag',
68-
values: ['wcag2a', 'wcag2aa', 'section508', 'best-practice']
68+
values: ['wcag2a', 'wcag2aa', 'section508']
6969
}
7070
}
7171

@@ -87,4 +87,10 @@ describe('visual regression test', () => {
8787
cy.injectAxe()
8888
cy.checkA11y('.axe-test', axeOptions, terminalLog)
8989
})
90+
91+
it('check tooltip', { env: { delay: 500 } }, () => {
92+
cy.visit('http://localhost:3000/tooltip')
93+
cy.injectAxe()
94+
cy.checkA11y('.axe-test', axeOptions, terminalLog)
95+
})
9096
})

regression-test/next.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*//** @type {import('next').NextConfig} */
24-
const nextConfig = {}
24+
const nextConfig = {
25+
// strict mode needs to be disabled, so deterministic ID generation
26+
// works. If its enabled, client side double rendering causes IDs to
27+
// come out of sync. TODO fix
28+
reactStrictMode: false
29+
}
2530

2631
export default nextConfig

regression-test/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "next build",
99
"start": "next start",
1010
"lint": "next lint",
11-
"cypress": "ELECTRON_EXTRA_LAUNCH_ARGS=--remote-debugging-port=9222 cypress run"
11+
"cypress": "ELECTRON_EXTRA_LAUNCH_ARGS=--remote-debugging-port=9222 cypress run",
12+
"cypress-chrome": "cypress open --browser chrome"
1213
},
1314
"keywords": [],
1415
"devDependencies": {

regression-test/src/app/avatar/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export default function AvatarPage() {
255255
name="David Herbert"
256256
hasInverseColor
257257
color="fire"
258-
themeOverride={{ colorFire: '#efb410' }}
258+
themeOverride={{ colorFire: '#013410' }}
259259
/>
260260
</div>
261261
<div>

regression-test/src/app/layout.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,26 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
* SOFTWARE.
2323
*/
24+
'use client'
2425
import React from 'react'
25-
import type { Metadata } from 'next'
2626
import { Inter } from 'next/font/google'
2727
import './globals.css'
28+
import { InstUISettingsProvider } from '@instructure/emotion'
2829

2930
const inter = Inter({ subsets: ['latin'] })
3031

31-
export const metadata: Metadata = {
32-
title: 'InstUI Visual Regression Test Suite'
33-
}
34-
3532
export default function RootLayout({
3633
children
3734
}: Readonly<{
3835
children: React.ReactNode
3936
}>) {
4037
return (
38+
// we need to make a new Map to reset counting on the server side
39+
// on each page refresh TODO fix
4140
<html lang="en">
42-
<body className={inter.className}>{children}</body>
41+
<InstUISettingsProvider instanceCounterMap={new Map()}>
42+
<body className={inter.className}>{children}</body>
43+
</InstUISettingsProvider>
4344
</html>
4445
)
4546
}

regression-test/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'use client'
2626
import { Link } from 'instructure-ui/ui-link/es/index'
2727

28-
const components = ['button', 'alert', 'avatar']
28+
const components = ['button', 'alert', 'avatar', 'tooltip']
2929

3030
export default function Home() {
3131
return (

regression-test/src/app/tooltip/page.tsx

Lines changed: 203 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)