From 94ee15ba84d770f237ebb3d06fb8e38e046e5080 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Thu, 21 Mar 2024 13:01:17 -0400 Subject: [PATCH 1/8] per test status updates --- src/host/main.js | 66 ++++++++++++++++++++++++++++---------------- src/host/messages.js | 3 ++ 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/host/main.js b/src/host/main.js index d2fb166..fc2007c 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -68,6 +68,22 @@ export async function hostMain({ const callbackRequests = []; + const postCallback = body => { + // ignore if not in callback mode + if (!callbackUrl) return; + const headers = { + 'Content-Type': 'application/json', + ...(callbackHeader || {}), + }; + callbackRequests.push( + fetch(callbackUrl, { + method: 'post', + body: JSON.stringify(body), + headers, + }).then(logUnsuccessfulHTTP.bind(null, log)) + ); + }; + for (const test of plan.tests) { log(HostMessage.START_TEST); const testLogJob = startJob(async function (signal) { @@ -78,33 +94,35 @@ export async function hostMain({ }); const file = plan.files.find(({ name }) => name === test.filepath); - const result = await agent.run(JSON.parse(textDecoder.decode(file.bufferData))); - if (callbackUrl) { - const headers = { - 'Content-Type': 'application/json', - ...(callbackHeader || {}), - }; - const { testId, presentationNumber, capabilities, commands } = result; - const body = JSON.stringify({ - testCsvRow: testId, - presentationNumber, + const testSource = JSON.parse(textDecoder.decode(file.bufferData)); + + const { presentationNumber } = testSource; + const callbackBody = { + testCsvRow: testSource.task?.info?.testId, + presentationNumber, + }; + + let result, error; + try { + postCallback({ ...callbackBody, status: 'TEST_STARTED' }); + + result = await agent.run(testSource); + + const { capabilities, commands } = result; + postCallback({ + ...callbackBody, capabilities, responses: commands.map(({ output }) => output), - // a v2 of this API should allow the aria at app to parse the capabilities we are sending instead. - atVersionName: capabilities.atVersion, - browserVersionName: capabilities.browserVersion, }); - callbackRequests.push( - fetch(callbackUrl, { - method: 'post', - body, - headers, - }).then(logUnsuccessfulHTTP.bind(null, log)) - ); + + plan = addTestResultToTestPlan(plan, test.filepath, result); + } catch (exception) { + const error = `${exception.message ?? exception}`; + log(HostMessage.TEST_ERROR, { error }); + postCallback({ ...callbackBody, error }); + } finally { + await testLogJob.cancel(); } - plan = addTestResultToTestPlan(plan, test.filepath, result); - await Promise.allSettled(callbackRequests); - await testLogJob.cancel(); } server.removeFiles(serverDirectory); @@ -112,7 +130,7 @@ export async function hostMain({ log(HostMessage.STOP_AGENT); await agent.stop(); - + await Promise.allSettled(callbackRequests); await emitPlanResults(plan); } diff --git a/src/host/messages.js b/src/host/messages.js index 6dea921..cf81447 100644 --- a/src/host/messages.js +++ b/src/host/messages.js @@ -43,6 +43,8 @@ export const HostMessage = { START_TEST: 'startTest', /** @type {'reportingError'} */ REPORTING_ERROR: 'reportingError', + /** @type {'testError'} */ + TEST_ERROR: 'testError', }; export const HOST_TEMPLATES = { @@ -63,6 +65,7 @@ export const HOST_TEMPLATES = { [HostMessage.AGENT_LOG]: ({ text }) => `[Agent]: ${text}`, [HostMessage.AGENT_CRASHED]: () => `Agent crashed.`, [HostMessage.START_TEST]: () => `Starting test.`, + [HostMessage.TEST_ERROR]: ({ error }) => `Test Error ${error}`, [HostMessage.REPORTING_ERROR]: ({ status, body }) => `HTTP ${status} response received when reporting result: '${body}'.`, }; From 8b00f61c27d9c5d24d5c2ae11f4043e83ea58738 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Thu, 21 Mar 2024 18:03:48 -0400 Subject: [PATCH 2/8] snapshot diffs --- src/host/tests/snapshots/agent.js.md | 36 ++++++------- src/host/tests/snapshots/agent.js.snap | Bin 3626 -> 3622 bytes src/host/tests/snapshots/cli-run-plan.js.md | 50 +++++++++++++++--- src/host/tests/snapshots/cli-run-plan.js.snap | Bin 1273 -> 1314 bytes 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/host/tests/snapshots/agent.js.md b/src/host/tests/snapshots/agent.js.md index cfb461e..7dbaf93 100644 --- a/src/host/tests/snapshots/agent.js.md +++ b/src/host/tests/snapshots/agent.js.md @@ -92,7 +92,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -210,7 +210,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -278,7 +278,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -479,7 +479,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -506,7 +506,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -738,7 +738,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -765,7 +765,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -958,7 +958,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -985,7 +985,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -1300,7 +1300,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -1327,7 +1327,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) +> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) { capabilities: { @@ -1354,7 +1354,7 @@ Generated by [AVA](https://avajs.dev). testId: 2, } -> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1,2],"options":{"config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -1700,7 +1700,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -1727,7 +1727,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) +> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) { capabilities: { @@ -1754,7 +1754,7 @@ Generated by [AVA](https://avajs.dev). testId: 2, } -> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1,2],"options":{"protocol":"fork","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { @@ -2072,7 +2072,7 @@ Generated by [AVA](https://avajs.dev). }, ] -> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) +> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 1) { capabilities: { @@ -2099,7 +2099,7 @@ Generated by [AVA](https://avajs.dev). testId: 1, } -> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) +> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: controller.run(test 2) { capabilities: { @@ -2126,7 +2126,7 @@ Generated by [AVA](https://avajs.dev). testId: 2, } -> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log +> {"tests":[1,2],"options":{"protocol":"developer","config":{"referenceBaseUrl":{"protocol":"http:","hostname":"localhost","port":1234,"pathname":"/path"}}}}: log [ { diff --git a/src/host/tests/snapshots/agent.js.snap b/src/host/tests/snapshots/agent.js.snap index 81806d032c0d202802db646dfa7cd380eab44ccd..a9877760b607290c6c13fecd731ffc10a11fa0b5 100644 GIT binary patch literal 3622 zcmV+>4%zWRRzVg7^t3bhpL;B$sYWc9GwB;xW z2ng-&-EgO-*bS zYqj;6{TTM%+1qz!cK2=;9+D?Jd;I2|ciwq_U(fq{XZLT8C(}J!ayuW>^n{+&hAvKN z+d>Qbw3NO$ozk=EWKzpcPiOQ*I+dG|$faVLTz^{6?OXa-Z*NSGtqX)zrByNh`PzJe zdH9S1OMq@*iZ6JcuVrC28{6*lm5w?)I~CtJ#iuI14xev*;ba`$WqkVbhlh+qztN<6 z0*5Do)1~Hu-SIDIJ-W|t9!{DxDK9$RrzjC%iBAx1v54LYkv+hpqG;=I(Fyr(O!WDF z4Z-t`E~Bl0ap#J!6KDF(zvw>{HI+vOciXELRZ;z_PYGq(X-frtI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jH5SW8c!!j%edSo0&fw)*_avb-Z;W!Qy zISx##qc}VUoRlwN&V#}(1U@C|w>8>*3L?(}heXk~N;41U=X@tiebcK_1?EVP$e8Cl zxj=12zsZJQ3M2e5F0vQ+g=h{eX?x(G5IF@*ff-mMngR5gZs38hMF(yN?v|1-s=?7b2D~JSPLMvmDjD06Ky4Y{Nz3^{ zq9!t(Rmjbv?Ojx>?Pb2j@QeADNAsVy%n!f> zT?Tv%*iJ1^F`tLXLEtbD5tEd$Pcc_H$?e8=tKSaKbqy2a8FXqta9Ey-{skg`H|{~) j{#sKi+SO89Dte>k{F+nI$Gq$(kkkGjp3>@{qD27!YtsC{ diff --git a/src/host/tests/snapshots/cli-run-plan.js.md b/src/host/tests/snapshots/cli-run-plan.js.md index cd89c99..0149dba 100644 --- a/src/host/tests/snapshots/cli-run-plan.js.md +++ b/src/host/tests/snapshots/cli-run-plan.js.md @@ -114,12 +114,22 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + Callback Fetch Mocked: http://callback.url/ {␊ + method: 'post',␊ + body: '{"status":"TEST_STARTED"}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + Callback Fetch Mocked: http://callback.url/ {␊ + method: 'post',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -139,27 +149,39 @@ Generated by [AVA](https://avajs.dev). [Agent]: Starting...␊ Agent running with protocol 'fork'.␊ Starting test.␊ + HTTP 418 response received when reporting result: 'a body'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ - HTTP 418 response received when reporting result: 'a body'.␊ Starting test.␊ + HTTP 418 response received when reporting result: 'a body'.␊ + HTTP 418 response received when reporting result: 'a body'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ - HTTP 418 response received when reporting result: 'a body'.␊ Removing reference from 'http://localhost:8888/static␊ Stopping test agent.␊ + HTTP 418 response received when reporting result: 'a body'.␊ [Agent]: Stopping...␊ Stopping reference server.␊ Stopping...␊ `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"status":"TEST_STARTED"}',␊ + headers: { 'Content-Type': 'application/json', x: 'y' }␊ + }␊ + Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ + method: 'post',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + headers: { 'Content-Type': 'application/json', x: 'y' }␊ + }␊ + Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ + method: 'post',␊ + body: '{"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -179,10 +201,12 @@ Generated by [AVA](https://avajs.dev). [Agent]: Starting...␊ Agent running with protocol 'fork'.␊ Starting test.␊ + HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ Starting test.␊ + HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ @@ -194,12 +218,22 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"status":"TEST_STARTED"}',␊ + headers: { 'Content-Type': 'application/json', x: 'y' }␊ + }␊ + Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ + method: 'post',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + headers: { 'Content-Type': 'application/json', x: 'y' }␊ + }␊ + Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ + method: 'post',␊ + body: '{"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"],"atVersionName":"1.0","browserVersionName":"1.0"}',␊ + body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ diff --git a/src/host/tests/snapshots/cli-run-plan.js.snap b/src/host/tests/snapshots/cli-run-plan.js.snap index 94fa60a3db73142802f398734d73ef316ff2d28a..d11b4169c532a5c90625c60d68ff704eebc5503f 100644 GIT binary patch literal 1314 zcmV+-1>O2VRzV&w(E>_%g{XlAz;;wEgzbTK)_I>Nq4wdoh8nS zE;9;RrXw|ysF76c%rJ)Tq7Se)Xdh{hu}9d|eo~HW$4b(~iDPH<0T#)h5%Wo0F2JjfYKIpYhES^COY&KY-Mn2Q!+Y|vc#eQ8HvCj4mMw(a~j zX%j{wmmp5qAz>)+xgZgYA{rsf6C!p>B~Ta#9_7MWgO_FJw?JoPCDB1dJCTJtzVJ{L z3Bmgc2ITY&OI%>#yZK|q)kX;K zlStV4y>UwQkE$7VnzjZX)sh_Y&BSCM>#+)1P`*`8thy0qZaAfo(KbL zWWQQWA{2ub&e>{@PrsR6w@FCV>TKwD6_xY+P2>0sf2X6;-$O}uBA-4CNwJK~q=`7r z%+f1_e)T zfzluWBeJJjE|-ht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1u%3xmJ<#I$X?0M=D1xl8R1Eg*(?qH zzH2(QlIh|Ycl^K?KH<{J4x>^ni%N6<3a+uK`7pF0zo`VtnJdF6~+8FWvCNN^-USY)KZoKZ*eukpuvE)wR z#?N;WH}XBM!Q;Mz$AWR!2yzb*&(NTpSnwuK?WE6@AG7Oy8wT6AMl6n%*_NYkJr8ek1fgv~utrc;-za z;b-9aa3A&nX?YIP|DA{QZ1uWG|72Ao{gNU5cdgbg+Nf=!6S9B@m-v0yjsp)=GZNF( z)O7#L%U>bUy;;SbC?&{6r34w`5O~XmlezMB>zln+d9StA+TZ(1dPP?ji_+{6nvXA4 zLi|^b*A>M%G0>%hE**5~pi2i`I^0a@uzktWA(g=J0`WcmKwt8Pn=dOq!FgrHpVuxc zJY81YgR){jbv=T>!Y(eOBvLLEGjLJX6fpk+_4ihvL_PojueNLe From eda1c25da2003fac63dd6eefc6f0fb8a7a952549 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Thu, 21 Mar 2024 20:13:28 -0400 Subject: [PATCH 3/8] grab the presNumber/testId from the info --- src/host/main.js | 9 +++---- src/host/tests/snapshots/cli-run-plan.js.md | 24 +++++++++--------- src/host/tests/snapshots/cli-run-plan.js.snap | Bin 1314 -> 1343 bytes 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/host/main.js b/src/host/main.js index fc2007c..e371c66 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -96,19 +96,18 @@ export async function hostMain({ const file = plan.files.find(({ name }) => name === test.filepath); const testSource = JSON.parse(textDecoder.decode(file.bufferData)); - const { presentationNumber } = testSource; const callbackBody = { - testCsvRow: testSource.task?.info?.testId, - presentationNumber, + testCsvRow: testSource.info?.testId, + presentationNumber: testSource.info?.presentationNumber, }; - let result, error; try { postCallback({ ...callbackBody, status: 'TEST_STARTED' }); - result = await agent.run(testSource); + const result = await agent.run(testSource); const { capabilities, commands } = result; + postCallback({ ...callbackBody, capabilities, diff --git a/src/host/tests/snapshots/cli-run-plan.js.md b/src/host/tests/snapshots/cli-run-plan.js.md index 0149dba..923346d 100644 --- a/src/host/tests/snapshots/cli-run-plan.js.md +++ b/src/host/tests/snapshots/cli-run-plan.js.md @@ -114,22 +114,22 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -166,22 +166,22 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -218,22 +218,22 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ diff --git a/src/host/tests/snapshots/cli-run-plan.js.snap b/src/host/tests/snapshots/cli-run-plan.js.snap index d11b4169c532a5c90625c60d68ff704eebc5503f..6cd8b32962558b0c179ff05e6557f8b8e6f80069 100644 GIT binary patch literal 1343 zcmV-F1;F}2RzV<7q}^B;={00000000B+S=(;gHW;>&w(E>_%dkBFp^NIqmJiKEAYd5Mq{DWxCa|3q zU1k)tOh;-YQ6s6?S>TIpK<{?5H)!`5!(L*Ku}9d|eo~HW$I8)3Y-jWV7RjIFe+-khpi#3_A7V+QEK%ykj0)<~V5q{_YOqdSIY2H153=7H>|64qHtE@( z2m@y=4>ir`#!XYsobC6kP!BjbAI=e@v%%~U(4~AuDv0}gGREh+2PYK9lV>(BsIE>{Q z6g;&JN`nN9$ewDsTrQR?@M%=4PPq&p8@j#+iG&3(wcnQ;_5{dY$^bSeeY#W8OAfiHZ*rIsy5yWpeeslg#!382QH^E<-054JgG#V$iP7UN=AoRok| zL_l7LqjF%3OT!S(W2(%c0mD1nuhwg|trsv6{2wP`Fom>H+D5Pz8cLnCD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7R|2Rp==_;5?t^WPS+UE|jm5Ya7AGa(5)qKs z;iw!Ky=~F_=PHC~YHH3k{`CT9vsF>BevgflHKD zjKYCVVyPMCFiWt6oVnTYgnk3wg~@1F7bx1*`HXg9v-aZoMFKxM;rtvJUp^xpTIq?t zNJ6M7DkU2875Tz^sL|->M`1)Y14bNX!H9pSh7s>)0V7s#6^t0x#%W9YDGSYyCJO;K zeqBhok?nB}JZ?MixM18h1i6I}g5p%iSQ^$STX2s6`-d{TSw6DnbL*?Za%aAY^VNer@p>j zf3|7%m5>MN3wOMOddS+K5gZIrtix?$!Au;-f$yrDv?QycRZ!+j$E#UR2$!-S2gHG- zgJIOq_w!e&_>I&us5LQ-xZH8?EUeO400-*GUqj?a;l_0(f#xfkuV}ua`HJQ%GvO;; zD}%5Ag8MCzaIfR}P|w-`;`t3yr zF9IU3@9umfO_?2%??U&{M?v;!6rN`Ue@WOr8^`HL&lOi2@u4PVnv`i$rb(G5WwRk= z8y`u^QV9$Vi0{z{P$(ny_d_Rh3~&Ay`v+Z7SE-PC>r-i4!7L`kIV5Hz)W zEWq~7vYHuKr~P@g)-A+8fPYLwCLgKx)Ah~b)7s|Cg(DmnQ-7Z6$BhzAodt7}1)79v Y5~@k4CZU>yE)WU*528uBcvM0F04-#3djJ3c From db67ee28952f37bf372d2e2f93994ee9ff2e0fdd Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Wed, 3 Apr 2024 18:15:12 -0400 Subject: [PATCH 4/8] updates from review --- src/host/main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/host/main.js b/src/host/main.js index e371c66..0046c75 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -68,13 +68,14 @@ export async function hostMain({ const callbackRequests = []; - const postCallback = body => { + const postCallbackWhenEnabled = async body => { // ignore if not in callback mode if (!callbackUrl) return; const headers = { 'Content-Type': 'application/json', ...(callbackHeader || {}), }; + await Promise.allSettled(callbackRequests); callbackRequests.push( fetch(callbackUrl, { method: 'post', @@ -97,18 +98,18 @@ export async function hostMain({ const testSource = JSON.parse(textDecoder.decode(file.bufferData)); const callbackBody = { - testCsvRow: testSource.info?.testId, - presentationNumber: testSource.info?.presentationNumber, + testCsvRow: testSource.info.testId, + presentationNumber: testSource.info.presentationNumber, }; try { - postCallback({ ...callbackBody, status: 'TEST_STARTED' }); + postCallbackWhenEnabled({ ...callbackBody, status: 'TEST_STARTED' }); const result = await agent.run(testSource); const { capabilities, commands } = result; - postCallback({ + postCallbackWhenEnabled({ ...callbackBody, capabilities, responses: commands.map(({ output }) => output), @@ -118,7 +119,7 @@ export async function hostMain({ } catch (exception) { const error = `${exception.message ?? exception}`; log(HostMessage.TEST_ERROR, { error }); - postCallback({ ...callbackBody, error }); + postCallbackWhenEnabled({ ...callbackBody, error }); } finally { await testLogJob.cancel(); } From a9823e78d04891c6ec70bee40d3b9cc1e6404991 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Wed, 3 Apr 2024 18:15:57 -0400 Subject: [PATCH 5/8] update to per-test "RUNNING" or "ERROR" status --- src/host/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/host/main.js b/src/host/main.js index 0046c75..81fb4a0 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -103,7 +103,7 @@ export async function hostMain({ }; try { - postCallbackWhenEnabled({ ...callbackBody, status: 'TEST_STARTED' }); + postCallbackWhenEnabled({ ...callbackBody, status: 'RUNNING' }); const result = await agent.run(testSource); @@ -119,7 +119,7 @@ export async function hostMain({ } catch (exception) { const error = `${exception.message ?? exception}`; log(HostMessage.TEST_ERROR, { error }); - postCallbackWhenEnabled({ ...callbackBody, error }); + postCallbackWhenEnabled({ ...callbackBody, error, status: 'ERROR' }); } finally { await testLogJob.cancel(); } From 591ce4ce5a891e1621e9b5d53fb97fa4059b6cb4 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Wed, 3 Apr 2024 18:19:01 -0400 Subject: [PATCH 6/8] update snapshots --- src/host/tests/snapshots/cli-run-plan.js.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/host/tests/snapshots/cli-run-plan.js.md b/src/host/tests/snapshots/cli-run-plan.js.md index 923346d..8e07211 100644 --- a/src/host/tests/snapshots/cli-run-plan.js.md +++ b/src/host/tests/snapshots/cli-run-plan.js.md @@ -114,7 +114,7 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ @@ -124,7 +124,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ @@ -166,7 +166,7 @@ Generated by [AVA](https://avajs.dev). `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ @@ -176,7 +176,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ @@ -204,21 +204,21 @@ Generated by [AVA](https://avajs.dev). HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ - HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ Starting test.␊ HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ + HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ [Server]: Serving '/static/reference/index.html'.␊ [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ - HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ Removing reference from 'http://localhost:8888/static␊ Stopping test agent.␊ + HTTP 418 response received when reporting result: 'Unknown error - unable to read response body.'.␊ [Agent]: Stopping...␊ Stopping reference server.␊ Stopping...␊ `, stdout: `Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":1,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":1,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ @@ -228,7 +228,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":2,"status":"TEST_STARTED"}',␊ + body: '{"testCsvRow":2,"status":"RUNNING"}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ From 60d71978847bdb1e2509a885aede50470f430559 Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Wed, 10 Apr 2024 16:48:09 -0400 Subject: [PATCH 7/8] add in support for dynamic :testRowNumber in callback url --- src/host/main.js | 16 ++++-- src/host/tests/cli-run-plan.js | 15 ++++- src/host/tests/snapshots/cli-run-plan.js.md | 62 ++++++++++++++++++--- 3 files changed, 79 insertions(+), 14 deletions(-) diff --git a/src/host/main.js b/src/host/main.js index 81fb4a0..caf4142 100644 --- a/src/host/main.js +++ b/src/host/main.js @@ -66,18 +66,21 @@ export async function hostMain({ log(HostMessage.START_AGENT); await agent.start({ referenceBaseUrl: serverDirectory.baseUrl }); - const callbackRequests = []; + let lastCallbackRequest = Promise.resolve(); - const postCallbackWhenEnabled = async body => { + const postCallbackWhenEnabled = body => { // ignore if not in callback mode if (!callbackUrl) return; const headers = { 'Content-Type': 'application/json', ...(callbackHeader || {}), }; - await Promise.allSettled(callbackRequests); - callbackRequests.push( - fetch(callbackUrl, { + const perTestUrl = callbackUrl.replace( + ':testRowNumber', + body.testCsvRow ?? body.presentationNumber + ); + lastCallbackRequest = lastCallbackRequest.then(() => + fetch(perTestUrl, { method: 'post', body: JSON.stringify(body), headers, @@ -112,6 +115,7 @@ export async function hostMain({ postCallbackWhenEnabled({ ...callbackBody, capabilities, + status: 'COMPLETED', responses: commands.map(({ output }) => output), }); @@ -129,8 +133,8 @@ export async function hostMain({ log(HostMessage.REMOVE_SERVER_DIRECTORY, { url: serverDirectory.baseUrl }); log(HostMessage.STOP_AGENT); + await lastCallbackRequest; await agent.stop(); - await Promise.allSettled(callbackRequests); await emitPlanResults(plan); } diff --git a/src/host/tests/cli-run-plan.js b/src/host/tests/cli-run-plan.js index af9ed44..4bd09a1 100644 --- a/src/host/tests/cli-run-plan.js +++ b/src/host/tests/cli-run-plan.js @@ -39,7 +39,7 @@ test('plan3', async t => { ); }); -test('plan3 with callback', async t => { +test('plan3 with callback no url param', async t => { t.snapshot( await spawnRunPlan([ '--plan-workingdir=fixtures/host-bin/plan3', @@ -52,6 +52,19 @@ test('plan3 with callback', async t => { ); }); +test('plan3 with callback', async t => { + t.snapshot( + await spawnRunPlan([ + '--plan-workingdir=fixtures/host-bin/plan3', + '"**"', + '--agent-mock', + '--debug', + '--callback-url=http://callback.url/:testRowNumber', + '--callback-header=test:header:multiple:colon', + ]) + ); +}); + test('plan3 with callback request which fails', async t => { t.snapshot( await spawnRunPlan([ diff --git a/src/host/tests/snapshots/cli-run-plan.js.md b/src/host/tests/snapshots/cli-run-plan.js.md index 8e07211..86dccb8 100644 --- a/src/host/tests/snapshots/cli-run-plan.js.md +++ b/src/host/tests/snapshots/cli-run-plan.js.md @@ -88,7 +88,7 @@ Generated by [AVA](https://avajs.dev). `, } -## plan3 with callback +## plan3 with callback no url param > Snapshot 1 @@ -119,7 +119,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ Callback Fetch Mocked: http://callback.url/ {␊ @@ -129,7 +129,55 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://callback.url/ {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ + `, + } + +## plan3 with callback + +> Snapshot 1 + + { + stderr: `Starting...␊ + Reference server listening on 'http://localhost:8888'.␊ + Plan 'unknown' with 2 tests and 4 files read from source 'fork'.␊ + Reference available on 'http://localhost:8888/static␊ + Starting test agent.␊ + [Agent]: Starting...␊ + Agent running with protocol 'fork'.␊ + Starting test.␊ + [Server]: Serving '/static/reference/index.html'.␊ + [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ + Starting test.␊ + [Server]: Serving '/static/reference/index.html'.␊ + [Agent]: Open page: 'http://localhost:8888/static/reference/index.html'.␊ + Removing reference from 'http://localhost:8888/static␊ + Stopping test agent.␊ + [Agent]: Stopping...␊ + Stopping reference server.␊ + Stopping...␊ + `, + stdout: `Callback Fetch Mocked: http://callback.url/1 {␊ + method: 'post',␊ + body: '{"testCsvRow":1,"status":"RUNNING"}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + Callback Fetch Mocked: http://callback.url/1 {␊ + method: 'post',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW"]}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + Callback Fetch Mocked: http://callback.url/2 {␊ + method: 'post',␊ + body: '{"testCsvRow":2,"status":"RUNNING"}',␊ + headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ + }␊ + Callback Fetch Mocked: http://callback.url/2 {␊ + method: 'post',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', test: 'header:multiple:colon' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -171,7 +219,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ @@ -181,7 +229,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418 {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ @@ -223,7 +271,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW"]}',␊ + body: '{"testCsvRow":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ @@ -233,7 +281,7 @@ Generated by [AVA](https://avajs.dev). }␊ Callback Fetch Mocked: http://example.com/?TEST-STATUS=418&TEST-BAD-BODY {␊ method: 'post',␊ - body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ + body: '{"testCsvRow":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"status":"COMPLETED","responses":["mocked output for UP_ARROW,DOWN_ARROW"]}',␊ headers: { 'Content-Type': 'application/json', x: 'y' }␊ }␊ {"name":"unknown","tests":[{"filepath":"tests/test-1.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":1,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW","output":"mocked output for UP_ARROW"}],"results":[{"command":"UP_ARROW","expectation":"role up","pass":true,"output":"mocked output for role up"}]}]},{"filepath":"tests/test-2.json","log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}],"results":[{"testId":2,"capabilities":{"browserName":"mock","browserVersion":"1.0","atName":"mock","atVersion":"1.0","platformName":"mock"},"commands":[{"command":"UP_ARROW,DOWN_ARROW","output":"mocked output for UP_ARROW,DOWN_ARROW"}],"results":[{"command":"UP_ARROW,DOWN_ARROW","expectation":"role down","pass":true,"output":"mocked output for role down"}]}]}],"log":[{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."},{"data":{"type":"openPage","date":"2000-01-01T12:00:00.000Z","url":{}},"text":"Open page: 'http://localhost:8888/static/reference/index.html'."}]}␊ From 16a065022330d0793b66693b55acb8cce312a43f Mon Sep 17 00:00:00 2001 From: "Mx. Corey Frang" Date: Wed, 10 Apr 2024 16:50:42 -0400 Subject: [PATCH 8/8] missing snapshot update --- src/host/tests/snapshots/cli-run-plan.js.snap | Bin 1343 -> 1428 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/host/tests/snapshots/cli-run-plan.js.snap b/src/host/tests/snapshots/cli-run-plan.js.snap index 6cd8b32962558b0c179ff05e6557f8b8e6f80069..b1aa4128f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