test: add cypress foundation (#2903) [skip ci]

This commit is contained in:
Ryan Cohen
2022-08-15 08:34:38 +09:00
committed by GitHub
parent db898db9f2
commit 22ec058431
27 changed files with 848 additions and 17 deletions

View File

@@ -37,6 +37,7 @@ interface SidebarLinkProps {
as?: string;
requiredPermission?: Permission | Permission[];
permissionType?: 'and' | 'or';
dataTestId?: string;
}
const SidebarLinks: SidebarLinkProps[] = [
@@ -72,6 +73,7 @@ const SidebarLinks: SidebarLinkProps[] = [
svgIcon: <UsersIcon className="mr-3 h-6 w-6" />,
activeRegExp: /^\/users/,
requiredPermission: Permission.MANAGE_USERS,
dataTestId: 'sidebar-menu-users',
},
{
href: '/settings',
@@ -168,6 +170,7 @@ const Sidebar: React.FC<SidebarProps> = ({ open, setClosed }) => {
: 'hover:bg-gray-700 focus:bg-gray-700'
}
`}
data-testid={`${sidebarLink.dataTestId}-mobile`}
>
{sidebarLink.svgIcon}
{intl.formatMessage(
@@ -229,6 +232,7 @@ const Sidebar: React.FC<SidebarProps> = ({ open, setClosed }) => {
: 'hover:bg-gray-700 focus:bg-gray-700'
}
`}
data-testid={sidebarLink.dataTestId}
>
{sidebarLink.svgIcon}
{intl.formatMessage(messages[sidebarLink.messagesKey])}

View File

@@ -68,6 +68,7 @@ const Layout: React.FC = ({ children }) => {
} transition duration-300 focus:outline-none lg:hidden`}
aria-label="Open sidebar"
onClick={() => setSidebarOpen(true)}
data-testid="sidebar-toggle"
>
<MenuAlt2Icon className="h-6 w-6" />
</button>