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

Attempt at fixing api-cache and write-scope-requests e2e tests. #9804

Open
wants to merge 8 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
5 changes: 5 additions & 0 deletions tests/e2e/specs/api-cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { visitAdminPage } from '@wordpress/e2e-test-utils';
* Internal dependencies
*/
import {
pageWait,
resetSiteKit,
safeLoginUser,
setupSiteKit,
Expand Down Expand Up @@ -81,6 +82,8 @@ describe( 'API cache', () => {

await goToSiteKitDashboard();

await pageWait();

await page.waitForSelector(
`#${ firstTestNotification.id }.googlesitekit-publisher-win--is-open`,
{ timeout: 10_000 } // Core site notifications are delayed 5s for surveys.
Expand All @@ -107,6 +110,8 @@ describe( 'API cache', () => {

await goToSiteKitDashboard();

await pageWait();

// Ensure the second notification is displayed.
await page.waitForSelector(
`#${ secondTestNotification.id }.googlesitekit-publisher-win--is-open`,
Expand Down
15 changes: 6 additions & 9 deletions tests/e2e/specs/modules/analytics/write-scope-requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ describe( 'Analytics write scope requests', () => {
}
} else if (
request.url().match( 'analytics-4/data/conversion-events' ) ||
request.url().match( 'search-console/data/searchanalytics' )
request.url().match( 'search-console/data/searchanalytics' ) ||
request
.url()
.match( 'analytics-4/data/sync-custom-dimensions' ) ||
request.url().match( 'user/data/survey-timeout' )
) {
request.respond( {
status: 200,
Expand Down Expand Up @@ -185,13 +189,6 @@ describe( 'Analytics write scope requests', () => {
request.respond( {
body: JSON.stringify( property ),
} );
} else if (
request.url().match( 'analytics-4/data/sync-custom-dimensions' )
) {
request.respond( {
status: 200,
body: '[]',
} );
} else if (
// Intercept request to GA TOS URL and redirect to gatoscallback.
request
Expand Down Expand Up @@ -425,7 +422,7 @@ describe( 'Analytics write scope requests', () => {

// They should end up on the dashboard.
await page.waitForNavigation();
await page.waitForTimeout( 5000 );
await page.waitForTimeout( 2000 );
await expect( page ).toMatchElement(
'.googlesitekit-publisher-win__title',
{
Expand Down
Loading