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

[pull] master from gatsbyjs:master #533

Merged
merged 3 commits into from
Apr 26, 2021
Merged
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
10 changes: 9 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,16 @@ jobs:
<<: *test_template

integration_tests_gatsby_source_wordpress:
executor: node
machine: true
steps:
- run:
command: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run: nvm install v12
- run: nvm alias default v12
- run: nvm use v12
- run: npm i -g [email protected]
- e2e-test:
test_path: integration-tests/gatsby-source-wordpress

Expand Down
12 changes: 11 additions & 1 deletion integration-tests/gatsby-source-wordpress/.env.test
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
WPGRAPHQL_URL="https://gatsbyinttests.wpengine.com/graphql"
WPGRAPHQL_VERSION=v1.1.2
WPGATSBY_VERSION=v0.9.1
WPGRAPHQL_ACF_VERSION=v0.3.1
WPGRAPHQL_CPT_UI_VERSION=v1.1
CPT_UI_VERSION=1.8.1
ACF_VERSION=5.8.7

WPGRAPHQL_URL="http://localhost:8001/graphql"
HTACCESS_USERNAME="admin"
HTACCESS_PASSWORD="secret"
WORDPRESS_BASIC_AUTH=YWRtaW46c2VjcmV0
2 changes: 2 additions & 0 deletions integration-tests/gatsby-source-wordpress/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
WordPress
!docker/wordpress
.wordpress-cache
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,31 @@ exports[`[gatsby-source-wordpress] Run tests on develop build data resolution re
Array [
Object {
"id": "cG9zdDo3NzQ4",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/08/1002-4312x2868-1-scaled.jpg",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/08/1002-4312x2868-1-scaled.jpg",
},
Object {
"id": "cG9zdDo3NzQw",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/08/file-sample_1MB.doc",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/08/file-sample_1MB.doc",
},
Object {
"id": "cG9zdDo3NzU2",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/08/1001-5616x3744-1-scaled.jpg",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/08/1001-5616x3744-1-scaled.jpg",
},
Object {
"id": "cG9zdDo3NzUy",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/08/1003-1181x1772-1.jpg",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/08/1003-1181x1772-1.jpg",
},
Object {
"id": "cG9zdDoxMDQ0NQ==",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/10/sample.doc",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/10/sample.doc",
},
Object {
"id": "cG9zdDoxMDQzOQ==",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/10/sample.pdf",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/10/sample.pdf",
},
Object {
"id": "cG9zdDozNjI=",
"mediaItemUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/03/84-1000x1000-1.jpg",
"mediaItemUrl": "http://localhost:8001/wp-content/uploads/2020/03/84-1000x1000-1.jpg",
},
]
`;
Expand Down Expand Up @@ -197,7 +197,22 @@ Object {
},
"author": Object {
"node": Object {
"name": "Tyler",
"name": "admin",
},
},
"title": "Activity",
"uri": "/activity/",
"wpChildren": Object {
"nodes": Array [],
},
},
Object {
"acfPageFields": Object {
"fieldGroupName": "acfPageFields",
},
"author": Object {
"node": Object {
"name": "admin",
},
},
"title": "ACF Field Test",
Expand All @@ -222,7 +237,7 @@ Object {
"author": Object {
"node": Object {
"avatar": Object {
"url": "https://secure.gravatar.com/avatar/5fc9a2065017733c9d5f49a5ecd71d64?s=96&d=mm&r=g",
"url": "http://2.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=96&d=mm&r=g",
},
"comments": Object {
"nodes": Array [],
Expand All @@ -232,7 +247,7 @@ Object {
"featuredImage": Object {
"node": Object {
"altText": "",
"sourceUrl": "https://gatsbyinttests.wpengine.com/wp-content/uploads/2020/03/84-1000x1000-1.jpg",
"sourceUrl": "http://localhost:8001/wp-content/uploads/2020/03/84-1000x1000-1.jpg",
},
},
"title": "Hello world!",
Expand Down Expand Up @@ -261,7 +276,7 @@ Object {
"generalSettingsTimeFormat": "g:i a",
"generalSettingsTimezone": "",
"generalSettingsTitle": "Automated testing for Gatsby source WordPress V4",
"generalSettingsUrl": "https://gatsbyinttests.wpengine.com",
"generalSettingsUrl": "http://localhost:8001",
"readingSettingsPostsPerPage": 10,
"writingSettingsDefaultCategory": 23,
"writingSettingsDefaultPostFormat": "",
Expand All @@ -285,13 +300,16 @@ Object {
"allWpUser": Object {
"nodes": Array [
Object {
"databaseId": 1,
"name": "Tyler",
"databaseId": 4,
"name": "admin",
"pages": Object {
"nodes": Array [
Object {
"title": "ACF Field Test",
},
Object {
"title": "Activity",
},
],
},
"posts": Object {
Expand All @@ -305,7 +323,7 @@ Object {
],
},
"testUser": Object {
"firstName": "Tyler",
"name": "admin",
},
},
"extensions": Object {},
Expand Down
9 changes: 6 additions & 3 deletions integration-tests/gatsby-source-wordpress/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ require(`dotenv`).config({
path: `.env.test`,
})

const on = require(`wait-on`)
const urling = require(`urling`)

const {
spawnGatsbyProcess,
gatsbyCleanBeforeAll,
Expand All @@ -18,7 +19,9 @@ const isWarmCache = process.env.WARM_CACHE
const testOnColdCacheOnly = isWarmCache ? test.skip : test

describe(`[gatsby-source-wordpress] Build default options`, () => {
beforeAll(done => {
beforeAll(async done => {
await urling({ url: `http://localhost:8001/graphql`, retry: 15 })

if (isWarmCache) {
done()
} else {
Expand Down Expand Up @@ -51,7 +54,7 @@ describe(`[gatsby-source-wordpress] Run tests on develop build`, () => {

gatsbyDevelopProcess = spawnGatsbyProcess(`develop`)

await on({ resources: [`http://localhost:8000`] })
await urling(`http://localhost:8000`)
done()
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.8"
version: "3.2"

services:
db:
Expand All @@ -8,23 +8,18 @@ services:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: gtsb-wp-dckr-user
ports:
- "3306:3306"
restart: always
volumes:
- "db_data:/var/lib/mysql"
- "./docker/seed:/docker-entrypoint-initdb.d"

docker-host:
image: qoomon/docker-host
cap_add: ["NET_ADMIN", "NET_RAW"]
mem_limit: 8M
restart: on-failure

wordpress:
depends_on:
- db
env_file:
- ./test-site/.env.test
- ./test-site/.env.plugins
- ./.env.test
build:
context: ./docker/wordpress
ports:
Expand All @@ -43,12 +38,8 @@ services:
depends_on:
- db
- wordpress
# Specify versions for wp cli or composer here
environment:
CPT_UI_VERSION: 1.8.1
env_file:
- ./test-site/.env.test
- ./test-site/.env.plugins
- ./.env.test
build:
context: ./docker/wp-cli
volumes:
Expand Down
Loading