Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests. #10113

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe( 'useDisplayCTAWidget hook', () => {
} );

it( 'should return false if the Analytics data is not available on load', async () => {
registry
await registry
.dispatch( MODULES_ANALYTICS_4 )
.receiveIsDataAvailableOnLoad( false );

Expand All @@ -115,6 +115,7 @@ describe( 'useDisplayCTAWidget hook', () => {
);

await waitForRegistry();

expect( result.current ).toBe( false );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe( 'AdBlockingRecoverySetupCTAWidget', () => {
}
);

it( 'should render the widget for the existing site without the setup completion time', () => {
it( 'should render the widget for the existing site without the setup completion time', async () => {
registry
.dispatch( MODULES_ADSENSE )
.receiveGetSettings( validSettings );
Expand All @@ -263,7 +263,7 @@ describe( 'AdBlockingRecoverySetupCTAWidget', () => {
.dispatch( MODULES_ADSENSE )
.receiveGetExistingAdBlockingRecoveryTag( null );

const { container } = render(
const { container, waitForRegistry } = render(
<AdBlockingRecoverySetupCTAWidget
Widget={ Widget }
WidgetNull={ WidgetNull }
Expand All @@ -273,6 +273,9 @@ describe( 'AdBlockingRecoverySetupCTAWidget', () => {
viewContext: VIEW_CONTEXT_MAIN_DASHBOARD,
}
);

await waitForRegistry();

expect( container ).toHaveTextContent(
'Recover revenue lost to ad blockers'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,13 @@ describe( 'AdBlockingRecoverySetupCTANotice', () => {
adBlockingRecoverySetupStatus: '',
} );

const { getByRole } = render( <AdBlockingRecoverySetupCTANotice />, {
registry,
viewContext: VIEW_CONTEXT_SETTINGS,
} );
const { waitForRegistry, getByRole } = render(
<AdBlockingRecoverySetupCTANotice />,
{
registry,
viewContext: VIEW_CONTEXT_SETTINGS,
}
);
// eslint-disable-next-line require-await
await act( async () => {
fireEvent.click( getByRole( 'link', { name: /Learn more/i } ) );
Expand All @@ -221,6 +224,8 @@ describe( 'AdBlockingRecoverySetupCTANotice', () => {
'settings_adsense-abr-cta-widget',
'click_learn_more_link'
);

await waitForRegistry();
} );

it( 'should trigger a survey when rendered', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ describe( 'AudienceTile', () => {
);

// Allow the `trackEvent()` promise to resolve so the custom dimension creation logic can be executed.
await waitForDefaultTimeouts();
await waitForTimeouts( 10 );
} );
} );

Expand Down