Commit aa7b94d850cda030893778ca85d5eac74e7d6077
Committed by
Paulo Meireles
1 parent
bf848e13
Exists in
master
and in
28 other branches
[Mezuro] Acceptance tests with selenium (pairing with noosfero)
Showing
3 changed files
with
39 additions
and
32 deletions
Show diff stats
features/step_definitions/mezuro_steps.rb
| ... | ... | @@ -32,3 +32,17 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message| |
| 32 | 32 | selenium.get_alert.should eql(message) |
| 33 | 33 | selenium.chooseOkOnNextConfirmation(); |
| 34 | 34 | end |
| 35 | + | |
| 36 | +Given /^the following Mezuro project$/ do |table| | |
| 37 | + table.hashes.map{|item| item.dup}.each do |item| | |
| 38 | + owner_identifier = item.delete("owner") | |
| 39 | + parent = item.delete("parent") | |
| 40 | + owner = Profile[owner_identifier] | |
| 41 | + item.merge!(:profile => owner) | |
| 42 | + result = MezuroPlugin::ProjectContent.new(item) | |
| 43 | + if !parent.blank? | |
| 44 | + result.parent = Article.find_by_name(parent) | |
| 45 | + end | |
| 46 | + result.save! | |
| 47 | + end | |
| 48 | +end | ... | ... |
features/step_definitions/noosfero_steps.rb
| ... | ... | @@ -761,3 +761,9 @@ Given /^there are no pending jobs$/ do |
| 761 | 761 | Delayed::Worker.new.work_off |
| 762 | 762 | end |
| 763 | 763 | end |
| 764 | + | |
| 765 | +When /^I confirm the "(.*)" dialog$/ do |confirmation| | |
| 766 | + a = page.driver.browser.switch_to.alert | |
| 767 | + assert_equal confirmation, a.text | |
| 768 | + a.accept | |
| 769 | +end | ... | ... |
plugins/mezuro/features/creating_project.feature
| 1 | -@mezuro | |
| 2 | 1 | Feature: Create project |
| 3 | 2 | As a mezuro user |
| 4 | 3 | I want to create a Mezuro project |
| ... | ... | @@ -15,40 +14,28 @@ Feature: Create project |
| 15 | 14 | And "Joao Silva" is admin of "My Community" |
| 16 | 15 | |
| 17 | 16 | Scenario: I see Mezuro project's input form |
| 18 | - Given I am on My Community's control panel | |
| 19 | - When I follow "Mezuro Project" | |
| 17 | + Given I am on mycommunity's control panel | |
| 18 | + When I follow "Mezuro project" | |
| 20 | 19 | Then I should see "Title" |
| 21 | - And I should see "License" | |
| 22 | - And I should see "Repository type" | |
| 23 | - And I should see "GIT" | |
| 24 | - And I should see "REMOTE_ZIP" | |
| 25 | - And I should see "REMOTE_TARBALL" | |
| 26 | - And I should see "SUBVERSION" | |
| 27 | - And I should see "Repository url" | |
| 28 | - And I should see "Configuration" | |
| 29 | - And I should see "Kalibro for Java" | |
| 20 | + And I should see "Description" | |
| 30 | 21 | |
| 31 | 22 | Scenario: I create a Mezuro project with valid attributes |
| 32 | - Given I am on My Community's control panel | |
| 23 | + Given I am on mycommunity's control panel | |
| 33 | 24 | When I create a Mezuro project with the following data |
| 34 | 25 | | Title | Sample Project | |
| 35 | - | License | GNU General Public License version 2.0 (GPL-2.0) | | |
| 36 | - | Repository type | SUBVERSION | | |
| 37 | - | Repository url | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | | |
| 38 | - | Configuration | Kalibro for Java | | |
| 26 | + | Description | Sample Description | | |
| 39 | 27 | Then I should see "Sample Project" |
| 40 | - And I should see "GNU General Public License version 2.0 (GPL-2.0)" | |
| 41 | - And I should see "SUBVERSION" | |
| 42 | - And I should see "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator" | |
| 43 | - And I should see "Kalibro for Java" | |
| 44 | - | |
| 45 | - Scenario: I can't create a Mezuro project with invalid attributes | |
| 46 | - Given I am on My Community's control panel | |
| 47 | - When I create a Mezuro project with the following data | |
| 48 | - | Title | | | |
| 49 | - | License | GNU General Public License version 2.0 (GPL-2.0) | | |
| 50 | - | Repository type | SUBVERSION | | |
| 51 | - | Repository url | | | |
| 52 | - | Configuration | Kalibro for Java | | |
| 53 | - Then I should see "The highlighted fields are mandatory." | |
| 54 | - And I should see "Repository URL is mandatory" | |
| 28 | + And I should see "Sample Description" | |
| 29 | + And I should see "Add Repository" | |
| 30 | + | |
| 31 | + @selenium | |
| 32 | + Scenario: I delete a Mezuro project | |
| 33 | + Given the following Mezuro project | |
| 34 | + | name | description | owner | | |
| 35 | + | Sample Project | Sample Description | joaosilva | | |
| 36 | + And I am on article "Sample Project" | |
| 37 | + And I should be on /joaosilva/sample-project | |
| 38 | + When I follow "Delete" | |
| 39 | + And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog | |
| 40 | + Then I go to /joaosilva/sample-project | |
| 41 | + And I should see "There is no such page: /joaosilva/sample-project" | ... | ... |