Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created April 25, 2022 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/8f1ff65479c642c87300459491dce8b8 to your computer and use it in GitHub Desktop.
Save jasonLaster/8f1ff65479c642c87300459491dce8b8 to your computer and use it in GitHub Desktop.
diff --git a/src/ui/setup/helpers.ts b/src/ui/setup/helpers.ts
index ece03f86c..3167a0224 100644
--- a/src/ui/setup/helpers.ts
+++ b/src/ui/setup/helpers.ts
@@ -51,6 +51,7 @@ export async function setupAppHelper(store: UIStore) {
prefs,
features,
asyncStore,
+ protocolVersion,
triggerEvent,
replaySession,
sendMessage: (cmd, args = {}, pauseId) =>
diff --git a/test/src/runTest.js b/test/src/runTest.js
index 81f1d24cb..c299bfe3a 100644
--- a/test/src/runTest.js
+++ b/test/src/runTest.js
@@ -32,6 +32,7 @@ async function recordBrowser(state, test, testPath, browserName, saveFixture) {
ws.on("framereceived", frameData => websocketLogs.push(JSON.parse(frameData.payload)));
});
+ let protocolVersion;
const result = await waitUntilMessage(page, "TestFinished", state.testTimeout * 1000);
success = result.success;
@@ -46,6 +47,12 @@ async function recordBrowser(state, test, testPath, browserName, saveFixture) {
await browser.close();
}
+ console.log(protocolVersion);
+ const recordingId = cachedTests[test];
+ const cachedFixture = await fetchFixture(recordingId);
+ if (previousProtocolVersion != protocolVersion) {
+ }
+
if (state.updateFixtures && saveFixture) {
fs.writeFileSync(
`./public/test/fixtures/${test.substr(0, test.length - 3)}.json`,
diff --git a/test/src/utils.js b/test/src/utils.js
index 9e978e1d1..56c3ddeda 100644
--- a/test/src/utils.js
+++ b/test/src/utils.js
@@ -2,11 +2,27 @@
const os = require("os");
const https = require("https");
+const { fstat } = require("fs");
function tmpFile() {
return os.tmpdir() + "/" + ((Math.random() * 1e9) | 0);
}
+type Fixture = {
+ version: string,
+ messages: string[],
+};
+async function fetchFixtures(recordingId, test): Fixture {
+ const messages = await client.Network.getWebsocketMessages(recordingId, sessionId);
+ const version = await client.Debugger.evaluateExpression(
+ recordingId,
+ sessionId,
+ "window.app.protocolVersion"
+ );
+
+ fs.writeFileSync(`./test/fixtures/${test}.json`, JSON.stringify({ version, messages }));
+}
+
async function waitUntilMessage(page, message, timeout = 30_000) {
return await new Promise((resolve, reject) => {
setTimeout(reject, timeout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment