forked from jgfoster/Jade.bak
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed RowanTranscript>>openRowanProjectsBrowser Added Jadeite tests. See JadeiteTestCase and JadeiteTestResource. Added new package Rowan UI Tests
- Loading branch information
Eric Winger
authored and
Eric Winger
committed
Aug 16, 2018
1 parent
0f20e46
commit eda7b19
Showing
4 changed files
with
205 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"Filed out from Dolphin Smalltalk 7"! | ||
|
||
TestCase subclass: #JadeiteTestCase | ||
instanceVariableNames: 'session browser transcript' | ||
classVariableNames: '' | ||
poolDictionaries: '' | ||
classInstanceVariableNames: ''! | ||
JadeiteTestCase guid: (GUID fromString: '{1d6db475-c257-442b-9f91-d1574b03aee2}')! | ||
JadeiteTestCase comment: 'General Jadeite tests. Assumes a logged in session and transcript present. '! | ||
!JadeiteTestCase categoriesForClass!Unclassified! ! | ||
!JadeiteTestCase methodsFor! | ||
|
||
openProjectsBrowser | ||
browser := self openWindow: [transcript openJadeiteProjectsBrowser]! | ||
|
||
openWindow: aBlock | ||
"evaluate a block which is expected to return an object that responds to #view. | ||
Wait until the view affirms it is open before continuing" | ||
|
||
| presenter count | | ||
presenter := aBlock value. | ||
count := 0. | ||
[presenter view isOpen] whileFalse: | ||
[(Delay forMilliseconds: 50) wait. | ||
count := count + 1. | ||
count > 10 ifTrue: [^presenter]]. | ||
^presenter! | ||
|
||
projectList | ||
^self projectListPresenter list! | ||
|
||
projectListPresenter | ||
^browser currentCard projectListPresenter! | ||
|
||
rowanProjectNames | ||
"this may change" | ||
|
||
^#('Cypress' 'Rowan' 'STON' 'Tonel')! | ||
|
||
select: presenter elementsNamed: anArray | ||
anArray do: | ||
[:name | | ||
| service | | ||
service := presenter list detect: [:service | service name = name] | ||
ifNone: [self error: 'List element ' , name , ' not found']. | ||
presenter selections: (presenter selections asOrderedCollection add: service; yourself)]! | ||
|
||
setUp | ||
super setUp. | ||
session := JadeiteTestResource current session. | ||
transcript := JadeiteTestResource current transcript! | ||
|
||
tearDown | ||
super tearDown. | ||
browser ifNotNil: [browser destroy]! | ||
|
||
test_openProjectsBrowser | ||
self openProjectsBrowser. | ||
self assert: browser class equals: JadeiteProjectsSystemBrowser. | ||
self | ||
denyIsNil: (self projectList detect: [:projectService | projectService name = 'Rowan'] ifNone: [])! | ||
|
||
test_selectMultipleProjects | ||
self openProjectsBrowser. | ||
self assert: self projectListPresenter selections isEmpty. | ||
self select: self projectListPresenter elementsNamed: self rowanProjectNames. | ||
self assert: self projectListPresenter selections size = 4! ! | ||
!JadeiteTestCase categoriesFor: #openProjectsBrowser!private!private project support! ! | ||
!JadeiteTestCase categoriesFor: #openWindow:!private! ! | ||
!JadeiteTestCase categoriesFor: #projectList!private!private project support! ! | ||
!JadeiteTestCase categoriesFor: #projectListPresenter!private!private project support! ! | ||
!JadeiteTestCase categoriesFor: #rowanProjectNames!private!private project support! ! | ||
!JadeiteTestCase categoriesFor: #select:elementsNamed:!private!private project support! ! | ||
!JadeiteTestCase categoriesFor: #setUp!private! ! | ||
!JadeiteTestCase categoriesFor: #tearDown!private! ! | ||
!JadeiteTestCase categoriesFor: #test_openProjectsBrowser!public!test! ! | ||
!JadeiteTestCase categoriesFor: #test_selectMultipleProjects!public!test! ! | ||
|
||
!JadeiteTestCase class methodsFor! | ||
|
||
resources | ||
^IdentitySet with: JadeiteTestResource! ! | ||
!JadeiteTestCase class categoriesFor: #resources!public! ! | ||
|
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,38 @@ | ||
"Filed out from Dolphin Smalltalk 7"! | ||
|
||
TestResource subclass: #JadeiteTestResource | ||
instanceVariableNames: 'session transcript' | ||
classVariableNames: '' | ||
poolDictionaries: '' | ||
classInstanceVariableNames: ''! | ||
JadeiteTestResource guid: (GUID fromString: '{81a2cf60-8ff0-4d5a-95b7-c3e863ced71c}')! | ||
JadeiteTestResource comment: ''! | ||
!JadeiteTestResource categoriesForClass!Unclassified! ! | ||
!JadeiteTestResource methodsFor! | ||
|
||
isAvailable | ||
^session notNil and: [transcript notNil]! | ||
|
||
session | ||
|
||
^session! | ||
|
||
setUp | ||
super setUp. | ||
session := GciSession allInstances detect: [:each | each isValidSession] ifNone: []. | ||
transcript := RowanTranscript allInstances detect: [:tran | tran gciSession == session] ifNone:[]. ! | ||
|
||
transcript | ||
|
||
^transcript! ! | ||
!JadeiteTestResource categoriesFor: #isAvailable!public!testing! ! | ||
!JadeiteTestResource categoriesFor: #session!accessing!public! ! | ||
!JadeiteTestResource categoriesFor: #setUp!public! ! | ||
!JadeiteTestResource categoriesFor: #transcript!accessing!public! ! | ||
|
||
!JadeiteTestResource class methodsFor! | ||
|
||
isAvailable | ||
^self current isAvailable! ! | ||
!JadeiteTestResource class categoriesFor: #isAvailable!public! ! | ||
|
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,80 @@ | ||
| package | | ||
package := Package name: 'Rowan UI Tests'. | ||
package paxVersion: 1; | ||
basicComment: ''. | ||
|
||
|
||
package classNames | ||
add: #JadeiteTestCase; | ||
add: #JadeiteTestResource; | ||
yourself. | ||
|
||
package methodNames | ||
add: #TestSuite -> #run; | ||
add: 'TestResource class' -> #signalInitializationError; | ||
yourself. | ||
|
||
package binaryGlobalNames: (Set new | ||
yourself). | ||
|
||
package globalAliases: (Set new | ||
yourself). | ||
|
||
package setPrerequisites: (IdentitySet new | ||
add: '..\Core\Object Arts\Dolphin\Base\Dolphin'; | ||
add: 'GemStone Session'; | ||
add: 'Rowan UI Base'; | ||
add: '..\Core\Contributions\Camp Smalltalk\SUnit\SUnit'; | ||
yourself). | ||
|
||
package! | ||
|
||
"Class Definitions"! | ||
|
||
TestCase subclass: #JadeiteTestCase | ||
instanceVariableNames: 'session browser transcript' | ||
classVariableNames: '' | ||
poolDictionaries: '' | ||
classInstanceVariableNames: ''! | ||
TestResource subclass: #JadeiteTestResource | ||
instanceVariableNames: 'session transcript' | ||
classVariableNames: '' | ||
poolDictionaries: '' | ||
classInstanceVariableNames: ''! | ||
|
||
"Global Aliases"! | ||
|
||
|
||
"Loose Methods"! | ||
|
||
!TestResource class methodsFor! | ||
|
||
signalInitializationError | ||
|
||
"TestSuite>>run: in the SUnit pacakge sends this method | ||
to the class, but implements it on the instance. That appears | ||
to be a bug. Redirect the error send to the instance side." | ||
|
||
^self current signalInitializationError! ! | ||
!TestResource class categoriesFor: #signalInitializationError!error handling!public! ! | ||
|
||
!TestSuite methodsFor! | ||
|
||
run | ||
"There appears to be a bug in the SUnit framework. If a resource is unavailable | ||
it throws an initializaion error but does NOT reset the resource. Therefore the | ||
current class variable doesn't get a chance to re-initialize itself. | ||
|
||
Changed so that the ensure: block is run if an initialization error occurs." | ||
|
||
| result | | ||
result := TestResult new. | ||
|
||
[self resources do: [:res | res isAvailable ifFalse: [^res signalInitializationError]]. | ||
self run: result] | ||
ensure: [self resources do: [:each | each reset]]. | ||
^result! ! | ||
!TestSuite categoriesFor: #run!public!Running! ! | ||
|
||
"End of package definition"! | ||
|
Oops, something went wrong.