Skip to content

Commit

Permalink
chore: add e2e for error display on Marketing Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Aug 30, 2023
1 parent 682b641 commit 8c3be5e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/blocks/test/e2e/blocks/form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,26 @@ test.describe( 'Form Block', () => {
// check for a element with the attribute data-redirect-url
await expect( await page.$( `[data-redirect="${REDIRECT_URL}"]` ) ).toBeTruthy();
});

test( 'errors on invalid API Key for Market Integration', async({ page, editor, browser }) => {

await editor.insertBlock({ name: 'themeisle-blocks/form' });

let formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );

expect( formBlock ).toBeTruthy();

const { clientId } = formBlock;

await page.click( `#block-${clientId} > div > fieldset > ul > li:nth-child(1) > button` );

await page.getByRole( 'button', { name: 'Marketing Integration' }).click();

// Select the Mailchimp option on the select with label Provider
await page.getByLabel( 'Provider' ).selectOption( 'mailchimp' );

await page.getByLabel( 'API Key' ).fill( 'invalid-api-key' );

await expect( page.getByLabel( 'Dismiss this notice' ) ).toBeVisible();
});
});

0 comments on commit 8c3be5e

Please sign in to comment.