(ctx context.Context, t *testing.T)
| 112 | } |
| 113 | |
| 114 | func newContext(ctx context.Context, t *testing.T) context.Context { |
| 115 | opts := append(chromedp.DefaultExecAllocatorOptions[:], |
| 116 | // Ubuntu 23+ enables AppArmor in a way that conflicts with Chrome's usage |
| 117 | // of unprivileged user namespaces as part of the sandboxing. Since our |
| 118 | // test does not visit any external websites, we don't really need the |
| 119 | // sandbox, so disable it. |
| 120 | chromedp.NoSandbox, |
| 121 | ) |
| 122 | |
| 123 | // browserDeadline is the deadline to use for browser tests. This is long to |
| 124 | // reduce flakiness in CI workflows. |
| 125 | const browserDeadline = time.Second * 90 |
| 126 | |
| 127 | ctx, cancel := chromedp.NewExecAllocator(ctx, opts...) |
| 128 | t.Cleanup(cancel) |
| 129 | ctx, cancel = context.WithTimeout(ctx, browserDeadline) |
| 130 | t.Cleanup(cancel) |
| 131 | ctx, cancel = chromedp.NewContext(ctx) |
| 132 | t.Cleanup(cancel) |
| 133 | return ctx |
| 134 | } |
| 135 | |
| 136 | // matchRegexp is a chromedp.Action that fetches the text of the first |
| 137 | // node that matched query and checks that the text matches regexp re. |
no outgoing calls
no test coverage detected
searching dependent graphs…