joomla-projects / webservices

Webservices working group repository
GNU General Public License v2.0
16 stars 9 forks source link

Automated tests for webservices #17

Closed javigomez closed 9 years ago

javigomez commented 9 years ago

This pull adds the Automated tests to check that webservices works.

closes #9

javigomez commented 9 years ago

closing since I need to set up travis first.

javigomez commented 9 years ago

To see in action check: https://travis-ci.org/joomla-projects/webservices/jobs/71989094

You will see the log with the tests checking the application com_contact webservices. Like:

screen shot 2015-07-21 at 19 51 48

In general what it does is:

javigomez commented 9 years ago

Closing, I need to fix a couple of things

javigomez commented 9 years ago

Finally! ^_^

Please check the log at https://travis-ci.org/joomla-projects/webservices/jobs/71989094

fastslack commented 9 years ago

@test OK under Linux, after link 'tests' directory to wwwroot, create a new database and edit the file tests/acceptance.suite.dist.yml for database credentials:

$ vendor/bin/robo run:tests
 [Exec] Running vendor/bin/phing -f extension_packager.xml autopack
Buildfile: /home/fastslack/mtwProjects/webservices.my/extension_packager.xml

com_webservices > autopack:

     [echo] Removing old autopack folder
   [delete] Deleting directory /home/fastslack/mtwProjects/webservices.my/.dist

com_webservices > prepare:

[xmlproperty] Loading /home/fastslack/mtwProjects/webservices.my/./webservices.xml
     [echo] Making directory to store the temporary packages at .tmp
    [mkdir] Created dir: /home/fastslack/mtwProjects/webservices.my/.tmp

com_webservices > build:

     [echo] Copying INSTALLER files to build directory...

com_webservices > copyframework:

     [echo] Copying webservices framework folder to build directory...
     [echo] Copying INSTALLER files to build directory...
     [copy] Copying 1 file to /home/fastslack/mtwProjects/webservices.my/.tmp/webservices
     [echo] Copying COMPONENT folder to build directory...
     [copy] Created 25 empty directories in /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/component
     [copy] Copying 42 files to /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/component
     [echo] Copying MEDIA folder to build directory...
     [copy] Created 6 empty directories in /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/media
     [copy] Copying 11 files to /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/media
    [mkdir] Created dir: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/packages
      [zip] Building zip: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/packages/com_webservices.zip
   [delete] Deleting directory /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/component
   [delete] Deleting directory /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/media
   [delete] Deleting: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/webservices.xml
     [copy] Copying 1 file to /home/fastslack/mtwProjects/webservices.my/.tmp/webservices
     [echo] Packaging libraries...
      [zip] Building zip: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/packages/lib_webservices.zip
     [echo] Packaging system webservices plugin to build directory...
      [zip] Building zip: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/packages/plg_sys_webservices.zip
      [zip] Building zip: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices/packages/plg_aut_redcore_oauth2.zip

com_webservices > dist:

     [echo] Creating ZIP archive...
      [zip] Building zip: /home/fastslack/mtwProjects/webservices.my/.tmp/webservices-v1.0.0.zip
     [copy] Copying 1 file to /home/fastslack/mtwProjects/webservices.my/.dist
     [echo] Files copied and compressed in build directory OK!
   [delete] Deleting directory /home/fastslack/mtwProjects/webservices.my/.tmp

BUILD FINISHED

Total time: 0.1550 seconds

 [Exec] Done in 0.197s
 [FileSystem\DeleteDir] Deleted tests/joomla-cms3...
 [Exec] Running git clone -b staging --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/joomla-cms3
Cloning into 'tests/joomla-cms3'...
 [Exec] Done in 14.347s
➜  Joomla CMS site created at tests/joomla-cms3
 [FileSystem\CopyDir] Copied from /home/fastslack/mtwProjects/webservices.my/.dist to /home/fastslack/mtwProjects/webservices.my/tests/joomla-cms3/package
 [Composer\Install] Installing Packages: php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
 [Composer\Install] Done in 0.327s
 [Exec] Running java -jar selenium-server-standalone.jar >> selenium.log 2>&1 &
 [Exec] Done in 0.001s
 [joomla_projects\robo\WaitForSeleniumStandaloneServer] Waiting for Selenium Standalone server to launch
 [joomla_projects\robo\WaitForSeleniumStandaloneServer] Done in 0.012s
 [Exec] Running vendor/bin/codecept build
