@@ -143,28 +143,45 @@ test.describe('Point-and-click assemblies tests', () => {
143143 await scene . settled ( cmdBar )
144144 } )
145145
146- await test . step ( 'Insert a second time and expect error' , async ( ) => {
147- // TODO: revisit once we have clone with #6209
148- await insertPartIntoAssembly (
149- 'bracket.kcl' ,
150- 'bracket' ,
151- toolbar ,
152- cmdBar ,
153- page
154- )
146+ await test . step ( 'Insert a second time with the same name and expect error' , async ( ) => {
147+ await toolbar . insertButton . click ( )
148+ await cmdBar . selectOption ( { name : 'bracket.kcl' } ) . click ( )
149+ await cmdBar . expectState ( {
150+ stage : 'arguments' ,
151+ currentArgKey : 'localName' ,
152+ currentArgValue : '' ,
153+ headerArguments : { Path : 'bracket.kcl' , LocalName : '' } ,
154+ highlightedHeaderArg : 'localName' ,
155+ commandName : 'Insert' ,
156+ } )
157+ await page . keyboard . insertText ( 'bracket' )
158+ await cmdBar . progressCmdBar ( )
159+ await expect (
160+ page . getByText ( 'This variable name is already in use' )
161+ ) . toBeVisible ( )
162+ } )
163+
164+ await test . step ( 'Insert a second time with a different name and expect error' , async ( ) => {
165+ await page . keyboard . insertText ( '2' )
166+ await cmdBar . progressCmdBar ( )
167+ await cmdBar . expectState ( {
168+ stage : 'review' ,
169+ headerArguments : { Path : 'bracket.kcl' , LocalName : 'bracket2' } ,
170+ commandName : 'Insert' ,
171+ } )
172+ await cmdBar . progressCmdBar ( )
155173 await editor . expectEditor . toContain (
156174 `
157175 import "cylinder.kcl" as cylinder
158176 import "bracket.kcl" as bracket
159- import "bracket.kcl" as bracket
177+ import "bracket.kcl" as bracket2
160178 cylinder
161179 bracket
162- bracket
180+ bracket2
163181 ` ,
164182 { shouldNormalise : true }
165183 )
166- await scene . settled ( cmdBar )
167- await expect ( page . locator ( '.cm-lint-marker-error' ) ) . toBeVisible ( )
184+ // TODO: update once we have clone() with #6209
168185 } )
169186 }
170187 )
0 commit comments