| 170 | * Tests that need the creation UI must explicitly open the project page. |
| 171 | */ |
| 172 | export async function openProjectCreationView( |
| 173 | view: RenderedApp, |
| 174 | projectPath: string |
| 175 | ): Promise<void> { |
| 176 | await view.waitForReady(); |
| 177 | |
| 178 | const projectRow = await waitFor( |
| 179 | () => { |
| 180 | const el = view.container.querySelector( |
| 181 | `[data-project-path="${projectPath}"][aria-controls]` |
| 182 | ) as HTMLElement | null; |
| 183 | if (!el) throw new Error("Project not found in sidebar"); |
| 184 | return el; |
| 185 | }, |
| 186 | { timeout: 10_000 } |
| 187 | ); |
| 188 | |
| 189 | fireEvent.click(projectRow); |
| 190 | |
| 191 | await waitFor( |
| 192 | () => { |
| 193 | const textarea = view.container.querySelector("textarea"); |
| 194 | if (!textarea) { |
| 195 | throw new Error("Project creation page not rendered"); |
| 196 | } |
| 197 | }, |
| 198 | { timeout: 10_000 } |
| 199 | ); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Add a project through the sidebar modal. |