Building Actor classes for suites: acceptance, api
 -> AcceptanceTesterActions.php generated successfully. 0 methods added
\AcceptanceTester includes modules: JoomlaBrowser, \Helper\Acceptance
 -> ApiTesterActions.php generated successfully. 0 methods added
\ApiTester includes modules: \Helper\Api, REST, PhpBrowser
 [Exec] Done in 0.069s
 [Testing\Codecept] Executing vendor/bin/codecept run --steps --debug --fail-fast tests/acceptance/install/
Codeception PHP Testing Framework v2.1.1
Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

Acceptance Tests (2) -----------------------------------------------------------
Modules: JoomlaBrowser, \Helper\Acceptance
--------------------------------------------------------------------------------
Test Joomla 3 Installation (01-InstallJoomlaCept)
Scenario:
* I install joomla 

  I open Joomla Installation Configuration Page
  [GET] http://localhost/tests/joomla-cms3/installation/index.php
  I check that FTP tab is not present in installation. Otherwise it means that I have not enough permissions to install joomla and execution will be stoped
  I wait for Main Configuration
  I select en-GB as installation language
  I open the #jform_language chosen selector
  I select English (United Kingdom)
  I fill Site Name
  I fill Site Description
  I fill Admin Email
  I fill Admin Username
  I fill Admin Password
  I fill Admin Password Confirmation
  I click Site Offline: no
  I click Next
  I Fill the form for creating the Joomla site Database
  I select MySQLi
  I fill Database Host
  I fill Database User
  I fill Database Password
  I fill Database Name
  I fill Database Prefix
  I click Remove Old Database 
  Trying to select the Remove from the Old Database Process
  I click Next
  I wait Joomla to remove the old database if exist
  I install joomla with or without sample data
  I wait for Joomla being installed
* I do administrator login 
  I open Joomla Administrator Login Page
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I set error reporting to development 
  I open Joomla Global Configuration Page
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_config
  I wait for Global Configuration title
  I open the Server Tab
  I wait for error reporting dropdown
  I open the Error Reporting chosen selector
  I select Development
  I click on save
  I wait for global configuration being saved
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test Webservices installation in Joomla 3 (02-InstallExtensionCept)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I get configuration "package_url"
* I install extension from url "http://localhost/tests/joomla-cms3/package/webservices-v1.0.0.zip"
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_installer
  I enter the url
  Extension successfully installed from http://localhost/tests/joomla-cms3/package/webservices-v1.0.0.zip
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------------------------------------------------------

Time: 12.68 seconds, Memory: 11.50Mb

OK (2 tests, 2 assertions)
 [Testing\Codecept] Done in 12.715s
 [Testing\Codecept] Executing vendor/bin/codecept run --steps --debug --fail-fast tests/acceptance/administrator/
Codeception PHP Testing Framework v2.1.1
Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

  Group 'failed' is empty, no tests are loaded

Acceptance Tests (1) -----------------------------------------------------------
Modules: JoomlaBrowser, \Helper\Acceptance
--------------------------------------------------------------------------------
Test Activate the (ActivateDefaultWebservicesWithBasicAuthenticationCept)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I enable basic authentication
* I am on page "administrator/index.php?option=com_plugins"
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_plugins
* I wait for text "Plugin Manager: Plugins",30,{"css":"H1"}
* I enable plugin "Webservices - System plugin"
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_plugins
  I check for Notices and Warnings
  Searching for Webservices - System plugin
  Verifying if Webservices - System plugin exist in search result
* I search for item "Webservices - System plugin"
  Searching for Webservices - System plugin
* I click {"link":"Webservices - System plugin"}
* I wait for text "Plugin Manager: Webservices - System plugin",30,{"css":"H1"}
* I select option in chosen "Enable webservices","Yes"
  I open the Enable webservices chosen selector
  I select Yes
