Don't show user avatar in snapshot tests (#2130)

* Make user avatar 404 in snapshot tests

* Make fallback menu button look better

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Give AppHeader consistent height

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Rerun CI

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Rerun CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2024-04-16 14:29:33 -04:00
committed by GitHub
parent db5abf0149
commit 25fa3b48e1
18 changed files with 31 additions and 6 deletions

View File

@ -27,6 +27,16 @@ test.beforeEach(async ({ page }) => {
settings: TOML.stringify({ settings: TEST_SETTINGS }), settings: TOML.stringify({ settings: TEST_SETTINGS }),
} }
) )
// Make the user avatar image always 404
// so we see the fallback menu icon for all snapshot tests
await page.route('https://lh3.googleusercontent.com/**', async (route) => {
await route.fulfill({
status: 404,
contentType: 'text/plain',
body: 'Not Found!',
})
})
}) })
test.setTimeout(60_000) test.setTimeout(60_000)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -219,6 +219,16 @@ const CustomIconMap = {
/> />
</svg> </svg>
), ),
menu: (
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M15 6H5V5H15V6ZM15 10.5H5V9.5H15V10.5ZM5 15H15V14H5V15Z"
fill="currentColor"
/>
</svg>
),
move: ( move: (
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path

View File

@ -24,7 +24,7 @@ const ProjectSidebarMenu = ({
}) => { }) => {
const { onProjectClose } = useLspContext() const { onProjectClose } = useLspContext()
return ( return (
<div className="!no-underline h-full mr-auto max-h-min min-w-max flex items-center gap-2"> <div className="!no-underline h-full mr-auto max-h-min min-h-12 min-w-max flex items-center gap-2">
<Link <Link
onClick={() => { onClick={() => {
onProjectClose(file || null, project?.path || null, false) onProjectClose(file || null, project?.path || null, false)

View File

@ -98,7 +98,9 @@ describe('UserSidebarMenu tests', () => {
</TestWrap> </TestWrap>
) )
expect(screen.getByTestId('user-sidebar-toggle')).toHaveTextContent('Menu') expect(screen.getByTestId('user-sidebar-toggle')).toHaveTextContent(
'User menu'
)
}) })
}) })

View File

@ -1,6 +1,6 @@
import { Popover, Transition } from '@headlessui/react' import { Popover, Transition } from '@headlessui/react'
import { ActionButton } from './ActionButton' import { ActionButton } from './ActionButton'
import { faBars, faBug, faSignOutAlt } from '@fortawesome/free-solid-svg-icons' import { faBug, faSignOutAlt } from '@fortawesome/free-solid-svg-icons'
import { faGithub } from '@fortawesome/free-brands-svg-icons' import { faGithub } from '@fortawesome/free-brands-svg-icons'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import { Fragment, useState } from 'react' import { Fragment, useState } from 'react'
@ -8,6 +8,7 @@ import { paths } from 'lib/paths'
import { Models } from '@kittycad/lib' import { Models } from '@kittycad/lib'
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext' import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath' import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
import Tooltip from './Tooltip'
type User = Models['User_type'] type User = Models['User_type']
@ -54,11 +55,13 @@ const UserSidebarMenu = ({ user }: { user?: User }) => {
) : ( ) : (
<ActionButton <ActionButton
Element={Popover.Button} Element={Popover.Button}
icon={{ icon: faBars }} icon={{ icon: 'menu' }}
className="border-transparent" className="border-transparent !px-0"
data-testid="user-sidebar-toggle" data-testid="user-sidebar-toggle"
> >
Menu <Tooltip position="left" delay={1000}>
User menu
</Tooltip>
</ActionButton> </ActionButton>
)} )}
<Transition <Transition