WAAllTestsTest


SeasideTesting-Examples

Comment:



Hierarchy:

ProtoObject
Object
TestCase
SCComponentTestCase
WAAllTestsTest

Summary:

methods:

instance class
tests no messages

Detail:

instance methods:

tests
selectedComponent

	^self component contents selectedComponent
testButtons

	| form |
	self newApplicationWithRootClass: WAHtmlTest.
	self establishSession.
	form := self lastResponse formWithId: 'button-form'.
	self submitForm: form pressingButton: (form buttonWithValue: '5').
	self assert: self component number = 5.
	form := self lastResponse formWithId: 'button-form'.
	self submitForm: form pressingButton: (form buttonWithValue: '1').
	self assert: self component number = 1
testCheckbox

	| form |
	self newApplicationWithRootClass: WAHtmlTest.
	self establishSession.
	form := self lastResponse formWithId: 'checkbox-form'.
	(form checkboxWithId: 'cb-a') check.
	self submitForm: form pressingButton: form buttons first.
	self assert: self component booleanList first value.
	form := self lastResponse formWithId: 'checkbox-form'.
	(form checkboxWithId: 'cb-a') uncheck.
	self submitForm: form pressingButton: form buttons first.
	self deny: self component booleanList first value
testException

	| form |
	self newApplicationWithRootClass: WAExceptionTest.
	form := self establishSession forms first.
	self submitForm: form pressingButton: (form buttonWithValue: 'Yes').
	self 
		assert: (self lastResponse containsText: 'Caught:')
testNavigation

	| form |
	self newApplicationWithRootClass: WAAllTests.
	self establishSession.
	self followAnchor: (self lastResponse anchorWithLabel: 'Input').
	self assert: self selectedComponent class = WAInputTest.
	self assert: self selectedComponent integer = 42.
	form := self lastResponse forms first.
	form textInputWithId: 'nilString' value: 'bob'.
	self submitForm: form pressingButton: form buttons first.
	self assert: self selectedComponent nilString = 'bob'.
	self followAnchor: (self lastResponse anchorWithLabel: 'Html').
	self assert: self selectedComponent class = WAHtmlTest.
	form := self lastResponse formWithId: 'radio-form'.
	form activateRadioButtonWithId: 'a-on'.
	self submitForm: form pressingButton: form buttons first.
	self assert: self selectedComponent booleanList first value.
	form := self lastResponse formWithId: 'radio-form'.
	form activateRadioButtonWithId: 'a-off'.
	self submitForm: form pressingButton: form buttons first.
	self deny: self selectedComponent booleanList first value.
	self followAnchor: (self lastResponse anchorWithLabel: 'Parent').
	self assert: self selectedComponent class = WAParentTest.
	self followAnchor: (self lastResponse anchorWithLabel: 'swap parent').
	self 
		assert: self lastResponse bodyElement elements first contents first string 
				= 'foo'.
	self assert: (self lastResponse anchorWithLabel: 'Html') isNil.
	form := self lastResponse forms first.
	self submitForm: form pressingButton: form buttons first.
	self assert: (self lastResponse anchorWithLabel: 'Html') notNil
testSelect

	| form |
	self newApplicationWithRootClass: WAHtmlTest.
	self establishSession.
	form := self lastResponse formWithId: 'select-form'.
	(form selectListWithId: 'select-list') selectOptionWithText: '7'.
	self submitForm: form pressingButton: form buttons first.
	self assert: self component number = 7.
	form := self lastResponse formWithId: 'select-form'.
	self 
		should: [(form selectListWithId: 'select-list') selectOptionWithText: '15']
		raise: Error.
	(form selectListWithId: 'select-list') value: '2'.
	self submitForm: form pressingButton: form buttons first.
	self assert: self component number = 2.
	self assert: (form buttonWithValue: '22') isNil
testTextAreaInput

	| form |
	self newApplicationWithRootClass: WAHtmlTest.
	self establishSession.
	form := self lastResponse formWithId: 'textarea-form'.
	self assert: (form elementWithId: 'textarea-banner' containsText: 'Hello world!').
	self assert: self component message = 'Hello world!'.
	form textInputWithId: 'textarea-message' value: 'bob'.
	self submitForm: form pressingButton: form buttons first.
	form := self lastResponse formWithId: 'textarea-form'.
	self assert: (form elementWithId: 'textarea-banner' containsText: 'bob').
	self assert: self component message = 'bob'
testTextInput

	| form |
	self newApplicationWithRootClass: WAHtmlTest.
	self establishSession.
	form := self lastResponse formWithId: 'textInput-form'.
	self assert: (form elementWithId: 'textInput-banner' containsText: 'Hello world!').
	self assert: self component message = 'Hello world!'.
	form textInputWithId: 'text-message' value: 'bob'.
	self submitForm: form pressingButton: form buttons first.
	form := self lastResponse formWithId: 'textInput-form'.
	self assert: (form elementWithId: 'textInput-banner' containsText: 'bob').
	self assert: self component message = 'bob'

class methods:

^top


- made by Dandelion -