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(gatsby-source-wordpress): update test deps and fix int tests #35582

Merged
merged 2 commits into from
May 4, 2022

Conversation

TylerBarnes
Copy link
Contributor

@TylerBarnes TylerBarnes commented May 4, 2022

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
@@ -22,9 +22,6 @@ install-plugin wp-graphql-gutenberg pristas-peter/wp-graphql-gutenberg ${WPGRAPH
# CPTUI from Github release
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
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
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

@@ -897,17 +896,23 @@ Array [
"fields": null,
"name": "WpACF_GoogleMapFilterInput",
},
Object {
Copy link
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

WPGRAPHQL_VERSION=v1.8.0
WPGATSBY_VERSION=v2.3.2
WPGRAPHQL_ACF_VERSION=v0.5.3
CPT_UI_VERSION=1.11.2
ACF_VERSION=5.8.7
Copy link
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

@@ -1,6 +1,8 @@
#!/bin/bash
set -e

echo "define( 'GRAPHQL_DEBUG', true );" >> /var/www/html/wp-config.php
Copy link
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
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
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
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
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
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