-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: prepare html-reporter for pwt GUI integration #522
Merged
shadowusr
merged 17 commits into
master
from
users/shadowusr/HERMIONE-1004.get-rid-of-prepared-result
Dec 12, 2023
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3266eae
refactor: rename sqlite-adapter to sqlite-client
shadowusr 7f74b44
chore: re-write hermione.js to typescript
shadowusr 48130c1
refactor: get rid of init method in sqlite-client
shadowusr 0e019c7
refactor: streamline test result types in sqlite-client
shadowusr 3f4fbed
refactor: handle attempt number explicitly
shadowusr 4d99efd
fix: unit test and minor bug fixes
shadowusr e7f1ae8
refactor: get rid of plugin-adapter
shadowusr 6d6ba05
fix: fix review issues
shadowusr fc00f1c
test: fix tests building
shadowusr ab23dd4
fix: fix test attempt manager, review issues, status computing
shadowusr 9ec97dd
draft: save changes
shadowusr 1820225
fix: fix unit and e2e tests, further refactoring
shadowusr f028f03
test: update chrome installation flow
shadowusr a542042
test: update browser-utils package-lock
shadowusr b7c9b61
test: add browser-utils package-lock
shadowusr f0afacb
test: update browser-utils package-lock
shadowusr 54cee16
test: fix chrome installation flow for testing
shadowusr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,5 +1,42 @@ | ||
import _ from 'lodash'; | ||
import {ReporterTestResult} from '../index'; | ||
import {TupleToUnion} from 'type-fest'; | ||
|
||
export const copyAndUpdate = (original: ReporterTestResult, updates: Partial<ReporterTestResult>): ReporterTestResult => | ||
_.assign({}, original, updates); | ||
export const copyAndUpdate = (original: ReporterTestResult, updates: Partial<ReporterTestResult>): ReporterTestResult => { | ||
const keys = [ | ||
'assertViewResults', | ||
'attempt', | ||
'browserId', | ||
'description', | ||
'error', | ||
'errorDetails', | ||
'file', | ||
'fullName', | ||
'history', | ||
'id', | ||
'image', | ||
'imageDir', | ||
'imagesInfo', | ||
'isUpdated', | ||
'meta', | ||
'multipleTabs', | ||
'screenshot', | ||
'sessionId', | ||
'skipReason', | ||
'state', | ||
'status', | ||
'testPath', | ||
'timestamp', | ||
'url' | ||
] as const; | ||
|
||
// Type-level check that we didn't forget to include any keys | ||
type A = TupleToUnion<typeof keys>; | ||
type B = keyof ReporterTestResult; | ||
|
||
const keysTypeChecked: B extends A ? | ||
B extends A ? typeof keys : never | ||
shadowusr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
: never = keys; | ||
|
||
return _.assign({}, _.pick(original, keysTypeChecked) as ReporterTestResult, updates); | ||
}; |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы разве не можем добавлять попытку уже внутри метода
addSkipped
? а то получается, что часть по созданию ретрая мы делаем отдельноThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
При текущем подходе не можем по следующим причинам:
addSkipped
, мы условились работать сReporterTestResult
ReporterTestResult
нуженattempt
Можно было бы поместить его в фабрику
formatTestResult
, но тогда каждый раз, когда хотим отформатировать testResult считался бы ретраем, а это — неожиданный сайд-эффект.В целом я задумывал
testAttemptManager
как независимый сервис по отслеживанию попыток теста, можно думать про него, что это база данных. Сам результат теста не знает, какой он по счету, в каждом инстансеReporterTestResult
зафиксирована конкретная попытка и он тоже не знает о глобальном состоянии. АtestAttemptManager
— как раз глобальное хранилище состояния попыток.Если есть идеи, как можно упростить/улучшить этот момент — буду рад услышать!