app: add testIDs to workspace header and use them in e2e assertions
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
import { usePathname } from "expo-router";
|
||||
import { Platform } from "react-native";
|
||||
import { WorkspaceScreen } from "@/screens/workspace/workspace-screen";
|
||||
import { usePathname } from 'expo-router'
|
||||
import { WorkspaceScreen } from '@/screens/workspace/workspace-screen'
|
||||
import {
|
||||
parseHostWorkspaceOpenIntentFromPathname,
|
||||
parseHostWorkspaceRouteFromPathname,
|
||||
} from "@/utils/host-routes";
|
||||
parseHostWorkspaceOpenIntentFromPathname,
|
||||
} from '@/utils/host-routes'
|
||||
|
||||
export default function HostWorkspaceLayout() {
|
||||
const pathname = usePathname();
|
||||
const resolvedPathname =
|
||||
Platform.OS === "web" && typeof window !== "undefined"
|
||||
? `${window.location.pathname}${window.location.search}${window.location.hash}`
|
||||
: pathname;
|
||||
const activeRoute = parseHostWorkspaceRouteFromPathname(resolvedPathname);
|
||||
const serverId = activeRoute?.serverId ?? "";
|
||||
const workspaceId = activeRoute?.workspaceId ?? "";
|
||||
const openIntent = parseHostWorkspaceOpenIntentFromPathname(resolvedPathname);
|
||||
const expoPathname = usePathname()
|
||||
const resolvedPathname = expoPathname
|
||||
const activeRoute = parseHostWorkspaceRouteFromPathname(resolvedPathname)
|
||||
const serverId = activeRoute?.serverId ?? ''
|
||||
const workspaceId = activeRoute?.workspaceId ?? ''
|
||||
const openIntent = parseHostWorkspaceOpenIntentFromPathname(resolvedPathname)
|
||||
|
||||
return (
|
||||
<WorkspaceScreen
|
||||
@@ -24,5 +20,5 @@ export default function HostWorkspaceLayout() {
|
||||
workspaceId={workspaceId}
|
||||
openIntent={openIntent}
|
||||
/>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1059,10 +1059,18 @@ function WorkspaceScreenContent({
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Text style={styles.headerTitle} numberOfLines={1}>
|
||||
<Text
|
||||
testID="workspace-header-title"
|
||||
style={styles.headerTitle}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{workspaceHeader.title}
|
||||
</Text>
|
||||
<Text style={styles.headerProjectTitle} numberOfLines={1}>
|
||||
<Text
|
||||
testID="workspace-header-subtitle"
|
||||
style={styles.headerProjectTitle}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{workspaceHeader.subtitle}
|
||||
</Text>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user