mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-05 22:55:33 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c00034b57 | ||
|
|
ce6f7d16a9 | ||
|
|
4dde313d45 |
@@ -8,6 +8,10 @@ import {
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { waitForWorkspaceTabsVisible } from "../support/helpers/workspace-tabs";
|
||||
|
||||
function visibleTerminalTabs(page: Page) {
|
||||
return page.locator('[data-testid^="workspace-tab-terminal_"]').filter({ visible: true });
|
||||
}
|
||||
|
||||
// The browser owns Cmd+Shift+brackets for its own tabs, so web keeps
|
||||
// Alt+Shift+brackets on every OS. Desktop bindings live in the desktop suite.
|
||||
test("web switches to the previous and next tab with Alt+Shift+[ and ]", async ({ page }) => {
|
||||
@@ -15,9 +19,7 @@ test("web switches to the previous and next tab with Alt+Shift+[ and ]", async (
|
||||
try {
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await waitForWorkspaceTabsVisible(page);
|
||||
const terminalTabs = page
|
||||
.locator('[data-testid^="workspace-tab-terminal_"]')
|
||||
.filter({ visible: true });
|
||||
const terminalTabs = visibleTerminalTabs(page);
|
||||
await clickNewTerminal(page);
|
||||
await expect(terminalTabs).toHaveCount(1, { timeout: 30_000 });
|
||||
await clickNewTerminal(page);
|
||||
@@ -38,7 +40,8 @@ test("web switches to the previous and next tab with Alt+Shift+[ and ]", async (
|
||||
|
||||
async function openBlankTabAfterTerminal(page: Page) {
|
||||
await clickNewTerminal(page);
|
||||
await page.getByRole("button", { name: "Terminal 1", exact: true }).focus();
|
||||
// The shell can set its own tab title before the terminal is ready for input.
|
||||
await visibleTerminalTabs(page).and(page.locator('[aria-selected="true"]')).focus();
|
||||
await openNewTabMenuWithShortcut(page);
|
||||
return page
|
||||
.getByRole("button", { name: "New tab", exact: true })
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Start with Claude's provider details open on a connected Android device.
|
||||
# Open the app with agent-device --no-test-ime so the software keyboard is visible.
|
||||
SESSION="${AGENT_DEVICE_SESSION:-default}"
|
||||
SERIAL="${ANDROID_SERIAL:-$(adb devices | awk '/\tdevice$/ {print $1; exit}')}"
|
||||
device() {
|
||||
agent-device --session "$SESSION" "$@"
|
||||
}
|
||||
|
||||
MODEL_HINT="e.g. openai/gpt-5"
|
||||
MODEL_FIELD="label=\"$MODEL_HINT\" role=text-field"
|
||||
|
||||
open_sheet() {
|
||||
device press 'label="Add model" role=button' --settle
|
||||
device wait "$MODEL_FIELD" 15000
|
||||
}
|
||||
|
||||
keyboard_shown() {
|
||||
adb -s "$SERIAL" shell dumpsys input_method | grep 'mInputShown=true' >/dev/null
|
||||
}
|
||||
|
||||
focus_model_field() {
|
||||
device press "$MODEL_FIELD" --settle
|
||||
if ! keyboard_shown; then
|
||||
echo "The software keyboard did not open." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
model_field_bounds() {
|
||||
device snapshot -i --json | jq -ce --arg hint "$MODEL_HINT" '
|
||||
.data.nodes[] | select(.label == $hint and .kind == "text-field" and .visibleToUser) | .rect
|
||||
'
|
||||
}
|
||||
|
||||
open_sheet
|
||||
focus_model_field
|
||||
|
||||
# This press fails if the keyboard covers the button.
|
||||
device press 'label="Cancel" role=button'
|
||||
device wait absent "$MODEL_FIELD" 15000
|
||||
|
||||
open_sheet
|
||||
resting_bounds=$(model_field_bounds)
|
||||
focus_model_field
|
||||
device back --system --settle
|
||||
if keyboard_shown; then
|
||||
echo "Android Back did not dismiss the keyboard." >&2
|
||||
exit 1
|
||||
fi
|
||||
restored_bounds=$(model_field_bounds)
|
||||
if [[ "$restored_bounds" != "$resting_bounds" ]]; then
|
||||
echo "Model ID did not return to its resting bounds: $restored_bounds instead of $resting_bounds." >&2
|
||||
exit 1
|
||||
fi
|
||||
device press 'label="Cancel" role=button'
|
||||
device wait absent "$MODEL_FIELD" 15000
|
||||
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Keyboard, Text, View } from "react-native";
|
||||
import { Keyboard, Platform, Text, View } from "react-native";
|
||||
import type { DimensionValue, StyleProp, ViewProps, ViewStyle } from "react-native";
|
||||
import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
@@ -694,6 +694,11 @@ function CompactSheetBody({
|
||||
);
|
||||
}
|
||||
|
||||
function getCompactSheetKeyboardBehavior(snapPoints: readonly string[]) {
|
||||
// With one snap point, extending cannot lift the sheet above the Android keyboard.
|
||||
return Platform.OS === "android" && snapPoints.length === 1 ? "interactive" : "extend";
|
||||
}
|
||||
|
||||
export function AdaptiveModalSheet(props: AdaptiveModalSheetProps) {
|
||||
const panelActive = useRetainedPanelActive();
|
||||
const { visible, onClose, onDismiss } = props;
|
||||
@@ -863,7 +868,7 @@ function AdaptiveModalSheetPresentation({
|
||||
enablePanDownToClose
|
||||
backgroundComponent={SheetBackground}
|
||||
handleComponent={SheetHandle}
|
||||
keyboardBehavior="extend"
|
||||
keyboardBehavior={getCompactSheetKeyboardBehavior(resolvedSnapPoints)}
|
||||
keyboardBlurBehavior="restore"
|
||||
accessible={false}
|
||||
presentation={presentation}
|
||||
|
||||
Reference in New Issue
Block a user