Skip to content

Commit

Permalink
format integration-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Jul 31, 2023
1 parent 93a07d9 commit ec805aa
Show file tree
Hide file tree
Showing 52 changed files with 458 additions and 482 deletions.
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# Ignore all mdx & md files:
*.mdx
*.md

*.har
*.snap

node_modules/
.yalc/
Expand All @@ -24,7 +25,6 @@ node_modules/
/config
config/*
!config/processInvariants.ts
/integration-tests

/src/__tests__/ApolloClient.ts
/src/__tests__/__snapshots__/ApolloClient.ts.snap
Expand Down
80 changes: 42 additions & 38 deletions integration-tests/browser-esm/html/jsdeliver-esm.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head></head>
<script type="module">
// give playwright time to load
await new Promise((r) => setTimeout(r, 100));

<head></head>
<script type="module">
// give playwright time to load
await new Promise(r => setTimeout(r, 100))

import { ApolloClient, InMemoryCache, gql } from "https://cdn.jsdelivr.net/npm/@apollo/client@0.0.0-pr-10915-20230616125401/+esm";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client.query({
query: gql`
query {
products {
id
title
}
}
`})
.then(r => {
const main = document.querySelector('main')
const ul = document.createElement('ul')
main.replaceChildren(ul)
r.data.products.forEach(p => {
const li = document.createElement('li')
li.textContent = p.title
ul.appendChild(li)
import {
ApolloClient,
InMemoryCache,
gql,
} from "https://cdn.jsdelivr.net/npm/@apollo/client@0.0.0-pr-10915-20230616125401/+esm";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client
.query({
query: gql`
query {
products {
id
title
}
}
`,
})
})
.catch(console.error)
</script>

<body>
<h1>https://cdn.jsdelivr.net/npm/@apollo/client/+esm</h1>
<main>
<p>loading</p>
</main>
</body>
.then((r) => {
const main = document.querySelector("main");
const ul = document.createElement("ul");
main.replaceChildren(ul);
r.data.products.forEach((p) => {
const li = document.createElement("li");
li.textContent = p.title;
ul.appendChild(li);
});
})
.catch(console.error);
</script>

<body>
<h1>https://cdn.jsdelivr.net/npm/@apollo/client/+esm</h1>
<main>
<p>loading</p>
</main>
</body>
</html>
118 changes: 59 additions & 59 deletions integration-tests/browser-esm/html/jspm-prepared.html
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
<!DOCTYPE html>
<!doctype html>
<html>

<head></head>
<script type="importmap">
{
"imports": {
"@apollo/client": "https://ga.jspm.io/npm:@apollo/client@0.0.0-pr-10915-20230616125401/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@wry/context": "https://ga.jspm.io/npm:@wry/context@0.7.3/lib/index.js",
"@wry/equality": "https://ga.jspm.io/npm:@wry/equality@0.5.6/lib/index.js",
"@wry/trie": "https://ga.jspm.io/npm:@wry/trie@0.4.3/lib/index.js",
"graphql": "https://ga.jspm.io/npm:graphql@16.6.0/index.mjs",
"graphql-tag": "https://ga.jspm.io/npm:graphql-tag@2.12.6/lib/index.js",
"optimism": "https://ga.jspm.io/npm:optimism@0.17.5/lib/index.js",
"react": "https://ga.jspm.io/npm:react@18.2.0/dev.index.js",
"symbol-observable": "https://ga.jspm.io/npm:symbol-observable@4.0.0/lib/index.js",
"ts-invariant": "https://ga.jspm.io/npm:ts-invariant@0.10.3/lib/invariant.js",
"ts-invariant/process/index.js": "https://ga.jspm.io/npm:ts-invariant@0.10.3/process/index.js",
"tslib": "https://ga.jspm.io/npm:tslib@2.5.3/tslib.es6.mjs",
"zen-observable-ts": "https://ga.jspm.io/npm:zen-observable-ts@1.2.5/module.js"
<head></head>
<script type="importmap">
{
"imports": {
"@apollo/client": "https://ga.jspm.io/npm:@apollo/client@0.0.0-pr-10915-20230616125401/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@wry/context": "https://ga.jspm.io/npm:@wry/context@0.7.3/lib/index.js",
"@wry/equality": "https://ga.jspm.io/npm:@wry/equality@0.5.6/lib/index.js",
"@wry/trie": "https://ga.jspm.io/npm:@wry/trie@0.4.3/lib/index.js",
"graphql": "https://ga.jspm.io/npm:graphql@16.6.0/index.mjs",
"graphql-tag": "https://ga.jspm.io/npm:graphql-tag@2.12.6/lib/index.js",
"optimism": "https://ga.jspm.io/npm:optimism@0.17.5/lib/index.js",
"react": "https://ga.jspm.io/npm:react@18.2.0/dev.index.js",
"symbol-observable": "https://ga.jspm.io/npm:symbol-observable@4.0.0/lib/index.js",
"ts-invariant": "https://ga.jspm.io/npm:ts-invariant@0.10.3/lib/invariant.js",
"ts-invariant/process/index.js": "https://ga.jspm.io/npm:ts-invariant@0.10.3/process/index.js",
"tslib": "https://ga.jspm.io/npm:tslib@2.5.3/tslib.es6.mjs",
"zen-observable-ts": "https://ga.jspm.io/npm:zen-observable-ts@1.2.5/module.js"
}
}
}
}
</script>
<script type="module">
// give playwright time to load
await new Promise(r => setTimeout(r, 100))
</script>
<script type="module">
// give playwright time to load
await new Promise((r) => setTimeout(r, 100));

import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client.query({
query: gql`
query {
products {
id
title
}
}
`})
.then(r => {
const main = document.querySelector('main')
const ul = document.createElement('ul')
main.replaceChildren(ul)
r.data.products.forEach(p => {
const li = document.createElement('li')
li.textContent = p.title
ul.appendChild(li)
import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client
.query({
query: gql`
query {
products {
id
title
}
}
`,
})
})
.catch(console.error)
</script>

<body>
<h1>https://ga.jspm.io/npm:@apollo/client/index.js</h1>
<main>
<p>loading</p>
</main>
</body>
.then((r) => {
const main = document.querySelector("main");
const ul = document.createElement("ul");
main.replaceChildren(ul);
r.data.products.forEach((p) => {
const li = document.createElement("li");
li.textContent = p.title;
ul.appendChild(li);
});
})
.catch(console.error);
</script>

<body>
<h1>https://ga.jspm.io/npm:@apollo/client/index.js</h1>
<main>
<p>loading</p>
</main>
</body>
</html>
112 changes: 56 additions & 56 deletions integration-tests/browser-esm/html/unpkg-unmangled.html
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
<!DOCTYPE html>
<!doctype html>
<html>

<head></head>
<script type="importmap">
{
"imports": {
"@apollo/client": "https://unpkg.com/@apollo/client@0.0.0-pr-10915-20230616125401/index.js",
"@wry/context": "https://unpkg.com/@wry/context@0.7.3/lib/index.js",
"@wry/equality": "https://unpkg.com/@wry/equality@0.5.6/lib/index.js",
"@wry/trie": "https://unpkg.com/@wry/trie@0.4.3/lib/index.js",
"graphql": "https://unpkg.com/graphql@16.6.0/index.mjs",
"graphql-tag": "https://unpkg.com/graphql-tag@2.12.6/lib/index.js",
"optimism": "https://unpkg.com/optimism@0.17.5/lib/index.js",
"react": "https://ga.jspm.io/npm:react@18.2.0/dev.index.js",
"symbol-observable": "https://ga.jspm.io/npm:symbol-observable@4.0.0/lib/index.js",
"ts-invariant": "https://unpkg.com/ts-invariant@0.10.3/lib/invariant.js",
"ts-invariant/process/index.js": "https://unpkg.com/ts-invariant@0.10.3/process/index.js",
"tslib": "https://unpkg.com/tslib@2.5.3/tslib.es6.mjs",
"zen-observable-ts": "https://unpkg.com/zen-observable-ts@1.2.5/module.js"
}
}
</script>
<script type="module">
// give playwright time to load
await new Promise(r => setTimeout(r, 100))

import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client.query({
query: gql`
query {
products {
id
title
<head></head>
<script type="importmap">
{
"imports": {
"@apollo/client": "https://unpkg.com/@apollo/client@0.0.0-pr-10915-20230616125401/index.js",
"@wry/context": "https://unpkg.com/@wry/context@0.7.3/lib/index.js",
"@wry/equality": "https://unpkg.com/@wry/equality@0.5.6/lib/index.js",
"@wry/trie": "https://unpkg.com/@wry/trie@0.4.3/lib/index.js",
"graphql": "https://unpkg.com/graphql@16.6.0/index.mjs",
"graphql-tag": "https://unpkg.com/graphql-tag@2.12.6/lib/index.js",
"optimism": "https://unpkg.com/optimism@0.17.5/lib/index.js",
"react": "https://ga.jspm.io/npm:react@18.2.0/dev.index.js",
"symbol-observable": "https://ga.jspm.io/npm:symbol-observable@4.0.0/lib/index.js",
"ts-invariant": "https://unpkg.com/ts-invariant@0.10.3/lib/invariant.js",
"ts-invariant/process/index.js": "https://unpkg.com/ts-invariant@0.10.3/process/index.js",
"tslib": "https://unpkg.com/tslib@2.5.3/tslib.es6.mjs",
"zen-observable-ts": "https://unpkg.com/zen-observable-ts@1.2.5/module.js"
}
}
`})
.then(r => {
const main = document.querySelector('main')
const ul = document.createElement('ul')
main.replaceChildren(ul)
r.data.products.forEach(p => {
const li = document.createElement('li')
li.textContent = p.title
ul.appendChild(li)
})
})
.catch(console.error)
</script>
</script>
<script type="module">
// give playwright time to load
await new Promise((r) => setTimeout(r, 100));

<body>
<h1>https://unpkg.com/@apollo/client/index.js</h1>
<main>
<p>loading</p>
</main>
</body>
import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const client = new ApolloClient({
uri: "https://main--hack-the-e-commerce.apollographos.net/graphql",
cache: new InMemoryCache(),
});
client
.query({
query: gql`
query {
products {
id
title
}
}
`,
})
.then((r) => {
const main = document.querySelector("main");
const ul = document.createElement("ul");
main.replaceChildren(ul);
r.data.products.forEach((p) => {
const li = document.createElement("li");
li.textContent = p.title;
ul.appendChild(li);
});
})
.catch(console.error);
</script>

<body>
<h1>https://unpkg.com/@apollo/client/index.js</h1>
<main>
<p>loading</p>
</main>
</body>
</html>
4 changes: 2 additions & 2 deletions integration-tests/browser-esm/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { baseConfig } from 'shared/playwright.config';
import { defineConfig } from '@playwright/test';
import { baseConfig } from "shared/playwright.config";
import { defineConfig } from "@playwright/test";

export default defineConfig(baseConfig);
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect } from '@playwright/test';
import { test } from 'shared/fixture';
import { expect } from "@playwright/test";
import { test } from "shared/fixture";

test('Basic Test', async ({ page, withHar }) => {
await page.goto('http://localhost:3000/jsdeliver-esm.html');
test("Basic Test", async ({ page, withHar }) => {
await page.goto("http://localhost:3000/jsdeliver-esm.html");

await expect(page.getByText('loading')).toBeVisible();
await expect(page.getByText('loading')).not.toBeVisible({ timeout: 10000 });
await expect(page.getByText('Soft Warm Apollo Beanie')).toBeVisible();
await expect(page.getByText("loading")).toBeVisible();
await expect(page.getByText("loading")).not.toBeVisible({ timeout: 10000 });
await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible();
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect } from '@playwright/test';
import { test } from 'shared/fixture';
import { expect } from "@playwright/test";
import { test } from "shared/fixture";

test('Basic Test', async ({ page, withHar }) => {
await page.goto('http://localhost:3000/jspm-prepared.html');
test("Basic Test", async ({ page, withHar }) => {
await page.goto("http://localhost:3000/jspm-prepared.html");

await expect(page.getByText('loading')).toBeVisible();
await expect(page.getByText('loading')).not.toBeVisible({ timeout: 10000 });
await expect(page.getByText('Soft Warm Apollo Beanie')).toBeVisible();
await expect(page.getByText("loading")).toBeVisible();
await expect(page.getByText("loading")).not.toBeVisible({ timeout: 10000 });
await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible();
});
Loading

0 comments on commit ec805aa

Please sign in to comment.