|
1 |
| -import{expect,typePage}from"@playwright/test"; |
| 1 | +import{typeBrowserContext,expect,typePage}from"@playwright/test"; |
2 | 2 | importaxiosfrom"axios";
|
3 | 3 | import{typeChildProcess,exec,spawn}from"child_process";
|
4 | 4 | import{randomUUID}from"crypto";
|
@@ -445,7 +445,7 @@ const createTemplateVersionTar = async (
|
445 | 445 | resource.agents=resource.agents?.map(
|
446 | 446 | (agent:RecursivePartial<Agent>)=>{
|
447 | 447 | if(agent.apps){
|
448 |
| -agent.apps=agent.apps?.map((app:RecursivePartial<App>)=>{ |
| 448 | +agent.apps=agent.apps.map((app)=>{ |
449 | 449 | return{
|
450 | 450 | command:"",
|
451 | 451 | displayName:"example",
|
@@ -791,3 +791,23 @@ export const updateWorkspaceParameters = async (
|
791 | 791 | state:"visible",
|
792 | 792 | });
|
793 | 793 | };
|
| 794 | + |
| 795 | +exportasyncfunctionopenTerminalWindow( |
| 796 | +page:Page, |
| 797 | +context:BrowserContext, |
| 798 | +workspaceName:string, |
| 799 | +):Promise<Page>{ |
| 800 | +// Wait for the web terminal to open in a new tab |
| 801 | +constpagePromise=context.waitForEvent("page"); |
| 802 | +awaitpage.getByTestId("terminal").click(); |
| 803 | +constterminal=awaitpagePromise; |
| 804 | +awaitterminal.waitForLoadState("domcontentloaded"); |
| 805 | + |
| 806 | +// Specify that the shell should be `bash`, to prevent inheriting a shell that |
| 807 | +// isn't POSIX compatible, such as Fish. |
| 808 | +constcommandQuery=`?command=${encodeURIComponent("/usr/bin/env bash")}`; |
| 809 | +awaitexpect(terminal).toHaveURL(`/@admin/${workspaceName}.dev/terminal`); |
| 810 | +awaitterminal.goto(`/@admin/${workspaceName}.dev/terminal${commandQuery}`); |
| 811 | + |
| 812 | +returnterminal; |
| 813 | +} |