@@ -66,8 +66,11 @@ export const sshIntoWorkspace = async (
66
66
page : Page ,
67
67
workspace : string ,
68
68
binaryPath = "go" ,
69
- binaryArgs = [ "run" , coderMainPath ( ) ] ,
69
+ binaryArgs : string [ ] = [ ] ,
70
70
) : Promise < ssh . Client > => {
71
+ if ( binaryPath === "go" ) {
72
+ binaryArgs = [ "run" , coderMainPath ( ) ]
73
+ }
71
74
const sessionToken = await findSessionToken ( page )
72
75
return new Promise < ssh . Client > ( ( resolve , reject ) => {
73
76
const cp = spawn ( binaryPath , [ ...binaryArgs , "ssh" , "--stdio" , workspace ] , {
@@ -120,7 +123,7 @@ export const downloadCoderVersion = async (
120
123
}
121
124
122
125
const binaryName = "coder-e2e-" + version
123
- const tempDir = "/tmp"
126
+ const tempDir = "/tmp/coder-e2e-cache "
124
127
// The install script adds `./bin` automatically to the path :shrug:
125
128
const binaryPath = path . join ( tempDir , "bin" , binaryName )
126
129
@@ -138,26 +141,35 @@ export const downloadCoderVersion = async (
138
141
// Runs our public install script using our options to
139
142
// install the binary!
140
143
await new Promise < void > ( ( resolve , reject ) => {
141
- const cp = spawn ( "sh" , [
142
- "-c " ,
144
+ const cp = spawn (
145
+ "sh " ,
143
146
[
144
- "curl" ,
145
- "-L" ,
146
- "https://coder.com/install.sh" ,
147
- "|" ,
148
- "sh" ,
149
- "-s" ,
150
- "--" ,
151
- "--version" ,
152
- version ,
153
- "--method" ,
154
- "standalone" ,
155
- "--prefix" ,
156
- tempDir ,
157
- "--binary-name" ,
158
- binaryName ,
159
- ] . join ( " " ) ,
160
- ] )
147
+ "-c" ,
148
+ [
149
+ "curl" ,
150
+ "-L" ,
151
+ "https://coder.com/install.sh" ,
152
+ "|" ,
153
+ "sh" ,
154
+ "-s" ,
155
+ "--" ,
156
+ "--version" ,
157
+ version ,
158
+ "--method" ,
159
+ "standalone" ,
160
+ "--prefix" ,
161
+ tempDir ,
162
+ "--binary-name" ,
163
+ binaryName ,
164
+ ] . join ( " " ) ,
165
+ ] ,
166
+ {
167
+ env : {
168
+ ...process . env ,
169
+ XDG_CACHE_HOME : "/tmp/coder-e2e-cache" ,
170
+ } ,
171
+ } ,
172
+ )
161
173
// eslint-disable-next-line no-console -- Needed for debugging
162
174
cp . stderr . on ( "data" , ( data ) => console . log ( data . toString ( ) ) )
163
175
cp . on ( "close" , ( code ) => {
@@ -189,7 +201,7 @@ export const startAgentWithCommand = async (
189
201
buffer = Buffer . concat ( [ buffer , data ] )
190
202
} )
191
203
try {
192
- await page . getByTestId ( "agent-status-ready" ) . isVisible ( )
204
+ await page . getByTestId ( "agent-status-ready" ) . waitFor ( { state : "visible" } )
193
205
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- The error is a string
194
206
} catch ( ex : any ) {
195
207
throw new Error ( ex . toString ( ) + "\n" + buffer . toString ( ) )
0 commit comments