-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for fetching test suite settings from graphql (#223)
* Add support for fetching test suite configuration from graphql * format gql * wrap fetching config in try/catch to avoid killing tests * add REPLAY_API_KEY to env before running flake tests * debug * less debug * standardize warning log
- replayio@1.6.1
- replayio@1.6.0
- replayio@1.5.2
- replayio@1.5.1
- replayio@1.5.0
- replayio@1.4.3
- replayio@1.4.2
- replayio@1.4.1
- replayio@1.4.0
- replayio@1.3.2
- replayio@1.3.1
- replayio@1.3.0
- replayio@1.2.0
- replayio@1.1.1
- replayio@1.1.0
- @replayio/test-utils@3.0.7
- @replayio/test-utils@3.0.6
- @replayio/test-utils@3.0.5
- @replayio/test-utils@3.0.4
- @replayio/test-utils@3.0.3
- @replayio/test-utils@3.0.2
- @replayio/test-utils@3.0.1
- @replayio/test-utils@3.0.0
- @replayio/test-utils@2.1.2
- @replayio/test-utils@2.1.1
- @replayio/test-utils@2.0.1
- @replayio/test-utils@2.0.0
- @replayio/test-utils@1.3.16
- @replayio/test-utils@1.3.15
- @replayio/test-utils@1.3.14
- @replayio/test-utils@1.3.13
- @replayio/test-utils@1.3.12
- @replayio/test-utils@1.3.11
- @replayio/test-utils@1.3.10
- @replayio/test-utils@1.3.9
- @replayio/test-utils@1.3.8
- @replayio/test-utils@1.3.7
- @replayio/test-utils@1.3.6
- @replayio/test-utils@1.3.5
- @replayio/test-utils@1.3.4
- @replayio/test-utils@1.3.3
- @replayio/test-utils@1.3.2
- @replayio/test-utils@1.3.1
- @replayio/test-utils@1.3.0
- @replayio/test-utils@1.2.3
- @replayio/test-utils@1.2.2
- @replayio/test-utils@1.2.1
- @replayio/test-utils@1.2.0
- @replayio/test-utils@1.1.10
- @replayio/test-utils@1.1.9
- @replayio/test-utils@1.1.8
- @replayio/test-utils@1.1.7
- @replayio/test-utils@1.1.6
- @replayio/test-utils@1.1.5
- @replayio/test-utils@1.1.4
- @replayio/test-utils@1.1.3
- @replayio/test-utils@1.1.2
- @replayio/test-utils@1.1.1
- @replayio/test-utils@1.1.0
- @replayio/sourcemap-upload-webpack-plugin@2.0.3
- @replayio/sourcemap-upload-webpack-plugin@2.0.2
- @replayio/sourcemap-upload-webpack-plugin@2.0.1
- @replayio/sourcemap-upload-webpack-plugin@2.0.0
- @replayio/sourcemap-upload-webpack-plugin@1.0.12
- @replayio/sourcemap-upload-webpack-plugin@1.0.11
- @replayio/sourcemap-upload@2.0.6
- @replayio/sourcemap-upload@2.0.5
- @replayio/sourcemap-upload@2.0.4
- @replayio/sourcemap-upload@2.0.3
- @replayio/sourcemap-upload@2.0.2
- @replayio/sourcemap-upload@2.0.0
- @replayio/sourcemap-upload@1.1.2
- @replayio/sourcemap-upload@1.1.1
- @replayio/replay@0.22.12
- @replayio/replay@0.22.11
- @replayio/replay@0.22.10
- @replayio/replay@0.22.9
- @replayio/replay@0.22.8
- @replayio/replay@0.22.7
- @replayio/replay@0.22.6
- @replayio/replay@0.22.5
- @replayio/replay@0.22.4
- @replayio/replay@0.22.3
- @replayio/replay@0.22.2
- @replayio/replay@0.22.1
- @replayio/replay@0.22.0
- @replayio/replay@0.21.4
- @replayio/replay@0.21.3
- @replayio/replay@0.21.2
- @replayio/replay@0.21.1
- @replayio/replay@0.21.0
- @replayio/replay@0.20.1
- @replayio/replay@0.20.0
- @replayio/replay@0.19.4
- @replayio/replay@0.19.3
- @replayio/replay@0.19.2
- @replayio/replay@0.19.1
- @replayio/replay@0.19.0
- @replayio/replay@0.18.0
- @replayio/replay@0.17.5
- @replayio/replay@0.17.4
- @replayio/replay@0.17.3
- @replayio/replay@0.17.2
- @replayio/replay@0.17.1
- @replayio/replay@0.17.0
- @replayio/replay@0.16.2
- @replayio/replay@0.16.1
- @replayio/replay@0.16.0
- @replayio/replay@0.15.0
- @replayio/replay@0.14.4
- @replayio/replay@0.14.3
- @replayio/replay@0.14.2
- @replayio/puppeteer@0.2.12
- @replayio/puppeteer@0.2.11
- @replayio/puppeteer@0.2.10
- @replayio/puppeteer@0.2.9
- @replayio/puppeteer@0.2.8
- @replayio/puppeteer@0.2.7
- @replayio/puppeteer@0.2.6
- @replayio/puppeteer@0.2.5
- @replayio/puppeteer@0.2.4
- @replayio/puppeteer@0.2.3
- @replayio/puppeteer@0.2.1
- @replayio/puppeteer@0.2.0
- @replayio/puppeteer@0.1.89
- @replayio/puppeteer@0.1.88
- @replayio/puppeteer@0.1.87
- @replayio/puppeteer@0.1.86
- @replayio/puppeteer@0.1.85
- @replayio/puppeteer@0.1.84
- @replayio/puppeteer@0.1.83
- @replayio/puppeteer@0.1.82
- @replayio/puppeteer@0.1.81
- @replayio/puppeteer@0.1.80
- @replayio/puppeteer@0.1.79
- @replayio/puppeteer@0.1.78
- @replayio/puppeteer@0.1.77
- @replayio/puppeteer@0.1.76
- @replayio/puppeteer@0.1.75
- @replayio/puppeteer@0.1.74
- @replayio/puppeteer@0.1.73
- @replayio/puppeteer@0.1.72
- @replayio/puppeteer@0.1.71
- @replayio/puppeteer@0.1.70
- @replayio/puppeteer@0.1.69
- @replayio/puppeteer@0.1.68
- @replayio/puppeteer@0.1.67
- @replayio/puppeteer@0.1.66
- @replayio/puppeteer@0.1.65
- @replayio/puppeteer@0.1.64
- @replayio/puppeteer@0.1.63
- @replayio/puppeteer@0.1.62
- @replayio/puppeteer@0.1.61
- @replayio/puppeteer@0.1.60
- @replayio/puppeteer@0.1.59
- @replayio/puppeteer@0.1.58
- @replayio/playwright@3.1.9
- @replayio/playwright@3.1.8
- @replayio/playwright@3.1.7
- @replayio/playwright@3.1.6
- @replayio/playwright@3.1.5
- @replayio/playwright@3.1.4
- @replayio/playwright@3.1.3
- @replayio/playwright@3.1.2
- @replayio/playwright@3.1.1
- @replayio/playwright@3.1.0
- @replayio/playwright@3.0.3
- @replayio/playwright@3.0.2
- @replayio/playwright@3.0.1
- @replayio/playwright@3.0.0
- @replayio/playwright@3.0.0-alpha.11
- @replayio/playwright@3.0.0-alpha.3
- @replayio/playwright@3.0.0-alpha.2
- @replayio/playwright@3.0.0-alpha.1
- @replayio/playwright@2.1.1
- @replayio/playwright@2.0.2
- @replayio/playwright@2.0.1
- @replayio/playwright@2.0.0
- @replayio/playwright@2.0.0-alpha.10
- @replayio/playwright@2.0.0-alpha.9
- @replayio/playwright@2.0.0-alpha.8
- @replayio/playwright@2.0.0-alpha.7
- @replayio/playwright@2.0.0-alpha.6
- @replayio/playwright@2.0.0-alpha.5
- @replayio/playwright@2.0.0-alpha.4
- @replayio/playwright@2.0.0-alpha.3
- @replayio/playwright@2.0.0-alpha.2
- @replayio/playwright@2.0.0-alpha.1
- @replayio/playwright@2.0.0-alpha.0
- @replayio/playwright@1.1.16
- @replayio/playwright@1.1.15
- @replayio/playwright@1.1.14
- @replayio/playwright@1.1.13
- @replayio/playwright@1.1.12
- @replayio/playwright@1.1.11
- @replayio/playwright@1.1.10
- @replayio/playwright@1.1.9
- @replayio/playwright@1.1.8
- @replayio/playwright@1.1.7
- @replayio/playwright@1.1.6
- @replayio/playwright@1.1.5
- @replayio/playwright@1.1.4
- @replayio/playwright@1.1.3
- @replayio/playwright@1.1.2
- @replayio/playwright@1.1.1
- @replayio/playwright@1.1.0
- @replayio/playwright@1.0.24
- @replayio/playwright@1.0.23
- @replayio/playwright@1.0.22
- @replayio/playwright@1.0.21
- @replayio/playwright@1.0.20
- @replayio/playwright@1.0.19
- @replayio/playwright@1.0.18
- @replayio/playwright@1.0.17
- @replayio/playwright@1.0.16
- @replayio/playwright@1.0.15
- @replayio/playwright@1.0.14
- @replayio/playwright@1.0.13
- @replayio/playwright@1.0.12
- @replayio/playwright@1.0.11
- @replayio/playwright@1.0.10
- @replayio/playwright@1.0.9
- @replayio/node@0.3.0
- @replayio/jest@27.2.43
- @replayio/jest@27.2.42
- @replayio/jest@27.2.41
- @replayio/jest@27.2.40
- @replayio/jest@27.2.39
- @replayio/jest@27.2.38
- @replayio/jest@27.2.37
- @replayio/jest@27.2.36
- @replayio/jest@27.2.35
- @replayio/jest@27.2.34
- @replayio/jest@27.2.33
- @replayio/jest@27.2.32
- @replayio/jest@27.2.31
- @replayio/jest@27.2.30
- @replayio/jest@27.2.29
- @replayio/jest@27.2.28
- @replayio/jest@27.2.27
- @replayio/jest@27.2.26
- @replayio/jest@27.2.25
- @replayio/jest@27.2.24
- @replayio/jest@27.2.23
- @replayio/jest@27.2.22
- @replayio/jest@27.2.21
- @replayio/jest@27.2.20
- @replayio/jest@27.2.19
- @replayio/jest@27.2.18
- @replayio/jest@27.2.17
- @replayio/jest@27.2.16
- @replayio/jest@27.2.15
- @replayio/jest@27.2.14
- @replayio/jest@27.2.13
- @replayio/jest@27.2.12
- @replayio/jest@0.3.10
- @replayio/jest@0.3.9
- @replayio/jest@0.3.8
- @replayio/jest@0.3.7
- @replayio/jest@0.3.6
- @replayio/jest@0.3.5
- @replayio/jest@0.3.4
- @replayio/jest@0.3.3
- @replayio/jest@0.3.2
- @replayio/jest@0.3.1
- @replayio/jest@0.3.0
- @replayio/cypress@3.1.3
- @replayio/cypress@3.1.2
- @replayio/cypress@3.1.1
- @replayio/cypress@3.1.0
- @replayio/cypress@3.0.7
- @replayio/cypress@3.0.6
- @replayio/cypress@3.0.5
- @replayio/cypress@3.0.4
- @replayio/cypress@3.0.3
- @replayio/cypress@3.0.2
- @replayio/cypress@3.0.1
- @replayio/cypress@3.0.0
- @replayio/cypress@2.1.3
- @replayio/cypress@2.1.2
- @replayio/cypress@2.1.1
- @replayio/cypress@2.0.1
- @replayio/cypress@2.0.0
- @replayio/cypress@1.7.20
- @replayio/cypress@1.7.19
- @replayio/cypress@1.7.18
- @replayio/cypress@1.7.17
- @replayio/cypress@1.7.16
- @replayio/cypress@1.7.15
- @replayio/cypress@1.7.14
- @replayio/cypress@1.7.13
- @replayio/cypress@1.7.12
- @replayio/cypress@1.7.11
- @replayio/cypress@1.7.10
- @replayio/cypress@1.7.9
- @replayio/cypress@1.7.8
- @replayio/cypress@1.7.7
- @replayio/cypress@1.7.6
- @replayio/cypress@1.7.5
- @replayio/cypress@1.7.4
- @replayio/cypress@1.7.3
- @replayio/cypress@1.7.2
- @replayio/cypress@1.7.1
- @replayio/cypress@1.7.0
- @replayio/cypress@1.6.2
- @replayio/cypress@1.6.1
- @replayio/cypress@1.6.0
- @replayio/cypress@1.5.0
- @replayio/cypress@1.4.1
- @replayio/cypress@1.4.0
- @replayio/cypress@1.3.5
- @replayio/cypress@1.3.4
- @replayio/cypress@1.3.3
- @replayio/cypress@1.3.2
- @replayio/cypress@1.3.1
- @replayio/cypress@1.3.0
- @replayio/cypress@1.2.1
- @replayio/cypress@1.2.0
- @replayio/cypress@1.1.6
- @replayio/cypress@1.1.5
- @replayio/cypress@1.1.4
- @replayio/cypress@1.1.3
- @replayio/cypress@1.1.2
- @replayio/cypress@1.1.1
- @replayio/cypress@1.1.0
1 parent
9155d6a
commit f16cc0d
Showing
9 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import fetch from "node-fetch"; | ||
import dbg from "debug"; | ||
import { warn } from "./logging"; | ||
|
||
const debug = dbg("replay:test-utils:config"); | ||
|
||
async function query(apiKey: string, name: string, query: string, variables = {}) { | ||
const options = { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
body: JSON.stringify({ | ||
query, | ||
name, | ||
variables, | ||
}), | ||
}; | ||
|
||
const server = process.env.REPLAY_API_SERVER || "https://api.replay.io"; | ||
debug("Querying %s graphql endpoint", server); | ||
const result = await fetch(`${server}/v1/graphql`, options); | ||
|
||
return await result.json(); | ||
} | ||
|
||
async function fetchWorkspaceConfig(apiKey: string) { | ||
try { | ||
const json = await query( | ||
apiKey, | ||
"GetWorkspaceConfig", | ||
` | ||
query GetWorkspaceConfig { | ||
auth { | ||
workspaces { | ||
edges { | ||
node { | ||
id | ||
settings { | ||
features | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}` | ||
); | ||
|
||
if (json.errors) { | ||
debug("GraphQL failed: %s", json.errors); | ||
throw new Error(json.errors[0].message || "Unexpected error"); | ||
} | ||
|
||
const edges = json.data?.auth.workspaces.edges; | ||
if (!edges || edges.length !== 1) { | ||
debug("Failed to find workspace: %o", json.data); | ||
throw new Error("Failed to find a workspace for the given apiKey"); | ||
} | ||
|
||
debug("Workspace settings: %o", edges[0].node.settings); | ||
const features = edges[0].node.settings.features; | ||
|
||
return { | ||
env: features?.testSuites?.env || {}, | ||
}; | ||
} catch (e) { | ||
warn("Failed to fetch test suite configuration; continuing with defaults", e); | ||
|
||
return { | ||
env: {}, | ||
}; | ||
} | ||
} | ||
|
||
export { fetchWorkspaceConfig }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function warn(message: string, e: unknown) { | ||
console.warn("[replay.io]:", message); | ||
if (e instanceof Error) { | ||
console.warn("[replay.io]: Error:", e.message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters