Skip to content

Commit

Permalink
allow the graphql endpoint to be passed
Browse files Browse the repository at this point in the history
we can use this to fix the subdirectory test, too, but later
  • Loading branch information
jazzsequence committed Jul 31, 2024
1 parent 17d4860 commit 46aaa50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/tests/wpcm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { test, expect } from "@playwright/test";
const exampleArticle = "Hello world!";
const siteTitle = process.env.SITE_NAME || "WPCM Playwright Tests";
const siteUrl = process.env.SITE_URL || "https://dev-wpcm-playwright-tests.pantheonsite.io";
let graphqlEndpoint = process.env.GRAPHQL_ENDPOINT || `${siteUrl}/wp/graphql`;

test("homepage loads and contains example content", async ({ page }) => {
await page.goto(siteUrl);
Expand Down Expand Up @@ -41,8 +42,7 @@ test("validate core resource URLs", async ({ request }) => {
});

test("graphql is able to access hello world post", async ({ request }) => {
let graphqlEndpoint = `${siteUrl}/wp/graphql`;
let apiRoot = await request.get(`${siteUrl}/wp/graphql`);
let apiRoot = await request.get(graphqlEndpoint);
// If the above request doesn't resolve, it's because we're on a subsite where the path is ${siteUrl}/graphql -- similar to the rest api.
if (!apiRoot.ok()) {
graphqlEndpoint = `${siteUrl}/graphql`;
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@ jobs:
env:
SITE_NAME: ${{ env.SITE_NAME }}
SITE_URL: ${{ env.SITE_URL }}
GRAPHQL_ENDPOINT: ${{ env.SITE_URL }}/wp/graphql
run: npm run test .github/tests/wpcm.spec.ts
- name: Run Playwright tests on subdomain site
env:
SITE_NAME: Foo
SITE_URL: ${{ env.SUBDOMAIN_URL }}
GRAPHQL_ENDPOINT: ${{ env.SUBDOMAIN_URL }}/wp/graphql
run: npm run test .github/tests/wpcm.spec.ts

0 comments on commit 46aaa50

Please sign in to comment.