From 9f7ab6e13b91ec335bc1ec4abdb9077f30f4d2be Mon Sep 17 00:00:00 2001 From: Felix SOEDJEDE Date: Thu, 21 Apr 2016 13:39:34 +0200 Subject: [PATCH] View item, create corpus & delete corpus --- spec/features/create_corpus.rb | 31 +++++++++++++++++++++++++++++++ spec/features/view_item.rb | 16 ++++++++++++++++ spec/spec_helper.rb | 5 +++++ 3 files changed, 52 insertions(+) create mode 100755 spec/features/create_corpus.rb create mode 100755 spec/features/view_item.rb mode change 100644 => 100755 spec/spec_helper.rb diff --git a/spec/features/create_corpus.rb b/spec/features/create_corpus.rb new file mode 100755 index 0000000..0d5cd80 --- /dev/null +++ b/spec/features/create_corpus.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +feature 'Corpus' do + + $corpus = a_string() + $user = 'alice' + $pass = 'lapinblanc' + + scenario 'do create' do + visit '/' + click_on 'Se connecter' + log_in_as $user, $pass + toggle_edit + click_plus_sign_next_to 'corpus' + click_last 'corpus' + type $corpus, :return + expect(page).to have_content($corpus) + toggle_edit + end + + scenario 'do delete' do + visit '/' + click_on 'Se connecter' + log_in_as $user, $pass + toggle_edit + click_del_sign_before $corpus, 'corpus' + expect(page).to have_content($corpus) + toggle_edit + end + +end \ No newline at end of file diff --git a/spec/features/view_item.rb b/spec/features/view_item.rb new file mode 100755 index 0000000..3658c90 --- /dev/null +++ b/spec/features/view_item.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +feature 'View Item' do + scenario 'search by topic' do + visit '/' + click_on 'Rechercher par thème' + in_dialog.click_on 'Nuage' + in_dialog.click_on 'B1. Conception et développement d\'applications' + in_dialog.click_on 'Sélectionner' + visit '/argos/viewpoint/A0A0A0A50Z0SD5S4DSDSDS' + expect(page).to have_content 'B1. Conception et développement' + click_on 'LO10 – Approches orientées services (UV)' + visit '/argos/item/A0A0A0A50Z0SD5S4DSDSDS/A0A0A0A50Z0SD5S4DSDSDS' + end + +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb old mode 100644 new mode 100755 index 87ddc79..f09ad19 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,7 @@ Capybara.run_server = false Capybara.default_driver = :poltergeist Capybara.app_host = "http://agorae.test.hypertopic.org" +Capybara.default_selector = :xpath $home_page = '/' @@ -26,6 +27,10 @@ def click_plus_sign_next_to(list) find(".#{list}-list .add").click end +def click_del_sign_before(item, list) + find('span', :text => "#{text}").find(:xpath, "..").find('.del').click +end + def click_last(list) find("##{list} li:last-child .editable").click end