test(integration): improve copy URLs test

This commit is contained in:
Rob Watson 2025-05-14 20:53:59 +02:00
parent 67cd9bd4ee
commit 34d0095b49

View File

@ -1005,15 +1005,28 @@ func TestIntegrationCopyURLs(t *testing.T) {
client, server := buildClientServer(configService, dockerClient, screen, screenCaptureC, logger) client, server := buildClientServer(configService, dockerClient, screen, screenCaptureC, logger)
ch := runClientServer(ctx, t, client, server) ch := runClientServer(ctx, t, client, server)
time.Sleep(3 * time.Second)
printScreen(t, getContents, "Ater loading the app")
for _, want := range tc.wantBindings { for _, want := range tc.wantBindings {
assert.True(t, contentsIncludes(getContents(), want.content), "expected to see %q", want) require.EventuallyWithT(
t,
func(c *assert.CollectT) {
assert.True(c, contentsIncludes(getContents(), want.content), "expected to see %q", want)
},
3*time.Second,
100*time.Millisecond,
)
sendKey(t, screen, want.key, ' ') sendKey(t, screen, want.key, ' ')
time.Sleep(3 * time.Second)
assert.True(t, contentsIncludes(getContents(), want.url), "expected to see copied message") require.EventuallyWithT(
t,
func(c *assert.CollectT) {
assert.True(c, contentsIncludes(getContents(), want.url), "expected to see copied message")
},
3*time.Second,
100*time.Millisecond,
)
printScreen(t, getContents, "After pressing the copy key")
sendKey(t, screen, tcell.KeyEscape, ' ') sendKey(t, screen, tcell.KeyEscape, ' ')
} }