diff --git a/projects/plugins/jetpack/_inc/client/components/jetpack-notices/test/jetpack-connection-errors.test.jsx b/projects/plugins/jetpack/_inc/client/components/jetpack-notices/test/jetpack-connection-errors.test.jsx
index 268da4d0dfa7..5b55b332be4e 100644
--- a/projects/plugins/jetpack/_inc/client/components/jetpack-notices/test/jetpack-connection-errors.test.jsx
+++ b/projects/plugins/jetpack/_inc/client/components/jetpack-notices/test/jetpack-connection-errors.test.jsx
@@ -1,6 +1,12 @@
-import { render, screen } from '@testing-library/react';
+import { render, screen } from 'test/test-utils';
import JetpackConnectionErrors from '../jetpack-connection-errors';
+// The 'reconnect' action reaches a connected NoticeActionReconnect, which reads
+// the site reconnection request state.
+const initialState = {
+ jetpack: { connection: { requests: { reconnectingSite: false } } },
+};
+
describe( 'JetpackConnectionErrors', () => {
it( 'should render error with URL action', () => {
const errors = [
@@ -77,14 +83,14 @@ describe( 'JetpackConnectionErrors', () => {
},
];
- render( );
+ render( , { initialState } );
expect(
screen.getByText( 'The connection owner needs to reconnect their account.' )
).toBeInTheDocument();
- // No reconnect/restore CTA should be rendered for an informational notice.
- expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument();
- expect( screen.queryByText( 'Reconnect', { exact: false } ) ).not.toBeInTheDocument();
+ // Matched by label, not by role: NoticeAction renders an with no href, which
+ // has no implicit link role, so queryByRole( 'link' ) can never fail here.
+ expect( screen.queryByText( 'Restore Connection' ) ).not.toBeInTheDocument();
} );
it( 'should handle multiple errors correctly', () => {
@@ -105,10 +111,12 @@ describe( 'JetpackConnectionErrors', () => {
},
];
- render( );
+ render( , { initialState } );
expect( screen.getByText( 'First error' ) ).toBeInTheDocument();
expect( screen.getByText( 'Second error' ) ).toBeInTheDocument();
expect( screen.getByText( 'Fix Issue' ) ).toBeInTheDocument();
+ // Positive control for the 'none' case above: proves this query can see the CTA.
+ expect( screen.getByText( 'Restore Connection' ) ).toBeInTheDocument();
} );
} );
diff --git a/projects/plugins/jetpack/changelog/jetpack-2543-component-tests-in-ci b/projects/plugins/jetpack/changelog/jetpack-2543-component-tests-in-ci
new file mode 100644
index 000000000000..76861c7a5615
--- /dev/null
+++ b/projects/plugins/jetpack/changelog/jetpack-2543-component-tests-in-ci
@@ -0,0 +1,5 @@
+Significance: patch
+Type: other
+Comment: Test configuration only; no user-facing change.
+
+
diff --git a/projects/plugins/jetpack/tests/jest.config.gui.js b/projects/plugins/jetpack/tests/jest.config.gui.js
index 94b4c94a1042..282373d35e60 100644
--- a/projects/plugins/jetpack/tests/jest.config.gui.js
+++ b/projects/plugins/jetpack/tests/jest.config.gui.js
@@ -3,26 +3,20 @@ const baseConfig = require( './jest.config.base.js' );
module.exports = {
...baseConfig,
roots: [ '/_inc/client/' ],
- // Curated rather than a glob: `**/test/*.js` would also pick up the many
- // `test/fixtures.js` files (which contain no tests) and re-run the
+ // Matched by filename rather than a bare `**/test/*`: that would also pick up the
+ // many `test/fixtures.js` files (which contain no tests) and re-run the
// `_inc/client/state/` suites that jest.config.client.js already owns.
testMatch: [
'/_inc/client/test/main.js',
- '/_inc/client/**/test/component.js',
+ '/_inc/client/**/test/component.{js,jsx}',
+ '/_inc/client/**/test/*.test.{js,jsx}',
'/_inc/client/ai/test/ai-admin.jsx',
- '/_inc/client/ai/features/test/component.jsx',
'/_inc/client/ai/mcp/test/allowlist-updated.jsx',
'/_inc/client/ai/mcp/test/use-mcp-settings.jsx',
- '/_inc/client/ai/overview/assistant-banner/test/component.jsx',
- '/_inc/client/ai/overview/test/component.jsx',
'/_inc/client/ai/scheduled-tasks/test/index.jsx',
'/_inc/client/ai/scheduled-tasks/test/use-scheduled-tasks.js',
'/_inc/client/ai/test/main.jsx',
'/_inc/client/ai/test/tracks.js',
- '/_inc/client/at-a-glance/boost/test/component.jsx',
- '/_inc/client/components/jetpack-notices/test/state-notices.test.jsx',
- '/_inc/client/sharing/test/component.jsx',
- '/_inc/client/traffic/test/component.jsx',
'/_inc/client/at-a-glance/stats/test/chart-bar-range.js',
],
setupFilesAfterEnv: [ ...baseConfig.setupFilesAfterEnv, '/tests/jest-globals.gui.js' ],