`@effect/ui-native` / `@effect/ui/testing` (Effect-TS/ui): `Locator.testId` only matches HTML `attrs["data-testid"]` and cannot locate React Native `.prop("testID", ...)`
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- react-native, typescript
- Área
- testing
Línea de trabajo
Start with packages/ui/src/testing/Locator.ts, where testId matches data-testid, and compare it with the native props described in the issue. Check the existing locator tests and the native testing exports in packages/ui-native/src/testing/index.ts. Done means Locator.testId("save-button") can find a node tagged through .prop("testID", "save-button") and the behavior is covered by a test; an open linked pull request is already addressing this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
partially generated with help of my ai friend - neon 4.4
Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native
What version of Effect is running?
effect:4.1.7@effect/ui&@effect/ui-native:Effect-TS/uimainat77391ee50ae3d3175d670facbf675e9a819ba6a6react-native:0.88.1
What steps can reproduce the bug?
- Clone the minimal reproduction repository:
git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git cd effectui-native-error-reproductions pnpm install pnpm test - Render a
Native.componentthat sets React Native's standardtestIDprop via.prop("testID", "save-button"):
const ActionButton = Native.component({
name: "ActionButton",
model: Schema.Number,
message: Message
}).make({
init: () => 0,
update: {
Pressed: ($) => $.model + 1
},
view: (h, count) =>
h.view
.prop("testID", "save-button")
.on("press", () => Message.Pressed())
.children(h.text.children(`Saved ${count}`))
})
- Query the rendered tree in a
Playtest usingLocator.testId("save-button")(see01-locator-testid-misses-native-props-testid/repro.test.ts).
What is the expected behavior?
Locator.testId("save-button") (or a native locator / Locator.prop(...) helper exported from @effect/ui/testing or @effect/ui-native/testing) should find native elements whose testID was set with .prop("testID", "save-button"), so Play and Scene tests can target native nodes by test ID without writing custom tree-walking locators.
What do you see instead?
packages/ui-native/src/Native.ts:668 defines readonly testID?: string | undefined on ViewProps, which writes to node.props.testID while leaving node.attrs empty.
However, packages/ui/src/testing/Locator.ts:188 implements testId strictly against HTML attributes:
export const testId = (id: string): Locator => attr("data-testid", id)
Even though Locator.Node (packages/ui/src/testing/Locator.ts:45-51) already models readonly props?: Readonly<Record<string, unknown>> | undefined, Locator.testId("save-button") returns [] for native views, causing play.expect(Locator.testId("save-button")).toExist() to fail.
Additionally, @effect/ui/testing does not export a Locator.prop(name, value) builder, and @effect/ui-native/testing (packages/ui-native/src/testing/index.ts) currently only exports TestDevice.
Additional information
In React Native / Fabric, .prop("testID", id) maps to native accessibility identifiers (e.g. accessibilityIdentifier on iOS) and is the idiomatic way to tag custom components for both component tests and native E2E tests.
Possible fixes:
- Have
Locator.testId(id)match eithernode.attrs?.["data-testid"] === idornode.props?.testID === id, and/or - Export
Locator.prop(name, value?)from@effect/ui/testing(and optionally aNativeLocator.testIDhelper from@effect/ui-native/testing).
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 21 h 22 min
- PR fusionados (30 d)
- 486
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11097 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Posiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11096 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
check:failed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
iptv-org/iptv#60585 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsPosiblemente ocupada @Piyush4801 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jaegertracing/jaeger-ui#4865 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día