@@ -116,71 +116,4 @@ test.describe( 'Global Settings', () => {
116116 await deleteRequest
117117 await expect ( resetButton ) . not . toBeVisible ( )
118118 } )
119-
120- test ( 'When a default block is created, adding the block should have the default block\'s attributes' , async ( {
121- page,
122- editor,
123- } ) => {
124- await page . getByLabel ( 'Stackable Design System' ) . click ( )
125- await page . getByRole ( 'button' , { name : 'Block Defaults' } ) . click ( )
126-
127- // Open the Default Text Block Editor
128- const defaultBlockPagePromise = page . waitForEvent ( 'popup' )
129-
130- // Reset the block defaults first if it has been edited
131- const resetButton = page . locator ( '.components-panel__body' , { hasText : 'Block Defaults' } ) . locator ( '.stk-block-default-control' , { hasText : / ^ T e x t $ / } ) . first ( ) . getByLabel ( 'Reset' )
132-
133- if ( await resetButton . isVisible ( ) ) {
134- await resetButton . click ( )
135- }
136-
137- const textBlock = page . locator ( '.components-panel__body' , { hasText : 'Block Defaults' } ) . locator ( '.stk-block-default-control' , { hasText : / ^ T e x t $ / } ) . first ( ) . getByLabel ( 'Edit' )
138- await textBlock . click ( )
139- const defaultBlockPage = await defaultBlockPagePromise
140-
141- // Set a color for the default Text Block
142- await defaultBlockPage . locator ( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ) . first ( ) . click ( )
143- await defaultBlockPage . getByLabel ( 'Hex color' ) . fill ( 'ff0000' )
144- await defaultBlockPage . locator ( '.stk-color-palette-control .stk-control-content > .components-dropdown > .components-button' ) . first ( ) . click ( )
145-
146- // The default timeout is 30s, extend it to 90s
147- const updateRequest = defaultBlockPage . waitForResponse ( response => response . url ( ) . includes ( 'update_block_style' ) && response . request ( ) . method ( ) === 'POST' , { timeout : 90_000 } )
148-
149- // In older WP versions, the button text is 'Update' instead of 'Save'
150- if ( await defaultBlockPage . getByRole ( 'button' , {
151- name : 'Save' , exact : true , disabled : false ,
152- } ) . isVisible ( ) ) {
153- await defaultBlockPage . getByRole ( 'button' , { name : 'Save' , exact : true } ) . click ( )
154- } else if ( await defaultBlockPage . getByRole ( 'button' , { name : 'Update' , disabled : false } ) . isVisible ( ) ) {
155- await defaultBlockPage . getByRole ( 'button' , { name : 'Update' } ) . click ( )
156- }
157-
158- // Make sure default block has been updated
159- await ( await updateRequest ) . finished ( )
160-
161- // Insert a Stackable Text Block, and check if the color is the same as the one set in the default block
162- const timeouts = [ 1_000 , 5_000 , 30_000 ]
163- for ( const timeout of timeouts ) {
164- try {
165- await page . reload ( )
166- await editor . insertBlock ( {
167- name : 'stackable/text' ,
168- attributes : {
169- text : 'test' ,
170- } ,
171- } )
172-
173- await expect ( editor . canvas . locator ( '[data-type="stackable/text"] > .stk-block-text > p[role="textbox"]' ) ) . toHaveCSS ( 'color' , 'rgb(255, 0, 0)' )
174- break
175- } catch ( e ) {
176- // Ignore the error and try again because the default block might not be updated yet
177- await page . waitForTimeout ( timeout )
178- }
179- }
180-
181- // Reset Default Block
182- await page . getByLabel ( 'Stackable Design System' ) . click ( )
183- await page . getByRole ( 'button' , { name : 'Block Defaults' } ) . click ( )
184- await page . locator ( '.components-panel__body' , { hasText : 'Block Defaults' } ) . locator ( '.stk-block-default-control' , { hasText : / ^ T e x t $ / } ) . first ( ) . getByLabel ( 'Reset' ) . click ( )
185- } )
186119} )
0 commit comments