Skip to content

Commit d4aa6c2

Browse files
gzioloclaude
andcommitted
E2E Tests: Add coverage for AI plugin callout banner on Connectors page
Follow-up to #76379. Adds E2E test assertions for the AI Experiments plugin callout banner: - New test verifying the banner displays with install button and learn more link when the AI plugin is not installed. - Empty state test now verifies the banner is hidden when no connectors are registered. - Capability restriction tests now verify the banner is hidden when the user lacks install/activate permissions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8547632 commit d4aa6c2

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

test/e2e/specs/admin/connectors.spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,29 @@ test.describe( 'Connectors', () => {
7474
).toHaveAttribute( 'href', 'plugin-install.php' );
7575
} );
7676

77+
test( 'should display the AI plugin callout banner with install button', async ( {
78+
page,
79+
admin,
80+
} ) => {
81+
await admin.visitAdminPage( SETTINGS_PAGE_PATH, CONNECTORS_PAGE_QUERY );
82+
83+
const banner = page.locator( '.ai-plugin-callout' );
84+
await expect( banner ).toBeVisible();
85+
86+
// Verify the banner message mentions the AI plugin.
87+
await expect( banner.getByText( 'AI plugin' ) ).toBeVisible();
88+
89+
// Verify the Install button is present.
90+
await expect(
91+
banner.getByRole( 'button', { name: 'Install AI Experiments' } )
92+
).toBeVisible();
93+
94+
// Verify the Learn more link is present.
95+
await expect(
96+
banner.getByRole( 'link', { name: 'Learn more' } )
97+
).toBeVisible();
98+
} );
99+
77100
test.describe( 'Empty state', () => {
78101
const PLUGIN_SLUG = 'gutenberg-test-connectors-empty-state';
79102

@@ -116,6 +139,9 @@ test.describe( 'Connectors', () => {
116139
'plugin-install.php'
117140
);
118141

142+
// Verify the AI plugin callout banner is not shown.
143+
await expect( page.locator( '.ai-plugin-callout' ) ).toBeHidden();
144+
119145
// Verify none of the default connector cards are shown.
120146
for ( const { slug } of CONNECTORS ) {
121147
await expect(
@@ -165,6 +191,11 @@ test.describe( 'Connectors', () => {
165191
CONNECTORS_PAGE_QUERY
166192
);
167193

194+
// AI plugin callout banner should be hidden when user lacks permissions.
195+
await expect(
196+
page.locator( '.ai-plugin-callout' )
197+
).toBeHidden();
198+
168199
for ( const { slug } of CONNECTORS ) {
169200
const card = page.locator( `.connector-item--${ slug }` );
170201
await expect( card ).toBeVisible();

0 commit comments

Comments
 (0)