Skip to content

fix(gatsby-source-wordpress): update test deps and fix int tests - #35582

Merged
wardpeet merged 2 commits into
masterfrom
fix/wp-tests-2
May 4, 2022
Merged

wardpeet merged 2 commits into
masterfrom
fix/wp-tests-2

Conversation

@TylerBarnes

@TylerBarnes TylerBarnes commented May 4, 2022 •

Copy link
Copy Markdown
Contributor

Seems WP int tests are broken again. This PR fixes them by upgrading WP deps to latest and updating the snapshots and excluded fields based on the upgraded deps

@gatsbot gatsbot Bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 4, 2022
install-plugin custom-post-type-ui WebDevStudios/custom-post-type-ui ${CPT_UI_VERSION} && \

# WP GraphQL CPTUI from GitHub release
install-plugin wp-graphql-custom-post-type-ui wp-graphql/wp-graphql-custom-post-type-ui ${WPGRAPHQL_CPT_UI_VERSION} && \

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WPGraphQL has CPTUI support built in now

# Set timezone
RUN echo 'date.timezone = "UTC"' > /usr/local/etc/php/conf.d/timezone.ini
# install system deps
RUN apt-get update && apt-get install unzip git -y && rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

broke these out because one was failing, this way the error message is more helpful

"fields": null,
"name": "WpACF_GoogleMapFilterInput",
},
Object {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The huge diff in this file is from updating all WP test site deps

WPGATSBY_VERSION=v2.3.2
WPGRAPHQL_ACF_VERSION=v0.5.3
CPT_UI_VERSION=1.11.2
ACF_VERSION=5.8.7

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't update ACF because there's no oss mirror of the pro version with a version higher than this

#!/bin/bash
set -e

echo "define( 'GRAPHQL_DEBUG', true );" >> /var/www/html/wp-config.php

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put WPGraphQL in debugging mode so there are more helpful errors when tests fail

Comment on lines +19 to +35
Settings: {
excludeFieldNames: [`generalSettingsEmail`],
},
GeneralSettings: {
excludeFieldNames: [`email`],
},
WPGatsby: {
exclude: true,
},
PostTypeSEO: {
excludeFieldNames: [`twitterImage`],
},
BlockAttributesObject: {
exclude: true,
},
Post: { excludeFieldNames: [`pinged`] },
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On latest versions of plugins these fields cause GraphQL errors. This is normally fine because errors that return data are silenced in source-wordpress. I turned that off for tests (below) so we can see all errors. I also turned on the debugging option to panic on errors - this is so we can see very quickly when a gql error is happening and fail the test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the lines below 👇

writeQueriesToDisk: true,
},
},
excludeFieldNames: [`commentCount`, `generalSettingsEmail`],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment above ☝️

Comment on lines -539 to -542
twitterImage {
id
title
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

twitterImage seems to throw errors on latest WPGraphQL Yoast when you don't have an image set. Since we're panicking on errors I'm omitting this field

@TylerBarnes TylerBarnes added topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 4, 2022
@TylerBarnes
TylerBarnes requested review from veryspry and wardpeet May 4, 2022 01:45
@wardpeet
wardpeet merged commit 5e51519 into master May 4, 2022
@wardpeet
wardpeet deleted the fix/wp-tests-2 branch May 4, 2022 14:22
raffishquartan pushed a commit to raffishquartan/gatsby that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: source-wordpress Related to Gatsby's integration with WordPress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants