-
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.
Support 0-level assertion priorities on TestRun page (#863)
* Update client/resources * Update graphql-schema.js and testsResolver * Update assertionResultsResolver.js * Update import-tests script to include assertion.assertionExceptions (0 level assertions will be considered internally as 'EXCLUDE') * Update getMetrics and queries to be aware of 'excluded' assertions for commands * Update import branch for testing * Update import branch for testing * Remove 'exclude' property check reliance on frontend * Revert graphql fragment usage * Fix missing renderableContent in anon viewer query * Rename instances of Command.settings to Command.atOperatingMode in graphql-schema.js * Include migration to update existing test plan versions using the v2 test format version to also include (an empty) assertionExceptions so hashes will remain in sync; include utility introduced in #880 * Move atOperatingMode setting to TestsService, getTests * Missing comma * Update comments with reasoning for filtering out assertions that can possibly have no ids * Update convertAssertionPriority usage * Revert test branch being used back to master * Break out in-line filter into function sufficiently support readability purposes --------- Co-authored-by: Stalgia Grigg <stalgia@bocoup.com>
- Loading branch information
Showing
17 changed files
with
343 additions
and
42 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
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 |
---|---|---|
|
@@ -123,6 +123,7 @@ export class commandsAPI { | |
return { | ||
value, | ||
key, | ||
settings: mode, | ||
}; | ||
}) | ||
); | ||
|
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
47 changes: 47 additions & 0 deletions
47
server/migrations/20240111225130-includeMissingAssertionExceptions.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,47 @@ | ||
'use strict'; | ||
|
||
const { regenerateResultsAndRecalculateHashes } = require('./utils'); | ||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
const updateV2TestsToIncludeEmptyAssertionExceptions = | ||
async transaction => { | ||
const testPlanVersions = await queryInterface.sequelize.query( | ||
`SELECT id, tests FROM "TestPlanVersion" WHERE metadata->>'testFormatVersion' = '2'`, | ||
{ | ||
type: Sequelize.QueryTypes.SELECT, | ||
transaction | ||
} | ||
); | ||
await Promise.all( | ||
testPlanVersions.map(async ({ id, tests }) => { | ||
const updatedTests = JSON.stringify( | ||
tests.map(test => { | ||
test.assertions = test.assertions.map( | ||
assertion => ({ | ||
...assertion, | ||
assertionExceptions: [] | ||
}) | ||
); | ||
return test; | ||
}) | ||
); | ||
await queryInterface.sequelize.query( | ||
`UPDATE "TestPlanVersion" SET tests = ? WHERE id = ?`, | ||
{ replacements: [updatedTests, id], transaction } | ||
); | ||
}) | ||
); | ||
}; | ||
|
||
return queryInterface.sequelize.transaction(async transaction => { | ||
await updateV2TestsToIncludeEmptyAssertionExceptions(transaction); | ||
|
||
// Recalculate the hashes | ||
await regenerateResultsAndRecalculateHashes( | ||
queryInterface, | ||
transaction | ||
); | ||
}); | ||
} | ||
}; |
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
Oops, something went wrong.