-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/recordbrowser #33
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
Merged
Julesboul
merged 42 commits into
Pharo-XP-Tools:P14
from
nicolasp025:feature/recordbrowser
Mar 6, 2026
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d0dad6b
8b1479c
23ec5e0
486cfed
f911360
feat: adding a recorder window
nicolasp025 ea04d1d
feat: can inspect records on right click
nicolasp025 f31aa6c
feat: more info on recorder window and stop button
nicolasp025 0f39f0e
fix: could not hide with taskbar, also adding window icon
nicolasp025 a8720ec
feat: can inspect records in browser
nicolasp025 9f3f530
feat: colored records on browser
nicolasp025 5321071
fix: column for color in browser
nicolasp025 819f0b0
feat: new colors for browser
nicolasp025 1af3591
fix: cannot add a file twice
nicolasp025 c3b5de3
feat: timeline chart (data need to be fixed, also need refactoring)
nicolasp025 5cd5eb8
feat: dynamic colors for timeline
nicolasp025 70a8d12
fix: refactoring and display plots with nanoseconds
nicolasp025 a44b70a
refactoring: remove buttons attributes in browser class
nicolasp025 0ae7e5c
feat: adding a method for getting all record classes
nicolasp025 305073b
feat: filter the records
nicolasp025 318ba65
refactoring: records table and text color always white
nicolasp025 9f8477e
feat: inspect record in table when selected
nicolasp025 fa08e33
fix: on record inspect
nicolasp025 e5a6b5c
test: for the browser and the recorder
nicolasp025 8ad83d9
refactoring: DSRecordBrowserPresenter -> DSRecordBrowser
nicolasp025 a7d8bbc
fix: adding browser tests to baseline
nicolasp025 9838a45
fix: browser testing
nicolasp025 bece7be
refacto: browser lazy init and test fixes
nicolasp025 23ded92
fix: auto serialize and instrumentation after opening the recorder
nicolasp025 11e058a
fix: browser tests and git rebase
nicolasp025 9fd34a5
fix: recorder window was opened but never closed in tests
nicolasp025 c41e740
Merge branch 'feature/recordbrowser' into fix/recordbrowser
nicolasp025 d7c4d3b
Merge pull request #1 from nicolasp025/fix/recordbrowser
nicolasp025 4cf47b1
fix: update with PR changes
nicolasp025 ebc3aba
fix: in browser opening/closing tests
nicolasp025 2f28082
fix: PR changes
nicolasp025 b1fccaa
fix: current time is always updated, and timer works only when recording
nicolasp025 a542e1b
fix: browser needs window to be opened
nicolasp025 bf80a0c
refactoring: getNonAbstractSubclasses -> getLeafSubClasses
nicolasp025 e6217c8
test: removing random record generation
nicolasp025 48bf0c1
refactor: removing isAbstract deprecated methods
nicolasp025 86d5afd
refactor: getLeafSubClasses on browser package
nicolasp025 483188c
refactor: PR changes and tests improves
nicolasp025 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 hidden or 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
303 changes: 303 additions & 0 deletions
303
DebuggingSpy-Browser-Tests/DSRecordBrowserPresenterTest.class.st
nicolasp025 marked this conversation as resolved.
Show resolved
Hide resolved
nicolasp025 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,303 @@ | ||
| Class { | ||
| #name : 'DSRecordBrowserPresenterTest', | ||
| #superclass : 'TestCase', | ||
| #instVars : [ | ||
| 'browser' | ||
| ], | ||
| #category : 'DebuggingSpy-Browser-Tests', | ||
| #package : 'DebuggingSpy-Browser-Tests' | ||
| } | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> filesPresenter [ | ||
|
|
||
| ^ browser presenterAt: #fileListPresenter | ||
| ] | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> generateRecordsFile [ | ||
| "Generates a file of random records and returns its file reference." | ||
|
|
||
| | records recordFileRef writeStream | | ||
| records := self getRecordExamples. | ||
|
|
||
| recordFileRef := self temporaryDirectory / ('ds-spy-test-' , UUID new asString). | ||
| recordFileRef ensureCreateFile. | ||
| writeStream := recordFileRef writeStream. | ||
|
|
||
| writeStream nextPut: $[. | ||
|
|
||
| records doWithIndex: [ :record :index | | ||
| writeStream nextPutAll: (STON toString: record). | ||
|
|
||
| index = records size ifFalse: [ | ||
| writeStream nextPut: $,. | ||
| writeStream crlf ] ]. | ||
|
|
||
| writeStream nextPut: $]. | ||
|
|
||
| writeStream close. | ||
|
|
||
| ^ recordFileRef | ||
| ] | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> getRecordExamples [ | ||
|
|
||
| ^ OrderedCollection new | ||
| add: (DSBrowseRecord new | ||
| windowId: 1; | ||
| dateTime: (DateAndTime fromSeconds: 1); | ||
| yourself); | ||
| add: (DSMouseEnterWindowRecord new | ||
| windowId: 2; | ||
| dateTime: (DateAndTime fromSeconds: 2); | ||
| yourself); | ||
| add: (DSMouseLeaveWindowRecord new | ||
| windowId: 3; | ||
| dateTime: (DateAndTime fromSeconds: 3); | ||
| yourself); | ||
| add: (DSInspectItRecord new | ||
| windowId: 4; | ||
| dateTime: (DateAndTime fromSeconds: 4); | ||
| yourself); | ||
| yourself | ||
| ] | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> recordsFilterPresenter [ | ||
|
|
||
| ^ browser presenterAt: #recordsFilter | ||
| ] | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> recordsTablePresenter [ | ||
|
|
||
| ^ browser presenterAt: #recordsTablePresenter | ||
| ] | ||
|
|
||
| { #category : 'running' } | ||
| DSRecordBrowserPresenterTest >> setUp [ | ||
|
|
||
| super setUp. | ||
| browser := DSRecordBrowserPresenter new | ||
| ] | ||
|
|
||
| { #category : 'running' } | ||
| DSRecordBrowserPresenterTest >> tearDown [ | ||
|
|
||
| DSRecordBrowserPresenter resetBrowser. | ||
| super tearDown | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testAddFile [ | ||
|
|
||
| | fileRef | | ||
| fileRef := self generateRecordsFile. | ||
|
|
||
| browser addFile: fileRef. | ||
| self assert: browser files size equals: 1. | ||
| self assert: self filesPresenter items size equals: 1. | ||
|
|
||
| self assert: self filesPresenter selectedItem equals: fileRef | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testAddFileWhenAlreadyInList [ | ||
|
|
||
| | fileRef | | ||
| fileRef := self generateRecordsFile. | ||
|
|
||
| browser addFile: fileRef. | ||
| browser addFile: fileRef. | ||
| self assert: browser files size equals: 1. | ||
| self assert: self filesPresenter items size equals: 1. | ||
| self assert: self filesPresenter selectedItem equals: fileRef | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testAddingMultipleFiles [ | ||
|
|
||
| | fileRef | | ||
| browser addFile: self generateRecordsFile. | ||
| fileRef := self generateRecordsFile. | ||
|
|
||
| browser addFile: fileRef. | ||
|
|
||
| self assert: browser files size equals: 2. | ||
| self assert: self filesPresenter items size equals: 2. | ||
| self assert: self filesPresenter selectedItem equals: fileRef | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testBrowserEmpty [ | ||
|
|
||
| self assertEmpty: browser files. | ||
| self assert: self filesPresenter items size equals: 0. | ||
| self assert: self filesPresenter selectedItem equals: nil. | ||
| self assert: self recordsTablePresenter roots size equals: 0 | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testClosingBrowser [ | ||
|
|
||
| DSRecordBrowserPresenter toggleBrowser. | ||
| DSRecordBrowserPresenter toggleBrowser. | ||
| self deny: DSRecordBrowserPresenter uniqueInstance window isOpen | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testCreatingAndOpeningBrowser [ | ||
|
|
||
| DSRecordBrowserPresenter toggleBrowser. | ||
| self assert: DSRecordBrowserPresenter uniqueInstance window isOpen. | ||
| DSRecordBrowserPresenter toggleBrowser | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testFilteringAClassOfRecords [ | ||
|
|
||
| | fileRef history | | ||
| fileRef := self generateRecordsFile. | ||
| history := browser getHistoryFrom: fileRef. | ||
|
|
||
| browser addFile: fileRef. | ||
| self assert: self recordsTablePresenter roots size equals: history records size. | ||
|
|
||
| self recordsFilterPresenter sourceList selectItem: DSBrowseRecord. | ||
| self recordsFilterPresenter addSelected. | ||
|
|
||
| self deny: self recordsTablePresenter roots first class equals: DSBrowseRecord | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testFilteringAllRecords [ | ||
|
|
||
| | fileRef history | | ||
| fileRef := self generateRecordsFile. | ||
| history := browser getHistoryFrom: fileRef. | ||
|
|
||
| browser addFile: fileRef. | ||
|
|
||
| self recordsFilterPresenter addAll. | ||
| self assert: self recordsTablePresenter roots size equals: 0 | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testGetHistoryFrom [ | ||
|
|
||
| | fileRef | | ||
| fileRef := self generateRecordsFile. | ||
| self assert: (browser getHistoryFrom: fileRef) class equals: DSRecordHistory | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testGetRecordColorAssociationsFrom [ | ||
|
|
||
| | windows colorAssociations | | ||
| windows := { (DSWindowRecord new | ||
| toolInfos: { (DSToolInfo new | ||
| toolClassName: 'StPlaygroundPresenter'; | ||
| yourself) } asOrderedCollection; | ||
| events: { | ||
| DSWindowOpenedRecord new. | ||
| DSDoItRecord new. | ||
| DSStepThroughRecord new }) } asOrderedCollection. | ||
|
|
||
| colorAssociations := browser getRecordColorAssociationsFrom: windows. | ||
|
|
||
| self assert: colorAssociations first key class equals: DSWindowOpenedRecord. | ||
| self assert: (colorAssociations at: 2) key class equals: DSDoItRecord. | ||
| self assert: colorAssociations last key class equals: DSStepThroughRecord. | ||
|
|
||
| colorAssociations do: [ :association | self assert: association value equals: (Color fromHexString: '#70B77E') ] | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testRemoveFile [ | ||
|
|
||
| | fileRef1 fileRef2 | | ||
| fileRef1 := self generateRecordsFile. | ||
| fileRef2 := self generateRecordsFile. | ||
|
|
||
| browser addFile: fileRef1. | ||
| browser addFile: fileRef2. | ||
nicolasp025 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| browser removeFile: fileRef1. | ||
|
|
||
| self assert: browser files size equals: 1. | ||
| self assert: self filesPresenter items size equals: 1. | ||
| self assert: self filesPresenter selectedItem equals: fileRef2 | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testRemoveLastFile [ | ||
|
|
||
| | fileRef1 | | ||
| fileRef1 := self generateRecordsFile. | ||
|
|
||
| browser addFile: fileRef1. | ||
| browser removeFile: fileRef1. | ||
|
|
||
| self assert: browser files size equals: 0. | ||
| self assert: self filesPresenter items size equals: 0. | ||
| self assert: self filesPresenter selectedItem equals: nil | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testStartRecording [ | ||
|
|
||
| self assert: browser timerWindow isNil. | ||
| self deny: DSRecordRegistry autoSerialize. | ||
| self deny: DSSpy recordingSession. | ||
|
|
||
| browser startRecording. | ||
| self assert: DSSpy recordingSession. | ||
| self assert: DSRecordRegistry autoSerialize. | ||
| self deny: browser timerWindow isNil. | ||
|
|
||
| browser stopRecording | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testStopRecording [ | ||
|
|
||
| | timerWindow | | ||
| browser startRecording. | ||
| timerWindow := browser timerWindow. | ||
| browser stopRecording. | ||
|
|
||
| self deny: (self currentWorld submorphs includes: timerWindow). | ||
| self assert: browser timerWindow isNil | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testUpdateRecordsTable [ | ||
|
|
||
| | fileRef presenterMock | | ||
| fileRef := self generateRecordsFile. | ||
| presenterMock := MockObject new on: #selectedItem respond: fileRef. | ||
| browser updateRecordsTable: presenterMock. | ||
|
|
||
| self assert: self recordsTablePresenter roots first key class equals: DSBrowseRecord. | ||
| self assert: (self recordsTablePresenter roots at: 2) key class equals: DSMouseEnterWindowRecord. | ||
| self assert: (self recordsTablePresenter roots at: 3) key class equals: DSMouseLeaveWindowRecord. | ||
| self assert: self recordsTablePresenter roots last key class equals: DSInspectItRecord | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSRecordBrowserPresenterTest >> testUpdateRecordsTableWhenAddingFile [ | ||
|
|
||
| browser addFile: self generateRecordsFile. | ||
|
|
||
| self assert: self recordsTablePresenter roots first key class equals: DSBrowseRecord. | ||
| self assert: (self recordsTablePresenter roots at: 2) key class equals: DSMouseEnterWindowRecord. | ||
| self assert: (self recordsTablePresenter roots at: 3) key class equals: DSMouseLeaveWindowRecord. | ||
| self assert: self recordsTablePresenter roots last key class equals: DSInspectItRecord | ||
| ] | ||
|
|
||
| { #category : 'helpers' } | ||
| DSRecordBrowserPresenterTest >> timelinePresenter [ | ||
|
|
||
| ^ browser presenterAt: #graphicTimeline | ||
| ] | ||
This file contains hidden or 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,54 @@ | ||
| Class { | ||
| #name : 'DSTimerWindowTest', | ||
| #superclass : 'TestCase', | ||
| #instVars : [ | ||
| 'timerWindow' | ||
| ], | ||
| #category : 'DebuggingSpy-Browser-Tests', | ||
| #package : 'DebuggingSpy-Browser-Tests' | ||
| } | ||
|
|
||
| { #category : 'layout' } | ||
| DSTimerWindowTest >> currentTimeMorph [ | ||
| "Returns the window's timeNowMorph" | ||
|
|
||
| ^ timerWindow readSlot: (DSTimerWindow slotNamed: #currentTimeMorph) | ||
| ] | ||
|
|
||
| { #category : 'running' } | ||
| DSTimerWindowTest >> setUp [ | ||
| super setUp. | ||
|
|
||
| timerWindow := DSTimerWindow new. | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSTimerWindowTest >> testElapsedTime [ | ||
|
|
||
| DSSpy recordingSession: true. | ||
| timerWindow startTimer. | ||
|
|
||
| (Delay forMilliseconds: 1000) wait. | ||
|
|
||
| DSSpy recordingSession: false. | ||
| self assert: timerWindow elapsedTime equals: 1 | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSTimerWindowTest >> testEmptyTimerMorph [ | ||
|
|
||
| self assert: (Time readFrom: self timerMorph contents readStream) seconds equals: 0 | ||
| ] | ||
|
|
||
| { #category : 'tests' } | ||
| DSTimerWindowTest >> testTimeNowMorph [ | ||
|
|
||
| self assert: (Time readFrom: self currentTimeMorph contents readStream) asSeconds equals: Time now asSeconds | ||
| ] | ||
|
|
||
| { #category : 'layout' } | ||
| DSTimerWindowTest >> timerMorph [ | ||
| "Returns the window's timerMorph." | ||
|
|
||
| ^ timerWindow readSlot: (DSTimerWindow slotNamed: #timerMorph) | ||
| ] |
This file contains hidden or 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 @@ | ||
| Package { #name : 'DebuggingSpy-Browser-Tests' } |
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.
Uh oh!
There was an error while loading. Please reload this page.