Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions test/e2e/specs/admin/connectors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@ test.describe( 'Connectors', () => {
).toHaveAttribute( 'href', 'plugin-install.php' );
} );

test( 'should display the AI plugin callout banner with install button', async ( {
page,
admin,
} ) => {
await admin.visitAdminPage( SETTINGS_PAGE_PATH, CONNECTORS_PAGE_QUERY );

const banner = page.locator( '.ai-plugin-callout' );
await expect( banner ).toBeVisible();

// Verify the banner message mentions the AI plugin.
await expect( banner.getByText( 'AI plugin' ) ).toBeVisible();

// Verify the Install button is present.
await expect(
banner.getByRole( 'button', { name: 'Install AI Experiments' } )
).toBeVisible();

// Verify the Learn more link is present.
await expect(
banner.getByRole( 'link', { name: 'Learn more' } )
).toBeVisible();
} );

test.describe( 'Empty state', () => {
const PLUGIN_SLUG = 'gutenberg-test-connectors-empty-state';

Expand Down Expand Up @@ -116,6 +139,9 @@ test.describe( 'Connectors', () => {
'plugin-install.php'
);

// Verify the AI plugin callout banner is not shown.
await expect( page.locator( '.ai-plugin-callout' ) ).toBeHidden();

// Verify none of the default connector cards are shown.
for ( const { slug } of CONNECTORS ) {
await expect(
Expand Down Expand Up @@ -165,6 +191,11 @@ test.describe( 'Connectors', () => {
CONNECTORS_PAGE_QUERY
);

// AI plugin callout banner should be hidden when user lacks permissions.
await expect(
page.locator( '.ai-plugin-callout' )
).toBeHidden();

for ( const { slug } of CONNECTORS ) {
const card = page.locator( `.connector-item--${ slug }` );
await expect( card ).toBeVisible();
Expand Down
Loading