-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Display AT Version for finalized reports when TestPlanVersion i…
…s RECOMMENDED (#1052) * Add minimum or exact at version to reports * Quick tweak * Revert home copy change * Remove unused field from createTestPlanReport * Fix undefined var * Prevent API from creating duplicate reports * Support primary test plan to be selected * Fix test * Add resolver for finding firstRequiredAtVersion for a RECOMMENDED TestPlanVersion, given an atId * Add dialog when marking report as final for an admin to select from probably primary test run options * prioritised -> prioritized typo (british -> american english) * Update tests * Track recommended AT version * Avoid displaying primary test plan run confirmation when just 1 run option * Fix graphql call when including "firstRequiredAtVersion" under "testPlanVersions" * Update description of firstRequiredAtVersion * Add atVersion frontend * Make sure automation dialog always shows when valid * Rename resolver * Make sure existing reports have a minimum at version * Formatting * Fix graphql calls when doing testPlanReports > recommendedAtVersion * feat: Add resolver for tracking first required AT Version (#1051) Address #792 * Add resolver for finding firstRequiredAtVersion for a RECOMMENDED TestPlanVersion, given an atId * Update tests * Fix graphql call when including "firstRequiredAtVersion" under "testPlanVersions" * Update description of firstRequiredAtVersion * Rename resolver * Use exactAtVersionId if available for recommendedAtVersion * Update comment --------- Co-authored-by: alflennik <[email protected]>
- Loading branch information
Showing
11 changed files
with
106 additions
and
23 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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
const getTestPlanVersionTitle = testPlanVersion => { | ||
return testPlanVersion.title || `"${testPlanVersion.testPlan.directory}"`; | ||
const getTestPlanVersionTitle = ( | ||
testPlanVersion, | ||
{ includeVersionString = false } = {} | ||
) => { | ||
let title = testPlanVersion.title || testPlanVersion.testPlan?.directory; | ||
if (includeVersionString && testPlanVersion.versionString) | ||
title = `${title} ${testPlanVersion.versionString}`; | ||
return title; | ||
}; | ||
|
||
// const getTestPlanTargetTitle = ({ browser, browserVersion, at, atVersion }) => { | ||
// return `${at.name} ${atVersion} and ${browser.name} ${browserVersion}`; | ||
// }; | ||
|
||
const getTestPlanTargetTitle = ({ browser, at }) => { | ||
return `${at.name} and ${browser.name}`; | ||
const getTestPlanTargetTitle = ({ at, browser, atVersion }) => { | ||
if (!atVersion) return `${at.name} and ${browser.name}`; | ||
return `${at.name} ${atVersion.name} and ${browser.name}`; | ||
}; | ||
|
||
export { getTestPlanTargetTitle, getTestPlanVersionTitle }; |
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
45 changes: 45 additions & 0 deletions
45
server/resolvers/TestPlanReport/recommendedAtVersionResolver.js
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,45 @@ | ||
const { getAtVersionById } = require('../../models/services/AtService'); | ||
const { | ||
getTestPlanVersionById | ||
} = require('../../models/services/TestPlanVersionService'); | ||
const earliestAtVersionResolver = require('../TestPlanVersion/earliestAtVersionResolver'); | ||
|
||
const recommendedAtVersionResolver = async (testPlanReport, _, context) => { | ||
const { transaction } = context; | ||
|
||
let testPlanVersion; | ||
if (testPlanReport.testPlanVersion) { | ||
testPlanVersion = testPlanReport.testPlanVersion; | ||
} else { | ||
testPlanVersion = await getTestPlanVersionById({ | ||
id: testPlanReport.testPlanVersionId, | ||
testPlanVersionAttributes: ['id', 'phase'], | ||
testPlanReportAttributes: [], | ||
testPlanRunAttributes: [], | ||
atAttributes: [], | ||
browserAttributes: [], | ||
userAttributes: [], | ||
transaction | ||
}); | ||
} | ||
const phase = testPlanVersion.phase; | ||
|
||
if (!testPlanReport.markedFinalAt || phase !== 'RECOMMENDED') return null; | ||
|
||
// If report was created with exact version being required, display that | ||
if (testPlanReport.exactAtVersionId) { | ||
return getAtVersionById({ | ||
id: testPlanReport.exactAtVersionId, | ||
transaction | ||
}); | ||
} | ||
|
||
// Otherwise return the earliest At version used to record results | ||
return earliestAtVersionResolver( | ||
testPlanVersion, | ||
{ atId: testPlanReport.atId }, | ||
context | ||
); | ||
}; | ||
|
||
module.exports = recommendedAtVersionResolver; |
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