From d63609dbb1fa9ac06dc1bc7852b9e9c6c521d778 Mon Sep 17 00:00:00 2001 From: Stalgia Grigg Date: Wed, 13 Dec 2023 16:16:26 -0800 Subject: [PATCH] Fixes after merge --- .../common/BasicThemedModal/index.jsx | 18 +++-- server/controllers/AutomationController.js | 2 +- .../models/services/CollectionJobService.js | 2 +- .../Test/renderableContentsResolver.js | 6 +- server/resolvers/Test/renderedUrlsResolver.js | 6 +- server/resources/ats.json | 67 +------------------ .../pg_dump_2021_05_test_data.sql | 4 +- .../populateFakeTestResults.js | 1 + .../integration/automation-scheduler.test.js | 27 +++++--- 9 files changed, 40 insertions(+), 93 deletions(-) diff --git a/client/components/common/BasicThemedModal/index.jsx b/client/components/common/BasicThemedModal/index.jsx index 086b54cb9..788ac6966 100644 --- a/client/components/common/BasicThemedModal/index.jsx +++ b/client/components/common/BasicThemedModal/index.jsx @@ -102,16 +102,14 @@ const BasicThemedModal = ({ )} {actionButtons.map(({ action, text }) => ( - - ))} + + ))} diff --git a/server/controllers/AutomationController.js b/server/controllers/AutomationController.js index fa1590f49..46f79e018 100644 --- a/server/controllers/AutomationController.js +++ b/server/controllers/AutomationController.js @@ -43,7 +43,7 @@ const throwNoJobFoundError = jobId => { ); }; -const throwNoTestFoundError = (testCsvRow) => { +const throwNoTestFoundError = testCsvRow => { throw new HttpQueryError( 404, `Could not find test at CSV row number ${testCsvRow}`, diff --git a/server/models/services/CollectionJobService.js b/server/models/services/CollectionJobService.js index 3afd36b47..1507b4043 100644 --- a/server/models/services/CollectionJobService.js +++ b/server/models/services/CollectionJobService.js @@ -30,7 +30,7 @@ const { runnableTests } = require('../../resolvers/TestPlanReport'); const { default: axios } = require('axios'); const { default: createGithubWorkflow, - isEnabled: isGithubWorkflowEnabled, + isEnabled: isGithubWorkflowEnabled } = require('../../services/GithubWorkflowService'); const includeBrowserVersion = { diff --git a/server/resolvers/Test/renderableContentsResolver.js b/server/resolvers/Test/renderableContentsResolver.js index 4cf9033ba..dfcc6606b 100644 --- a/server/resolvers/Test/renderableContentsResolver.js +++ b/server/resolvers/Test/renderableContentsResolver.js @@ -1,5 +1,7 @@ -const renderableContents = async (test, _, context) => { - const ats = await context.atLoader.getAll(); +const AtLoader = require('../../models/loaders/AtLoader'); + +const renderableContents = async test => { + const ats = await AtLoader().getAll(); return Object.entries(test.renderableContent).map( ([atId, renderableContent]) => { diff --git a/server/resolvers/Test/renderedUrlsResolver.js b/server/resolvers/Test/renderedUrlsResolver.js index 1483f7d29..f13f4cf8e 100644 --- a/server/resolvers/Test/renderedUrlsResolver.js +++ b/server/resolvers/Test/renderedUrlsResolver.js @@ -1,5 +1,7 @@ -const renderedUrls = async (test, _, context) => { - const ats = await context.atLoader.getAll(); +const AtLoader = require('../../models/loaders/AtLoader'); + +const renderedUrls = async test => { + const ats = await AtLoader().getAll(); return Object.entries(test.renderedUrls).map(([atId, renderedUrl]) => { const at = ats.find(at => at.id == atId); diff --git a/server/resources/ats.json b/server/resources/ats.json index d23657883..bb10432cb 100644 --- a/server/resources/ats.json +++ b/server/resources/ats.json @@ -2,77 +2,16 @@ { "id": 1, "name": "JAWS", - "key": "jaws", - "defaultConfigurationInstructionsHTML": "Configure JAWS with default settings. For help, read <a href="https://github.com/w3c/aria-at/wiki/Configuring-Screen-Readers-for-Testing">Configuring Screen Readers for Testing</a>.", - "assertionTokens": { - "screenReader": "JAWS", - "readingMode": "virtual cursor active", - "interactionMode": "PC cursor active" - }, - "settings": { - "virtualCursor": { - "screenText": "virtual cursor active", - "instructions": [ - "Press <kbd>Alt</kbd>+<kbd>Delete</kbd> to determine which cursor is active.", - "If the PC cursor is active, press <kbd>Escape</kbd> to activate the virtual cursor." - ] - }, - "pcCursor": { - "screenText": "PC cursor active", - "instructions": [ - "Press <kbd>Alt</kbd>+<kbd>Delete</kbd> to determine which cursor is active.", - "If the virtual cursor is active, press <kbd>Insert</kbd>+<kbd>z</kbd> to disable the virtual cursor." - ] - } - } + "key": "jaws" }, { "id": 2, "name": "NVDA", - "key": "nvda", - "defaultConfigurationInstructionsHTML": "Configure NVDA with default settings. For help, read <a href="https://github.com/w3c/aria-at/wiki/Configuring-Screen-Readers-for-Testing">Configuring Screen Readers for Testing</a>.", - "assertionTokens": { - "screenReader": "NVDA", - "readingMode": "browse mode", - "interactionMode": "focus mode" - }, - "settings": { - "browseMode": { - "screenText": "browse mode on", - "instructions": [ - "Press <kbd>Insert</kbd>+<kbd>Space</kbd>.", - "If NVDA made the focus mode sound, press <kbd>Insert</kbd>+<kbd>Space</kbd> again to turn browse mode back on." - ] - }, - "focusMode": { - "screenText": "focus mode on", - "instructions": [ - "Press <kbd>Insert</kbd>+<kbd>Space</kbd>.", - "If NVDA made the browse mode sound, press <kbd>Insert</kbd>+<kbd>Space</kbd> again to turn focus mode back on." - ] - } - } + "key": "nvda" }, { "id": 3, "name": "VoiceOver for macOS", - "key": "voiceover_macos", - "defaultConfigurationInstructionsHTML": "Configure VoiceOver with default settings. For help, read <a href="https://github.com/w3c/aria-at/wiki/Configuring-Screen-Readers-for-Testing">Configuring Screen Readers for Testing</a>.", - "settings": { - "quickNavOn": { - "screenText": "quick nav on", - "instructions": [ - "Simultaneously press <kbd>Left Arrow</kbd> and <kbd>Right Arrow</kbd>.", - "If VoiceOver said 'quick nav off', press <kbd>Left Arrow</kbd> and <kbd>Right Arrow</kbd> again to turn it back on." - ] - }, - "quickNavOff": { - "screenText": "quick nav off", - "instructions": [ - "Simultaneously press <kbd>Left Arrow</kbd> and <kbd>Right Arrow</kbd>.", - "If VoiceOver said 'quick nav on', press <kbd>Left Arrow</kbd> and <kbd>Right Arrow</kbd> again to turn it back off." - ] - } - } + "key": "voiceover_macos" } ] \ No newline at end of file diff --git a/server/scripts/populate-test-data/pg_dump_2021_05_test_data.sql b/server/scripts/populate-test-data/pg_dump_2021_05_test_data.sql index 46dd3f263..e2ba8630b 100644 --- a/server/scripts/populate-test-data/pg_dump_2021_05_test_data.sql +++ b/server/scripts/populate-test-data/pg_dump_2021_05_test_data.sql @@ -85,8 +85,8 @@ INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "atId", "bro INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "atId", "browserId", "vendorReviewStatus") VALUES (11, get_test_plan_version_id(text 'Modal Dialog Example', null), '2021-05-14 14:18:23.602-05', 3, 2, 'READY'); INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (12, get_test_plan_version_id(text 'Checkbox Example (Mixed-State)', null), '2021-05-14 14:18:23.602-05', '2022-07-06', 1, 2, 'READY'); INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (13, get_test_plan_version_id(text 'Checkbox Example (Mixed-State)', null), '2021-05-14 14:18:23.602-05', '2022-07-07', 2, 2, 'READY'); -INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (14, get_test_plan_version_id(text 'Toggle Button'), '2021-05-14 14:18:23.602-05', '2022-07-07', 2, 2, 'READY'); -INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (15, get_test_plan_version_id(text 'Toggle Button'), '2021-05-14 14:18:23.602-05', '2022-07-07', 3, 3, 'READY'); +INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (14, get_test_plan_version_id(text 'Toggle Button', null), '2021-05-14 14:18:23.602-05', '2022-07-07', 2, 2, 'READY'); +INSERT INTO "TestPlanReport" (id, "testPlanVersionId", "createdAt", "markedFinalAt", "atId", "browserId", "vendorReviewStatus") VALUES (15, get_test_plan_version_id(text 'Toggle Button', null), '2021-05-14 14:18:23.602-05', '2022-07-07', 3, 3, 'READY'); -- -- Data for Name: TestPlanVersion; Type: TABLE DATA; Schema: public; Owner: atr diff --git a/server/scripts/populate-test-data/populateFakeTestResults.js b/server/scripts/populate-test-data/populateFakeTestResults.js index 9b0463980..a92047b40 100644 --- a/server/scripts/populate-test-data/populateFakeTestResults.js +++ b/server/scripts/populate-test-data/populateFakeTestResults.js @@ -78,6 +78,7 @@ const populateFakeTestResults = async (testPlanRunId, fakeTestResultTypes) => { break; case 'passingHistoricalResultsForMockAutomation': await getFake({ + testPlanReport, testPlanRunId, index, fakeTestResultType: diff --git a/server/tests/integration/automation-scheduler.test.js b/server/tests/integration/automation-scheduler.test.js index 812a070c9..1d1e55fe7 100644 --- a/server/tests/integration/automation-scheduler.test.js +++ b/server/tests/integration/automation-scheduler.test.js @@ -9,6 +9,9 @@ const { default: axios } = require('axios'); const { getCollectionJobById } = require('../../models/services/CollectionJobService'); +const { + getTestPlanReportById +} = require('../../models/services/TestPlanReportService'); let mockAutomationSchedulerServer; let apiServer; @@ -496,17 +499,7 @@ describe('Automation controller', () => { it('should copy assertion results when updating with results that match historical results', async () => { await dbCleaner(async () => { - const { scheduleCollectionJob: job } = - await scheduleCollectionJobByMutation(); - const collectionJob = await getCollectionJobById(job.id); - await sessionAgent - .post(`/api/jobs/${jobId}/update`) - .send({ status: 'RUNNING' }) - .set( - 'x-automation-secret', - process.env.AUTOMATION_SCHEDULER_SECRET - ); - + // Start by getting historical results for comparing later // Test plan report used for test is in Draft so it // must be markedAsFinal to have historical results const finalizedTestPlanVersion = await markAsFinal( @@ -535,6 +528,18 @@ describe('Automation controller', () => { scenarioResult => scenarioResult.output ); const { atVersion, browserVersion } = historicalTestResult; + + const { scheduleCollectionJob: job } = + await scheduleCollectionJobByMutation(); + const collectionJob = await getCollectionJobById(job.id); + await sessionAgent + .post(`/api/jobs/${jobId}/update`) + .send({ status: 'RUNNING' }) + .set( + 'x-automation-secret', + process.env.AUTOMATION_SCHEDULER_SECRET + ); + const response = await sessionAgent .post(`/api/jobs/${jobId}/result`) .send({