File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ function isStarterTemplate(
190
190
export const createTemplate = async (
191
191
page : Page ,
192
192
responses ?: EchoProvisionerResponses | StarterTemplates ,
193
+ organizationName : string = "coder" ,
193
194
) : Promise < string > => {
194
195
let path = "/templates/new" ;
195
196
if ( isStarterTemplate ( responses ) ) {
@@ -210,12 +211,26 @@ export const createTemplate = async (
210
211
} ) ;
211
212
}
212
213
214
+ // If the organization picker is present on the page, select the default
215
+ // organization.
216
+ const orgPicker = page . getByLabel ( "Belongs to *" ) ;
217
+ const organizationsEnabled = await orgPicker . isVisible ( ) ;
218
+ if ( organizationsEnabled ) {
219
+ await orgPicker . click ( ) ;
220
+ await page . getByText ( organizationName , { exact : true } ) . click ( ) ;
221
+ }
222
+
213
223
const name = randomName ( ) ;
214
224
await page . getByLabel ( "Name *" ) . fill ( name ) ;
215
225
await page . getByTestId ( "form-submit" ) . click ( ) ;
216
- await expectUrl ( page ) . toHavePathName ( `/templates/${ name } /files` , {
217
- timeout : 30000 ,
218
- } ) ;
226
+ await expectUrl ( page ) . toHavePathName (
227
+ organizationsEnabled
228
+ ? `/templates/${ organizationName } /${ name } /files`
229
+ : `/templates/${ name } /files` ,
230
+ {
231
+ timeout : 30000 ,
232
+ } ,
233
+ ) ;
219
234
return name ;
220
235
} ;
221
236
You can’t perform that action at this time.
0 commit comments