#{fixture delete:'all', load:'data.yml' /} #{selenium 'Post a new job'} // Hop open('/') clearSession() // Must be on the default 'Development' category now assertText('css=a.selected', 'Development') assertTextPresent('Play developper wanted at Zenexity - Paris') assertTextPresent('PHP developper wanted at Google - Chicago') // Go to admin area open('@{Administration.index()}') assertTextPresent('Administration, login') type('email', 'jobs@zenexity.com') type('password', 'kiki') // Bad password clickAndWait('signin') assertTextPresent('Bad email or password') type('password', 'yop') clickAndWait('signin') // Should be logged now assertTextPresent('Zenexity') // Jobs page assertTextPresent('Jobs') assertTextPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 Jobs') // Try the column sort assertTable('css=#crudListTable table.2.0', 'Play developper wanted') assertTable('css=#crudListTable table.1.0', 'Java developper wanted') clickAndWait('link=Title') assertTable('css=#crudListTable table.2.0', 'Play developper wanted') assertTable('css=#crudListTable table.1.0', 'Java developper wanted') clickAndWait('link=Title') assertTable('css=#crudListTable table.1.0', 'Play developper wanted') assertTable('css=#crudListTable table.2.0', 'Java developper wanted') clickAndWait('link=Creation date*') assertTable('css=#crudListTable table.2.0', 'Play developper wanted') assertTable('css=#crudListTable table.1.0', 'Java developper wanted') clickAndWait('link=Creation date*') assertTable('css=#crudListTable table.1.0', 'Play developper wanted') assertTable('css=#crudListTable table.2.0', 'Java developper wanted') // Try the search box type('css=#crudListSearch input[type=text]', 'play') clickAndWait('css=#crudListSearch input[type=submit]') assertTextPresent('Play developper wanted') assertTextNotPresent('Java developper wanted') assertTextPresent('2 total') type('css=#crudListSearch input[type=text]', 'java') clickAndWait('css=#crudListSearch input[type=submit]') assertTextNotPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 total') type('css=#crudListSearch input[type=text]', 'zenexity') clickAndWait('css=#crudListSearch input[type=submit]') assertTextPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 total') type('css=#crudListSearch input[type=text]', 'yop') clickAndWait('css=#crudListSearch input[type=submit]') assertTextNotPresent('Play developper wanted') assertTextNotPresent('Java developper wanted') assertTextPresent('2 total') // Try the search box with sorting type('css=#crudListSearch input[type=text]', 'java') clickAndWait('css=#crudListSearch input[type=submit]') assertTextNotPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 total') clickAndWait('link=Title') assertTextNotPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 total') // Reset clickAndWait('link=*total*') assertTextPresent('Play developper wanted') assertTextPresent('Java developper wanted') assertTextPresent('2 Jobs') assertTextNotPresent('2 total') // Edit the first job clickAndWait('link=Play developper*') assertTextPresent('Edit Job') // Make a mistake select('object_category', '(Please select a value)') clickAndWait('css=input[name=_save]') assertText('css=span.error', 'Required') // Edit the job title and change tags select('object_category', 'Development') removeSelection('object_tags', 'Cool job') type('object_title', 'Search a Play developper') clickAndWait('css=input[name=_save]') // Set the second job online clickAndWait('link=Java developper*') check('object_online') clickAndWait('css=input[name=_save]') assertTextPresent('The Job has been saved') assertTextNotPresent('Offline') // Add a new job clickAndWait('link=Add Job') clickAndWait('css=input[name=_save]') assertText('css=span.error', 'Required') type('object_title', 'Another job') type('object_detail', 'Check our website') clickAndWait('css=input[name=_save]') assertText('css=span.error', 'Required') select('object_category', 'Development') addSelection('object_tags', 'Cool job') addSelection('object_tags', 'PHP') clickAndWait('css=input[name=_saveAndContinue]') assertElementNotPresent('css=span.error') assertTextPresent('has been created') check('object_online') clickAndWait('css=input[name=_save]') assertTextPresent('The Job has been saved') // Check list assertTextPresent('3 Jobs') assertTextNotPresent('Offline') // Edit the company profile clickAndWait('link=*Edit my company*') type('object_website', 'http://www.zenexity.fr') clickAndWait('css=input[name=_save]') // Back to home clickAndWait('link=*Home*') // Delete a job clickAndWait('link=Java developper*') clickAndWait('css=.crudDelete input') assertTextPresent('has been deleted') assertTextNotPresent('Java developper wanted') assertTextPresent('2 Jobs') // Check security open('@{Companies.show(999)}') assertTextPresent('Edit Company') assertValue('object_name', 'Zenexity') open('@{Tags.list()}') assertTextPresent('Jobs') // Logout clickAndWait('link=Logout') assertTextPresent('Administration, login') #{/selenium} #{selenium 'Check the modifications'} // Hop open('/') // Must be on the default 'Development' category now assertText('css=a.selected', 'Development') assertTextPresent('Search a Play developper at Zenexity - Paris') assertTextPresent('PHP developper wanted at Google - Chicago') assertTextPresent('Another job at Zenexity') // Tags clickAndWait('link=Cool*') assertTextPresent('Tagged with cool') assertTextPresent('Another job at Zenexity') assertTextPresent('PHP developper wanted at Google - Chicago') assertTextNotPresent('Search a Play developper at Zenexity - Paris') // Search type('keywords', 'another') clickAndWait('searchButton') assertTextPresent('1 job match your request.') assertTextPresent('Another job at Zenexity') #{/selenium}