Files
gui/apps/kitchen-sink/e2e/GroupPressNative.test.ts
zeekayandHanzo Dev 69c6e860d7 transplant onto tamagui v2.6.0, brand as a re-runnable transform
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.

This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.

174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.

Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
  - useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
    returns undefined there, so every Tamagui Dialog kills a prerender — the
    exact crash hanzo.app spent a day on.
  - data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.

Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.

Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.

Co-Authored-By: Hanzo Dev <[email protected]>
2026-07-30 18:25:06 -07:00

170 lines
6.2 KiB
TypeScript

/**
* Native tests for $group-press styles
* Tests both unnamed and named groups, with and without transition
* Verifies actual pixel colors change correctly
*/
import { by, element, expect, waitFor } from 'detox'
import * as assert from 'assert'
import { remountDirectUseCase } from './utils/navigation'
import { getDominantColor, isBlueish, formatRGB } from './utils/colors'
import { safeLaunchApp } from './utils/detox'
// TODO: These tests are flaky on iOS simulator - press events don't fire reliably
// Need to investigate press event handling in simulator environment
describe.skip('GroupPressNative', () => {
beforeAll(async () => {
await safeLaunchApp({
newInstance: true,
launchArgs: { directUseCase: 'GroupPressNative' },
})
await waitFor(element(by.id('group-press-native-root')))
.toExist()
.withTimeout(180000)
})
beforeEach(async () => {
await remountDirectUseCase('group-press-native-root')
})
it('should render the test case screen', async () => {
await expect(element(by.id('group-press-native-root'))).toExist()
await expect(element(by.id('group-child-no-transition'))).toExist()
await expect(element(by.id('group-child-with-transition'))).toExist()
await expect(element(by.id('named-group-child-no-transition'))).toExist()
await expect(element(by.id('named-group-child-with-transition'))).toExist()
})
describe('unnamed group without transition', () => {
it('should show blue at rest and return to blue after press', async () => {
// verify starts blue
const beforeScreenshot = await element(
by.id('group-child-no-transition')
).takeScreenshot('group1-before')
const beforeColor = getDominantColor(beforeScreenshot)
assert.ok(
isBlueish(beforeColor),
`Expected blue before tap, got ${formatRGB(beforeColor)}`
)
// tap the group
await element(by.id('group-no-transition')).tap()
await new Promise((r) => setTimeout(r, 100))
// verify returns to blue after release
const afterScreenshot = await element(
by.id('group-child-no-transition')
).takeScreenshot('group1-after')
const afterColor = getDominantColor(afterScreenshot)
assert.ok(
isBlueish(afterColor),
`Expected blue after tap, got ${formatRGB(afterColor)}`
)
// verify press events fired and not stuck
await expect(element(by.id('group1-press-in'))).toHaveText('In: 1')
await expect(element(by.id('group1-press-out'))).toHaveText('Out: 1')
await expect(element(by.id('group1-is-pressed'))).toHaveText('P: N')
})
})
describe('unnamed group with transition', () => {
it('should show blue at rest and return to blue after press', async () => {
// verify starts blue
const beforeScreenshot = await element(
by.id('group-child-with-transition')
).takeScreenshot('group2-before')
const beforeColor = getDominantColor(beforeScreenshot)
assert.ok(
isBlueish(beforeColor),
`Expected blue before tap, got ${formatRGB(beforeColor)}`
)
// tap the group
await element(by.id('group-with-transition')).tap()
// wait a bit for animation to settle
await new Promise((r) => setTimeout(r, 200))
// verify returns to blue after release
const afterScreenshot = await element(
by.id('group-child-with-transition')
).takeScreenshot('group2-after')
const afterColor = getDominantColor(afterScreenshot)
assert.ok(
isBlueish(afterColor),
`Expected blue after tap, got ${formatRGB(afterColor)}`
)
// verify press events fired and not stuck
await expect(element(by.id('group2-press-in'))).toHaveText('In: 1')
await expect(element(by.id('group2-press-out'))).toHaveText('Out: 1')
await expect(element(by.id('group2-is-pressed'))).toHaveText('P: N')
})
})
describe('named group without transition', () => {
it('should show blue at rest and return to blue after press', async () => {
// verify starts blue
const beforeScreenshot = await element(
by.id('named-group-child-no-transition')
).takeScreenshot('group3-before')
const beforeColor = getDominantColor(beforeScreenshot)
assert.ok(
isBlueish(beforeColor),
`Expected blue before tap, got ${formatRGB(beforeColor)}`
)
// tap the group
await element(by.id('named-group-no-transition')).tap()
await new Promise((r) => setTimeout(r, 100))
// verify returns to blue after release
const afterScreenshot = await element(
by.id('named-group-child-no-transition')
).takeScreenshot('group3-after')
const afterColor = getDominantColor(afterScreenshot)
assert.ok(
isBlueish(afterColor),
`Expected blue after tap, got ${formatRGB(afterColor)}`
)
// verify press events fired
await expect(element(by.id('group3-press-in'))).toHaveText('In: 1')
await expect(element(by.id('group3-press-out'))).toHaveText('Out: 1')
})
})
describe('named group with transition', () => {
it('should show blue at rest and return to blue after press', async () => {
// verify starts blue
const beforeScreenshot = await element(
by.id('named-group-child-with-transition')
).takeScreenshot('group4-before')
const beforeColor = getDominantColor(beforeScreenshot)
assert.ok(
isBlueish(beforeColor),
`Expected blue before tap, got ${formatRGB(beforeColor)}`
)
// tap the group
await element(by.id('named-group-with-transition')).tap()
// wait a bit for animation to settle
await new Promise((r) => setTimeout(r, 200))
// verify returns to blue after release
const afterScreenshot = await element(
by.id('named-group-child-with-transition')
).takeScreenshot('group4-after')
const afterColor = getDominantColor(afterScreenshot)
assert.ok(
isBlueish(afterColor),
`Expected blue after tap, got ${formatRGB(afterColor)}`
)
// verify press events fired
await expect(element(by.id('group4-press-in'))).toHaveText('In: 1')
await expect(element(by.id('group4-press-out'))).toHaveText('Out: 1')
})
})
})