* I select option in chosen "Check user permission against","Joomla - Use already defined authorization checks in Joomla"
  I open the Check user permission against chosen selector
  I select Joomla - Use already defined authorization checks in Joomla
* I click {"xpath":"//div[@id='toolbar-apply']/button"}
* I wait for text "Plugin successfully saved.",30,{"id":"system-message-container"}
* I click {"xpath":"//div[@id='toolbar-cancel']/button"}
* I wait for element {"link":"Webservices - System plugin"},30
* I am on page "administrator/index.php?option=com_webservices"
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_webservices
* I wait for text "Webservice Manager",30,{"css":"H1"}
* I click {"class":"lc-not_installed_webservices"}
* I click {"class":"lc-install_all_webservices"}
* I wait for element {"id":"mainComponentWebservices"},30
* I see "administrator.contact.1.0.0.xml",{"class":"lc-webservice-file"}
* I see "site.contact.1.0.0.xml",{"class":"lc-webservice-file"}
* I see "site.users.1.0.0.xml",{"class":"lc-webservice-file"}
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------------------------------------------------------

Time: 9.55 seconds, Memory: 11.75Mb

OK (1 test, 8 assertions)
 [Testing\Codecept] Done in 9.58s
 [Testing\Codecept] Executing vendor/bin/codecept run --steps --debug --fail-fast api
Codeception PHP Testing Framework v2.1.1
Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

  Group 'failed' is empty, no tests are loaded
  Rebuilding ApiTester...

Api Tests (4) ------------------------------------------------------------------
Modules: \Helper\Api, REST, PhpBrowser
--------------------------------------------------------------------------------
Check the availabilit (AdministratorContacts1Cest::WebserviceIsAvailable)
Scenario:
* I am http authenticated "admin","admin"
* I send get "index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0"

  [Request headers] []
  [Request] GET http://localhost/tests/joomla-cms3/index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:first":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limitstart]=0&api=Hal","title":"Pagination first"},"contact:previous":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limitstart]=0&api=Hal","title":"Pagination previous"},"contact:next":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limitstart]=0&api=Hal","title":"Pagination next"},"contact:last":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limitstart]=0&api=Hal","title":"Pagination last"},"contact:all":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limit]=0&api=Hal","title":"Show all items"},"contact:limit":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[limit]={limit}&list[limitstart]={limitstart}&api=Hal","title":"List limit","templated":true},"contact:filter":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&filter[search]={filter_search}&api=Hal","title":"Filter list","templated":true},"contact:sort":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&list[ordering]={filter_order}&list[direction]={filter_order_Dir}&api=Hal","title":"List sort","templated":true}},"page":1,"pageLimit":20,"limitstart":0,"totalItems":0,"totalPages":1}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Set-Cookie":["cef349f6450bda192eea54ca94e34beb=v10rlkct6q2gs0kid6lc0dels6; path=/; HttpOnly"],"Status":["200 OK"],"X-Runtime":["0.069237947463989"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["2289"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 200
* I see response code is 200
* I see response is json 
* I see http header "Webservice name","contact"
* I see http header "Webservice version","1.0.0"
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
POST a new Contact in com_contacts (AdministratorContacts1Cest::create)
Scenario:
* I am http authenticated "admin","admin"
* I send post "index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&name=contact425&catid=4"

  [Request headers] []
  [Request] POST http://localhost/tests/joomla-cms3/index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&name=contact425&catid=4 []
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:list":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal"}},"result":true}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Set-Cookie":["cef349f6450bda192eea54ca94e34beb=7bniifqb9aesk37fu0pgn7iqd3; path=/; HttpOnly"],"Status":["201 Created"],"X-Runtime":["0.071761846542358"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["677"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 201
* I see response code is 201
* I see response is json 
* I grab data from response by json path "$._links"
* I send get "http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal"
  [Request headers] []
  [Request] GET http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal"},"contact:list":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"contact:checkout":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkout&api=Hal"},"contact:checkin":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkin&api=Hal"},"contact:featured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=featured&api=Hal"},"contact:unfeatured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unfeatured&api=Hal"},"contact:publish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=publish&api=Hal"},"contact:unpublish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unpublish&api=Hal"}},"id":1,"name":"contact425","alias":"","con_position":"","address":"","suburb":"","state":"","country":"","postcode":"","telephone":"","fax":"","misc":"","image":"","email_to":"","default_con":0,"published":1,"checked_out":0,"checked_out_time":"","ordering":0,"params":"[]","user_id":0,"catid":4,"access":1,"mobile":"","webpage":"","sortname1":"","sortname2":"","sortname3":"","language":"*","created":"","created_by":0,"modified":"","modified_by":0,"metakey":"","metadesc":"","metadata":"","featured":0,"publish_up":"","publish_down":"","version":"1","hits":0}
  [Cookies] {"cef349f6450bda192eea54ca94e34beb":"7bniifqb9aesk37fu0pgn7iqd3"}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Status":["200 OK"],"X-Runtime":["0.068657159805298"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["2281"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 200
* I see response code is 200
* I see response is json 
* I grab data from response by json path "$.id"
* The id of the new created contact with name 'contact425' is: 1
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET an existing Contact (AdministratorContacts1Cest::readItem)
Scenario:
* I am http authenticated "admin","admin"
* I send get "index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1"

  [Request headers] []
  [Request] GET http://localhost/tests/joomla-cms3/index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal"},"contact:list":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"contact:checkout":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkout&api=Hal"},"contact:checkin":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkin&api=Hal"},"contact:featured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=featured&api=Hal"},"contact:unfeatured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unfeatured&api=Hal"},"contact:publish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=publish&api=Hal"},"contact:unpublish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unpublish&api=Hal"}},"id":1,"name":"contact425","alias":"","con_position":"","address":"","suburb":"","state":"","country":"","postcode":"","telephone":"","fax":"","misc":"","image":"","email_to":"","default_con":0,"published":1,"checked_out":0,"checked_out_time":"","ordering":0,"params":"[]","user_id":0,"catid":4,"access":1,"mobile":"","webpage":"","sortname1":"","sortname2":"","sortname3":"","language":"*","created":"","created_by":0,"modified":"","modified_by":0,"metakey":"","metadesc":"","metadata":"","featured":0,"publish_up":"","publish_down":"","version":"1","hits":0}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Set-Cookie":["cef349f6450bda192eea54ca94e34beb=4bdifnkpnflee8dppljtsjlum7; path=/; HttpOnly"],"Status":["200 OK"],"X-Runtime":["0.068624019622803"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["2281"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 200
* I see response code is 200
* I see response is json 
* I see response contains ""name":"contact425""
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Update a new Contact in com_contacts (AdministratorContacts1Cest::update)
Scenario:
* I am http authenticated "admin","admin"
* I send put "index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1&name=new_contact425&catid=4"

  [Request headers] []
  [Request] PUT http://localhost/tests/joomla-cms3/index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1&name=new_contact425&catid=4 []
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:list":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id={id}&api=Hal"}},"result":true}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Set-Cookie":["cef349f6450bda192eea54ca94e34beb=r72gcocliso3vn5hpvjv0shki5; path=/; HttpOnly"],"Status":["200 OK"],"X-Runtime":["0.075021982192993"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["680"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 200
* I see response code is 200
* I send get "index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1"
  [Request headers] []
  [Request] GET http://localhost/tests/joomla-cms3/index.php?option=contact&api=Hal&webserviceClient=administrator&webserviceVersion=1.0.0&id=1
  [Response] {"_links":{"curies":[{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&format=doc&api=Hal#{rel}","title":"Documentation","name":"contact","templated":true}],"base":{"href":"http://localhost/tests/joomla-cms3/?webserviceClient=administrator&api=Hal","title":"Default page"},"contact:self":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&api=Hal"},"contact:list":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&api=Hal"},"contact:checkout":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkout&api=Hal"},"contact:checkin":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=checkin&api=Hal"},"contact:featured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=featured&api=Hal"},"contact:unfeatured":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unfeatured&api=Hal"},"contact:publish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=publish&api=Hal"},"contact:unpublish":{"href":"http://localhost/tests/joomla-cms3/index.php?option=com_contact&webserviceVersion=1.0.0&webserviceClient=administrator&id=1&task=unpublish&api=Hal"}},"id":1,"name":"new_contact425","alias":"","con_position":"","address":"","suburb":"","state":"","country":"","postcode":"","telephone":"","fax":"","misc":"","image":"","email_to":"","default_con":0,"published":1,"checked_out":0,"checked_out_time":"","ordering":0,"params":"[]","user_id":0,"catid":4,"access":1,"mobile":"","webpage":"","sortname1":"","sortname2":"","sortname3":"","language":"*","created":"","created_by":0,"modified":"","modified_by":0,"metakey":"","metadesc":"","metadata":"","featured":0,"publish_up":"","publish_down":"","version":"1","hits":0}
  [Cookies] {"cef349f6450bda192eea54ca94e34beb":"r72gcocliso3vn5hpvjv0shki5"}
  [Headers] {"Date":["Wed, 22 Jul 2015 06:34:51 GMT"],"Server":["Apache/2.4.7 (Ubuntu)"],"X-Powered-By":["PHP/5.5.9-1ubuntu4.11"],"Status":["200 OK"],"X-Runtime":["0.087671041488647"],"Access-Control-Allow-Origin":["*"],"Pragma":["public"],"Expires":["0"],"Cache-Control":["private"],"Webservice name":["contact"],"Webservice version":["1.0.0"],"Content-Length":["2285"],"Content-Type":["application/hal+json; charset=UTF-8"]}
  [Status] 200
* I see response code is 200
* I see response is json 
* I see response contains ""name":"new_contact425""
* The contact name has been modified to: new_contact425
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------------------------------------------------------

Time: 696 ms, Memory: 12.25Mb

OK (4 tests, 15 assertions)
 [Testing\Codecept] Done in 0.729s
 [Testing\Codecept] Executing vendor/bin/codecept run --steps --debug --fail-fast tests/acceptance/uninstall/
Codeception PHP Testing Framework v2.1.1
Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

  Group 'failed' is empty, no tests are loaded

Acceptance Tests (1) -----------------------------------------------------------
Modules: JoomlaBrowser, \Helper\Acceptance
--------------------------------------------------------------------------------
Uninstall Webservices Extension (ZZ-UninstallExtensionCept)
Scenario:
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I am on page "/administrator/index.php?option=com_installer&view=manage"
  [GET] http://localhost/tests/joomla-cms3/administrator/index.php?option=com_installer&view=manage
* I wait for text "Extension Manager: Manage",30,{"css":"H1"}
* I search for item "Webservices package"
  Searching for Webservices package
* I wait for element {"id":"manageList"}
* I check all results 
  Selecting Checkall button
* I click {"xpath":"//div[@id='toolbar-delete']/button"}
* I wait for element {"id":"system-message-container"},30
* I see "Uninstalling the package was successful.",{"id":"system-message-container"}
* I search for item "Webservices package"
  Searching for Webservices package
* I wait for element {"class":"alert-no-items"},30
* I see "There are no extensions installed matching your query.",{"class":"alert-no-items"}
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------------------------------------------------------

Time: 4.33 seconds, Memory: 10.75Mb

OK (1 test, 2 assertions)
 [Testing\Codecept] Done in 4.368s
 [Exec] Running curl http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     4    0     4    0     0    532      0 --:--:-- --:--:-- --:--:--   571OKOK
 [Exec] Done in 0.013s
javigomez commented 9 years ago

Great! thanks Matias for testing ^_^

javigomez commented 9 years ago

The pull joomla/joomla-cms#7490 added several changes in strings that prevents the tests to execute. This last commit updates the tests.

javigomez commented 9 years ago

I'm closing this pull since it won't work after #18 merge. I will reopen again once updated.

wilsonge commented 9 years ago

Javier see if #20 allows the tests to run please

javigomez commented 9 years ago

super! thanks George. I will check as soon as possible.

javigomez commented 8 years ago

the tests here have been added to pull #22.