sandoz.bbmb.ch 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +7 -0
 - data/.travis.yml +26 -0
 - data/Gemfile +12 -0
 - data/History.txt +6 -0
 - data/LICENSE +339 -0
 - data/Rakefile +21 -0
 - data/doc/index.rbx +14 -0
 - data/doc/resources/activex/BbmbBarcodeReader.CAB +0 -0
 - data/doc/resources/activex/BbmbBarcodeReader2.CAB +0 -0
 - data/doc/resources/bbmb.css +301 -0
 - data/doc/resources/errors/appdown.html +14 -0
 - data/doc/resources/javascript/bcreader.js +131 -0
 - data/doc/resources/javascript/order.js +65 -0
 - data/doc/resources/javascript/widget/ContentToggler.js +60 -0
 - data/doc/resources/javascript/widget/__package__.js +2 -0
 - data/doc/resources/javascript/widget/templates/ContentToggler.html +4 -0
 - data/doc/resources/logo.png +0 -0
 - data/lib/bbmb/html/util/lookandfeel.rb +202 -0
 - data/lib/bbmb/sandoz.rb +4 -0
 - data/lib/bbmb/sandoz/html/state/viral/customer.rb +25 -0
 - data/lib/bbmb/sandoz/version.rb +5 -0
 - data/lib/bbmb/util/csv_importer.rb +123 -0
 - data/readme.md +28 -0
 - data/sandoz.bbmb.ch.gemspec +45 -0
 - data/test/rcov +2 -0
 - data/test/selenium.rb +1687 -0
 - data/test/selenium/selenium-server.jar +0 -0
 - data/test/selenium/test_current_order.rb +336 -0
 - data/test/selenium/test_customer.rb +363 -0
 - data/test/selenium/test_customers.rb +92 -0
 - data/test/selenium/test_favorites.rb +257 -0
 - data/test/selenium/test_favorites_result.rb +81 -0
 - data/test/selenium/test_history.rb +112 -0
 - data/test/selenium/test_login.rb +112 -0
 - data/test/selenium/test_orders.rb +111 -0
 - data/test/selenium/test_result.rb +157 -0
 - data/test/selenium/unit.rb +146 -0
 - data/test/stub/http_server.rb +140 -0
 - data/test/stub/persistence.rb +58 -0
 - data/test/suite.rb +15 -0
 - data/test/util/data/Artikel.TXT +50 -0
 - data/test/util/data/Kunden.TXT +14 -0
 - data/test/util/test_csv_importer.rb +136 -0
 - metadata +414 -0
 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,336 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Selenium::TestCurrentOrder -- bbmb.ch -- 22.09.2006 -- hwyss@ywesee.com
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            $: << File.expand_path('..', File.dirname(__FILE__))
         
     | 
| 
      
 5 
     | 
    
         
            +
            $: << File.expand_path('../lib', File.dirname(__FILE__))
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'selenium/unit'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module BBMB
         
     | 
| 
      
 10 
     | 
    
         
            +
              module Selenium
         
     | 
| 
      
 11 
     | 
    
         
            +
            class TestCurrentOrder < Test::Unit::TestCase
         
     | 
| 
      
 12 
     | 
    
         
            +
              include Selenium::TestCase
         
     | 
| 
      
 13 
     | 
    
         
            +
              def test_current_order__empty
         
     | 
| 
      
 14 
     | 
    
         
            +
                user = login_customer
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 16 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 17 
     | 
    
         
            +
                assert @selenium.is_text_present("Sie sind angemeldet als test.customer@bbmb.ch")
         
     | 
| 
      
 18 
     | 
    
         
            +
                assert @selenium.is_element_present("file_chooser")
         
     | 
| 
      
 19 
     | 
    
         
            +
                assert @selenium.is_element_present("order_transfer")
         
     | 
| 
      
 20 
     | 
    
         
            +
                assert_equal "Datei zu Best.", @selenium.get_value("order_transfer")
         
     | 
| 
      
 21 
     | 
    
         
            +
                assert @selenium.is_element_present("query")
         
     | 
| 
      
 22 
     | 
    
         
            +
                assert @selenium.is_element_present("//input[@name='search']")
         
     | 
| 
      
 23 
     | 
    
         
            +
                assert_equal "Suchen", @selenium.get_value("//input[@name='search']")
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
              def test_current_order__with_position
         
     | 
| 
      
 26 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 27 
     | 
    
         
            +
                product = Model::Product.new('12345')
         
     | 
| 
      
 28 
     | 
    
         
            +
                product.description.de = 'product - a description'
         
     | 
| 
      
 29 
     | 
    
         
            +
                product.price = Util::Money.new(11.50)
         
     | 
| 
      
 30 
     | 
    
         
            +
                product.l1_price = Util::Money.new(12.50)
         
     | 
| 
      
 31 
     | 
    
         
            +
                product.l1_qty = 2
         
     | 
| 
      
 32 
     | 
    
         
            +
                product.l2_price = Util::Money.new(13.50)
         
     | 
| 
      
 33 
     | 
    
         
            +
                product.l2_qty = 3
         
     | 
| 
      
 34 
     | 
    
         
            +
                email = 'test.customer@bbmb.ch'
         
     | 
| 
      
 35 
     | 
    
         
            +
                customer = Model::Customer.new('007')
         
     | 
| 
      
 36 
     | 
    
         
            +
                customer.instance_variable_set('@email', email)
         
     | 
| 
      
 37 
     | 
    
         
            +
                customer.current_order.add(15, product)
         
     | 
| 
      
 38 
     | 
    
         
            +
                user = login_customer(customer)
         
     | 
| 
      
 39 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 40 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 41 
     | 
    
         
            +
                assert @selenium.is_text_present("Sie sind angemeldet als test.customer@bbmb.ch")
         
     | 
| 
      
 42 
     | 
    
         
            +
                assert @selenium.is_element_present("file_chooser")
         
     | 
| 
      
 43 
     | 
    
         
            +
                assert @selenium.is_element_present("order_transfer")
         
     | 
| 
      
 44 
     | 
    
         
            +
                assert_equal "Datei zu Best.", @selenium.get_value("order_transfer")
         
     | 
| 
      
 45 
     | 
    
         
            +
                assert @selenium.is_element_present("clear_order")
         
     | 
| 
      
 46 
     | 
    
         
            +
                assert_equal "Bestellung löschen", @selenium.get_value("clear_order")
         
     | 
| 
      
 47 
     | 
    
         
            +
                assert @selenium.is_text_present("2 Stk. à 12.50")
         
     | 
| 
      
 48 
     | 
    
         
            +
                assert @selenium.is_text_present("3 Stk. à 13.50")
         
     | 
| 
      
 49 
     | 
    
         
            +
                assert @selenium.is_element_present("reference")
         
     | 
| 
      
 50 
     | 
    
         
            +
                assert @selenium.is_element_present("comment")
         
     | 
| 
      
 51 
     | 
    
         
            +
                assert @selenium.is_element_present("document.forms[3].priority")
         
     | 
| 
      
 52 
     | 
    
         
            +
                assert @selenium.is_element_present("commit")
         
     | 
| 
      
 53 
     | 
    
         
            +
                assert_equal "Bestellung auslösen", @selenium.get_value("commit")
         
     | 
| 
      
 54 
     | 
    
         
            +
                assert @selenium.is_text_present("Total Sfr.")
         
     | 
| 
      
 55 
     | 
    
         
            +
                assert @selenium.is_element_present("total")
         
     | 
| 
      
 56 
     | 
    
         
            +
                assert_equal "202.50", @selenium.get_text("total")
         
     | 
| 
      
 57 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[6]"
         
     | 
| 
      
 58 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 59 
     | 
    
         
            +
                assert_equal "252.50", @selenium.get_text("total")
         
     | 
| 
      
 60 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[5]"
         
     | 
| 
      
 61 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 62 
     | 
    
         
            +
                assert_equal "282.50", @selenium.get_text("total")
         
     | 
| 
      
 63 
     | 
    
         
            +
                @selenium.refresh
         
     | 
| 
      
 64 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 65 
     | 
    
         
            +
                assert_equal "on", @selenium.get_value("document.forms[3].priority[5]")
         
     | 
| 
      
 66 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[4]"
         
     | 
| 
      
 67 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 68 
     | 
    
         
            +
                assert_equal "202.50", @selenium.get_text("total")
         
     | 
| 
      
 69 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[3]"
         
     | 
| 
      
 70 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 71 
     | 
    
         
            +
                assert_equal "202.50", @selenium.get_text("total")
         
     | 
| 
      
 72 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[2]"
         
     | 
| 
      
 73 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 74 
     | 
    
         
            +
                assert_equal "202.50", @selenium.get_text("total")
         
     | 
| 
      
 75 
     | 
    
         
            +
                @selenium.click "document.forms[3].priority[1]"
         
     | 
| 
      
 76 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 77 
     | 
    
         
            +
                assert_equal "202.50", @selenium.get_text("total")
         
     | 
| 
      
 78 
     | 
    
         
            +
            =begin # works, but throws an error when run with other tests, reason unclear
         
     | 
| 
      
 79 
     | 
    
         
            +
                @selenium.choose_cancel_on_next_confirmation
         
     | 
| 
      
 80 
     | 
    
         
            +
                @selenium.click("clear_order")
         
     | 
| 
      
 81 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 82 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 83 
     | 
    
         
            +
                assert_equal "Wollen Sie wirklich die gesamte Bestellung löschen?",
         
     | 
| 
      
 84 
     | 
    
         
            +
                             @selenium.get_confirmation
         
     | 
| 
      
 85 
     | 
    
         
            +
                @selenium.click("clear_order")
         
     | 
| 
      
 86 
     | 
    
         
            +
            =end
         
     | 
| 
      
 87 
     | 
    
         
            +
                @selenium.open('/de/clear_order') # <- workaround
         
     | 
| 
      
 88 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 89 
     | 
    
         
            +
                @selenium.choose_cancel_on_next_confirmation
         
     | 
| 
      
 90 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 91 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
              def test_current_order__commit
         
     | 
| 
      
 94 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 95 
     | 
    
         
            +
                product = Model::Product.new('12345')
         
     | 
| 
      
 96 
     | 
    
         
            +
                product.description.de = 'product - a description'
         
     | 
| 
      
 97 
     | 
    
         
            +
                product.price = Util::Money.new(11.50)
         
     | 
| 
      
 98 
     | 
    
         
            +
                product.l1_price = Util::Money.new(12.50)
         
     | 
| 
      
 99 
     | 
    
         
            +
                product.l1_qty = 2
         
     | 
| 
      
 100 
     | 
    
         
            +
                product.l2_price = Util::Money.new(13.50)
         
     | 
| 
      
 101 
     | 
    
         
            +
                product.l2_qty = 3
         
     | 
| 
      
 102 
     | 
    
         
            +
                email = 'test.customer@bbmb.ch'
         
     | 
| 
      
 103 
     | 
    
         
            +
                customer = Model::Customer.new('007')
         
     | 
| 
      
 104 
     | 
    
         
            +
                customer.instance_variable_set('@email', email)
         
     | 
| 
      
 105 
     | 
    
         
            +
                current = customer.current_order
         
     | 
| 
      
 106 
     | 
    
         
            +
                current.add(15, product)
         
     | 
| 
      
 107 
     | 
    
         
            +
                user = login_customer(customer)
         
     | 
| 
      
 108 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 109 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 110 
     | 
    
         
            +
                assert @selenium.is_text_present("Sie sind angemeldet als test.customer@bbmb.ch")
         
     | 
| 
      
 111 
     | 
    
         
            +
                assert @selenium.is_element_present("commit")
         
     | 
| 
      
 112 
     | 
    
         
            +
                assert_equal "Bestellung auslösen", @selenium.get_value("commit")
         
     | 
| 
      
 113 
     | 
    
         
            +
                assert @selenium.is_element_present("accept_terms")
         
     | 
| 
      
 114 
     | 
    
         
            +
                @selenium.click "commit"
         
     | 
| 
      
 115 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 116 
     | 
    
         
            +
                assert @selenium.is_text_present("Bitte akzeptieren Sie die Allgemeinen Geschäftsbedingungen (\"AGB\") der Sandoz Pharmaceuticals AG, vgl. unten.")
         
     | 
| 
      
 117 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 118 
     | 
    
         
            +
                assert @selenium.is_element_present("commit")
         
     | 
| 
      
 119 
     | 
    
         
            +
                assert_equal "Bestellung auslösen", @selenium.get_value("commit")
         
     | 
| 
      
 120 
     | 
    
         
            +
                @selenium.click "accept_terms"
         
     | 
| 
      
 121 
     | 
    
         
            +
                flexstub(BBMB::Util::Mail).should_receive(:send_order).and_return { |order|
         
     | 
| 
      
 122 
     | 
    
         
            +
                  assert_equal(current, order)
         
     | 
| 
      
 123 
     | 
    
         
            +
                  assert_equal(1, order.commit_id)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  assert_not_nil(order.commit_time)
         
     | 
| 
      
 125 
     | 
    
         
            +
                }
         
     | 
| 
      
 126 
     | 
    
         
            +
                @selenium.click "commit"
         
     | 
| 
      
 127 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 128 
     | 
    
         
            +
                assert @selenium.is_text_present("Ihre Bestellung wurde an die Sandoz AG versandt.")
         
     | 
| 
      
 129 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 130 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 131 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 132 
     | 
    
         
            +
                @selenium.click "link=Archiv"
         
     | 
| 
      
 133 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 134 
     | 
    
         
            +
                assert_equal "BBMB | Archiv", @selenium.get_title
         
     | 
| 
      
 135 
     | 
    
         
            +
                assert @selenium.is_text_present(Date.today.strftime('%d.%m.%Y'))
         
     | 
| 
      
 136 
     | 
    
         
            +
                assert @selenium.is_text_present("202.50")
         
     | 
| 
      
 137 
     | 
    
         
            +
              end
         
     | 
| 
      
 138 
     | 
    
         
            +
              def test_current_order__commit__error
         
     | 
| 
      
 139 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 140 
     | 
    
         
            +
                product = Model::Product.new('12345')
         
     | 
| 
      
 141 
     | 
    
         
            +
                product.description.de = 'product - a description'
         
     | 
| 
      
 142 
     | 
    
         
            +
                product.price = Util::Money.new(11.50)
         
     | 
| 
      
 143 
     | 
    
         
            +
                product.l1_price = Util::Money.new(12.50)
         
     | 
| 
      
 144 
     | 
    
         
            +
                product.l1_qty = 2
         
     | 
| 
      
 145 
     | 
    
         
            +
                product.l2_price = Util::Money.new(13.50)
         
     | 
| 
      
 146 
     | 
    
         
            +
                product.l2_qty = 3
         
     | 
| 
      
 147 
     | 
    
         
            +
                email = 'test.customer@bbmb.ch'
         
     | 
| 
      
 148 
     | 
    
         
            +
                customer = Model::Customer.new('007')
         
     | 
| 
      
 149 
     | 
    
         
            +
                customer.instance_variable_set('@email', email)
         
     | 
| 
      
 150 
     | 
    
         
            +
                current = customer.current_order
         
     | 
| 
      
 151 
     | 
    
         
            +
                current.add(15, product)
         
     | 
| 
      
 152 
     | 
    
         
            +
                user = login_customer(customer)
         
     | 
| 
      
 153 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 154 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 155 
     | 
    
         
            +
                assert @selenium.is_text_present("Sie sind angemeldet als test.customer@bbmb.ch")
         
     | 
| 
      
 156 
     | 
    
         
            +
                assert @selenium.is_element_present("commit")
         
     | 
| 
      
 157 
     | 
    
         
            +
                assert_equal "Bestellung auslösen", @selenium.get_value("commit")
         
     | 
| 
      
 158 
     | 
    
         
            +
                assert @selenium.is_element_present("accept_terms")
         
     | 
| 
      
 159 
     | 
    
         
            +
                @selenium.click "accept_terms"
         
     | 
| 
      
 160 
     | 
    
         
            +
                mail = flexstub(BBMB::Util::Mail)
         
     | 
| 
      
 161 
     | 
    
         
            +
                mail.should_receive(:send_order).and_return { |order|
         
     | 
| 
      
 162 
     | 
    
         
            +
                  raise "some error"
         
     | 
| 
      
 163 
     | 
    
         
            +
                }
         
     | 
| 
      
 164 
     | 
    
         
            +
                mail.should_receive(:notify_error).with(RuntimeError).times(1)
         
     | 
| 
      
 165 
     | 
    
         
            +
                @selenium.click "commit"
         
     | 
| 
      
 166 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 167 
     | 
    
         
            +
                assert @selenium.is_text_present("Ihre Bestellung wurde an die Sandoz AG versandt.")
         
     | 
| 
      
 168 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 169 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 170 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 171 
     | 
    
         
            +
                @selenium.click "link=Archiv"
         
     | 
| 
      
 172 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 173 
     | 
    
         
            +
                assert_equal "BBMB | Archiv", @selenium.get_title
         
     | 
| 
      
 174 
     | 
    
         
            +
                assert @selenium.is_text_present(Date.today.strftime('%d.%m.%Y'))
         
     | 
| 
      
 175 
     | 
    
         
            +
                assert @selenium.is_text_present("202.50")
         
     | 
| 
      
 176 
     | 
    
         
            +
              end
         
     | 
| 
      
 177 
     | 
    
         
            +
              def test_current_order__transfer_dat
         
     | 
| 
      
 178 
     | 
    
         
            +
                datadir = File.expand_path('data', File.dirname(__FILE__))
         
     | 
| 
      
 179 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 180 
     | 
    
         
            +
                user = login_customer
         
     | 
| 
      
 181 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 182 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 183 
     | 
    
         
            +
                assert @selenium.is_element_present("file_chooser")
         
     | 
| 
      
 184 
     | 
    
         
            +
                assert @selenium.is_element_present("order_transfer")
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                src = <<-EOS
         
     | 
| 
      
 187 
     | 
    
         
            +
            030201899    0624427Mycolog creme tube 15 g                           000176803710902940
         
     | 
| 
      
 188 
     | 
    
         
            +
                EOS
         
     | 
| 
      
 189 
     | 
    
         
            +
                path = File.join(datadir, 'Transfer.dat')
         
     | 
| 
      
 190 
     | 
    
         
            +
                FileUtils.mkdir_p(datadir)
         
     | 
| 
      
 191 
     | 
    
         
            +
                File.open(path, 'w') { |fh| fh.puts src }
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                prod1 = Model::Product.new('1')
         
     | 
| 
      
 194 
     | 
    
         
            +
                prod1.description.de = 'product - by pcode'
         
     | 
| 
      
 195 
     | 
    
         
            +
                prod1.price = Util::Money.new(11.50)
         
     | 
| 
      
 196 
     | 
    
         
            +
                prod2 = Model::Product.new('2')
         
     | 
| 
      
 197 
     | 
    
         
            +
                prod2.description.de = 'product - by ean13'
         
     | 
| 
      
 198 
     | 
    
         
            +
                prod2.price = Util::Money.new(21.50)
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
                prodclass = flexstub(Model::Product)
         
     | 
| 
      
 201 
     | 
    
         
            +
                prodclass.should_receive(:find_by_pcode).and_return { |pcode|
         
     | 
| 
      
 202 
     | 
    
         
            +
                  if(pcode == '624427')
         
     | 
| 
      
 203 
     | 
    
         
            +
                     prod1
         
     | 
| 
      
 204 
     | 
    
         
            +
                  end
         
     | 
| 
      
 205 
     | 
    
         
            +
                }
         
     | 
| 
      
 206 
     | 
    
         
            +
                prodclass.should_receive(:find_by_ean13).and_return { |ean13|
         
     | 
| 
      
 207 
     | 
    
         
            +
                  if(ean13 == '7680523160141')
         
     | 
| 
      
 208 
     | 
    
         
            +
                     prod2
         
     | 
| 
      
 209 
     | 
    
         
            +
                  end
         
     | 
| 
      
 210 
     | 
    
         
            +
                }
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
                @selenium.type "file_chooser", path
         
     | 
| 
      
 213 
     | 
    
         
            +
                @http_server.inject_params = {"file_chooser", [src]}
         
     | 
| 
      
 214 
     | 
    
         
            +
                @selenium.click "order_transfer"
         
     | 
| 
      
 215 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 2 Positionen"), 
         
     | 
| 
      
 218 
     | 
    
         
            +
                       "Most likely firefox is blocking Javascript-Fileupload."
         
     | 
| 
      
 219 
     | 
    
         
            +
                assert @selenium.is_text_present("product - by pcode")
         
     | 
| 
      
 220 
     | 
    
         
            +
                assert @selenium.is_text_present("product - by ean13")
         
     | 
| 
      
 221 
     | 
    
         
            +
                assert @selenium.is_text_present("Unidentifiziertes Produkt (Tramal gtt 10 ml 100 mg/ml, EAN-Code: 7680437880197, Pharmacode: 933022)")
         
     | 
| 
      
 222 
     | 
    
         
            +
                assert @selenium.is_text_present("Total Sfr. 33.00")
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
                @selenium.click "name=delete index=2"
         
     | 
| 
      
 225 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 226 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 227 
     | 
    
         
            +
                assert !@selenium.is_text_present("Unidentifiziertes Produkt (Tramal gtt 10 ml 100 mg/ml, EAN-Code: 7680437880197, Pharmacode: 933022)")
         
     | 
| 
      
 228 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 2 Positionen")
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                @selenium.click "name=delete index=1"
         
     | 
| 
      
 231 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 232 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 233 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 234 
     | 
    
         
            +
                assert @selenium.is_text_present("product - by ean13")
         
     | 
| 
      
 235 
     | 
    
         
            +
                assert !@selenium.is_text_present("product - by pcode")
         
     | 
| 
      
 236 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 237 
     | 
    
         
            +
                FileUtils.rm_r(datadir) if(File.exist?(datadir))
         
     | 
| 
      
 238 
     | 
    
         
            +
              end
         
     | 
| 
      
 239 
     | 
    
         
            +
              def test_current_order__scan
         
     | 
| 
      
 240 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 241 
     | 
    
         
            +
                user = login_customer
         
     | 
| 
      
 242 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 243 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                prod1 = Model::Product.new('1')
         
     | 
| 
      
 246 
     | 
    
         
            +
                prod1.description.de = 'product 1'
         
     | 
| 
      
 247 
     | 
    
         
            +
                prod1.price = Util::Money.new(11.50)
         
     | 
| 
      
 248 
     | 
    
         
            +
                prodclass = flexstub(Model::Product)
         
     | 
| 
      
 249 
     | 
    
         
            +
                prodclass.should_receive(:find_by_ean13).and_return { |ean13|
         
     | 
| 
      
 250 
     | 
    
         
            +
                  if(ean13 == '7680523160141')
         
     | 
| 
      
 251 
     | 
    
         
            +
                     prod1
         
     | 
| 
      
 252 
     | 
    
         
            +
                  end
         
     | 
| 
      
 253 
     | 
    
         
            +
                }
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                ## simulate barcode-reader
         
     | 
| 
      
 256 
     | 
    
         
            +
                @selenium.open('/de/scan/EAN_13[7680523160141]/1/EAN_13[7680123456781]/1')
         
     | 
| 
      
 257 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
                @selenium.open('/de/current_order')
         
     | 
| 
      
 260 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 261 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 1 Positionen")
         
     | 
| 
      
 264 
     | 
    
         
            +
                assert @selenium.is_text_present("product 1")
         
     | 
| 
      
 265 
     | 
    
         
            +
                assert @selenium.is_text_present("Unidentifiziertes Produkt (EAN-Code: 7680123456781)")
         
     | 
| 
      
 266 
     | 
    
         
            +
                assert @selenium.is_text_present("Total Sfr. 11.50")
         
     | 
| 
      
 267 
     | 
    
         
            +
              end
         
     | 
| 
      
 268 
     | 
    
         
            +
              def test_current_order__sort
         
     | 
| 
      
 269 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 270 
     | 
    
         
            +
                product1 = Model::Product.new('12345')
         
     | 
| 
      
 271 
     | 
    
         
            +
                product1.description.de = 'product 1'
         
     | 
| 
      
 272 
     | 
    
         
            +
                product1.price = Util::Money.new(11.50)
         
     | 
| 
      
 273 
     | 
    
         
            +
                product1.l1_price = Util::Money.new(12.50)
         
     | 
| 
      
 274 
     | 
    
         
            +
                product1.l1_qty = 2
         
     | 
| 
      
 275 
     | 
    
         
            +
                product1.l2_price = Util::Money.new(13.50)
         
     | 
| 
      
 276 
     | 
    
         
            +
                product1.l2_qty = 3
         
     | 
| 
      
 277 
     | 
    
         
            +
                product2 = Model::Product.new('23456')
         
     | 
| 
      
 278 
     | 
    
         
            +
                product2.description.de = 'product 2'
         
     | 
| 
      
 279 
     | 
    
         
            +
                product2.price = Util::Money.new(2.50)
         
     | 
| 
      
 280 
     | 
    
         
            +
                product2.l1_price = Util::Money.new(1.50)
         
     | 
| 
      
 281 
     | 
    
         
            +
                product2.l1_qty = 2
         
     | 
| 
      
 282 
     | 
    
         
            +
                email = 'test.customer@bbmb.ch'
         
     | 
| 
      
 283 
     | 
    
         
            +
                customer = Model::Customer.new('007')
         
     | 
| 
      
 284 
     | 
    
         
            +
                customer.instance_variable_set('@email', email)
         
     | 
| 
      
 285 
     | 
    
         
            +
                customer.current_order.add(15, product1)
         
     | 
| 
      
 286 
     | 
    
         
            +
                customer.current_order.add(100, product2)
         
     | 
| 
      
 287 
     | 
    
         
            +
                user = login_customer(customer)
         
     | 
| 
      
 288 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 289 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 2 Positionen")
         
     | 
| 
      
 290 
     | 
    
         
            +
                assert_equal "product 1", @selenium.get_text("//tr[2]/td[3]/a") 
         
     | 
| 
      
 291 
     | 
    
         
            +
                assert_equal "product 2", @selenium.get_text("//tr[4]/td[3]/a") 
         
     | 
| 
      
 292 
     | 
    
         
            +
                @selenium.click "link=Preis"
         
     | 
| 
      
 293 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 294 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 295 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 2 Positionen")
         
     | 
| 
      
 296 
     | 
    
         
            +
                assert_equal "product 2", @selenium.get_text("//tr[2]/td[3]/a") 
         
     | 
| 
      
 297 
     | 
    
         
            +
                assert_equal "product 1", @selenium.get_text("//tr[4]/td[3]/a") 
         
     | 
| 
      
 298 
     | 
    
         
            +
                @selenium.click "link=Preis"
         
     | 
| 
      
 299 
     | 
    
         
            +
                @selenium.wait_for_page_to_load "30000"
         
     | 
| 
      
 300 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 301 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 2 Positionen")
         
     | 
| 
      
 302 
     | 
    
         
            +
                assert_equal "product 1", @selenium.get_text("//tr[2]/td[3]/a") 
         
     | 
| 
      
 303 
     | 
    
         
            +
                assert_equal "product 2", @selenium.get_text("//tr[4]/td[3]/a") 
         
     | 
| 
      
 304 
     | 
    
         
            +
              end
         
     | 
| 
      
 305 
     | 
    
         
            +
              def test_current_order__barcode_controls
         
     | 
| 
      
 306 
     | 
    
         
            +
                session = flexstub(@server['test:preset-session-id'])
         
     | 
| 
      
 307 
     | 
    
         
            +
                session.should_receive(:client_activex?).and_return(true)
         
     | 
| 
      
 308 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 309 
     | 
    
         
            +
                user = login_customer
         
     | 
| 
      
 310 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 311 
     | 
    
         
            +
                assert @selenium.is_text_present("Aktuelle Bestellung: 0 Positionen")
         
     | 
| 
      
 312 
     | 
    
         
            +
                assert @selenium.is_element_present("//a[@name='barcode_usb']")
         
     | 
| 
      
 313 
     | 
    
         
            +
                assert @selenium.is_element_present("//input[@name='barcode_button']")
         
     | 
| 
      
 314 
     | 
    
         
            +
                assert @selenium.is_element_present("//input[@name='barcode_comport']")
         
     | 
| 
      
 315 
     | 
    
         
            +
              end
         
     | 
| 
      
 316 
     | 
    
         
            +
              def test_current_order__backorder
         
     | 
| 
      
 317 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 318 
     | 
    
         
            +
                product = Model::Product.new('12345')
         
     | 
| 
      
 319 
     | 
    
         
            +
                product.description.de = 'product - a description'
         
     | 
| 
      
 320 
     | 
    
         
            +
                product.backorder = true
         
     | 
| 
      
 321 
     | 
    
         
            +
                product.price = Util::Money.new(11.50)
         
     | 
| 
      
 322 
     | 
    
         
            +
                product.l1_price = Util::Money.new(12.50)
         
     | 
| 
      
 323 
     | 
    
         
            +
                product.l1_qty = 2
         
     | 
| 
      
 324 
     | 
    
         
            +
                product.l2_price = Util::Money.new(13.50)
         
     | 
| 
      
 325 
     | 
    
         
            +
                product.l2_qty = 3
         
     | 
| 
      
 326 
     | 
    
         
            +
                email = 'test.customer@bbmb.ch'
         
     | 
| 
      
 327 
     | 
    
         
            +
                customer = Model::Customer.new('007')
         
     | 
| 
      
 328 
     | 
    
         
            +
                customer.instance_variable_set('@email', email)
         
     | 
| 
      
 329 
     | 
    
         
            +
                customer.current_order.add(15, product)
         
     | 
| 
      
 330 
     | 
    
         
            +
                user = login_customer(customer)
         
     | 
| 
      
 331 
     | 
    
         
            +
                assert_equal "BBMB | Home", @selenium.get_title
         
     | 
| 
      
 332 
     | 
    
         
            +
                assert @selenium.is_text_present("im Rückstand")
         
     | 
| 
      
 333 
     | 
    
         
            +
              end
         
     | 
| 
      
 334 
     | 
    
         
            +
            end
         
     | 
| 
      
 335 
     | 
    
         
            +
              end
         
     | 
| 
      
 336 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,363 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Selenium::TestCustomer -- bbmb.ch -- 04.10.2006 -- hwyss@ywesee.com
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            $: << File.expand_path('..', File.dirname(__FILE__))
         
     | 
| 
      
 5 
     | 
    
         
            +
            $: << File.expand_path('../lib', File.dirname(__FILE__))
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'selenium/unit'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module BBMB
         
     | 
| 
      
 10 
     | 
    
         
            +
              module Selenium
         
     | 
| 
      
 11 
     | 
    
         
            +
            class TestCustomer < Test::Unit::TestCase
         
     | 
| 
      
 12 
     | 
    
         
            +
              include Selenium::TestCase
         
     | 
| 
      
 13 
     | 
    
         
            +
              def test_customer
         
     | 
| 
      
 14 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 15 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 16 
     | 
    
         
            +
                customer.instance_variable_set('@email', 'test.customer@bbmb.ch')
         
     | 
| 
      
 17 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 18 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 19 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 21 
     | 
    
         
            +
                }
         
     | 
| 
      
 22 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 23 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 24 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 25 
     | 
    
         
            +
                assert_equal "BBMB | Kunde", get_title
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                assert_equal "Kunde*", get_text("//label[@for='organisation']")
         
     | 
| 
      
 28 
     | 
    
         
            +
                assert is_element_present("organisation")
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal "Test-Customer", get_value("organisation")
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                assert_equal "Kundennr*", get_text("//label[@for='customer_id']")
         
     | 
| 
      
 32 
     | 
    
         
            +
                assert is_element_present("customer_id")
         
     | 
| 
      
 33 
     | 
    
         
            +
                assert_equal "007", get_value("customer_id")
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                assert_equal "EAN-Code", get_text("//label[@for='ean13']")
         
     | 
| 
      
 36 
     | 
    
         
            +
                assert is_element_present("ean13")
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                assert_equal "Umsatz", get_text("//label[@for='turnover']")
         
     | 
| 
      
 39 
     | 
    
         
            +
                assert is_element_present("link=Sfr. 0.00")
         
     | 
| 
      
 40 
     | 
    
         
            +
                url = "http://localhost:10080/de/orders/customer_id/007"
         
     | 
| 
      
 41 
     | 
    
         
            +
                assert_equal url, get_attribute("//a[@name='turnover']@href")
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                assert is_element_present("link=Umsatz")
         
     | 
| 
      
 44 
     | 
    
         
            +
                assert is_text_present("Sfr. 0.00 - Umsatz")
         
     | 
| 
      
 45 
     | 
    
         
            +
                assert_equal "Anrede", get_text("//label[@for='title']")
         
     | 
| 
      
 46 
     | 
    
         
            +
                assert is_element_present("title")
         
     | 
| 
      
 47 
     | 
    
         
            +
                assert_equal "Titel", get_text("//label[@for='drtitle']")
         
     | 
| 
      
 48 
     | 
    
         
            +
                assert is_element_present("drtitle")
         
     | 
| 
      
 49 
     | 
    
         
            +
                assert_equal "Name", get_text("//label[@for='lastname']")
         
     | 
| 
      
 50 
     | 
    
         
            +
                assert is_element_present("lastname")
         
     | 
| 
      
 51 
     | 
    
         
            +
                assert_equal "Vorname", get_text("//label[@for='firstname']")
         
     | 
| 
      
 52 
     | 
    
         
            +
                assert is_element_present("firstname")
         
     | 
| 
      
 53 
     | 
    
         
            +
                assert_equal "Adresse*", get_text("//label[@for='address1']")
         
     | 
| 
      
 54 
     | 
    
         
            +
                assert is_element_present("address1")
         
     | 
| 
      
 55 
     | 
    
         
            +
                assert is_element_present("address2")
         
     | 
| 
      
 56 
     | 
    
         
            +
                assert is_element_present("address3")
         
     | 
| 
      
 57 
     | 
    
         
            +
                assert_equal "PLZ", get_text("//label[@for='plz']")
         
     | 
| 
      
 58 
     | 
    
         
            +
                assert is_element_present("plz")
         
     | 
| 
      
 59 
     | 
    
         
            +
                assert_equal "Ort", get_text("//label[@for='city']")
         
     | 
| 
      
 60 
     | 
    
         
            +
                assert is_element_present("city")
         
     | 
| 
      
 61 
     | 
    
         
            +
                assert is_text_present("PLZ/Ort")
         
     | 
| 
      
 62 
     | 
    
         
            +
                assert_equal "Kanton", get_text("//label[@for='canton']")
         
     | 
| 
      
 63 
     | 
    
         
            +
                assert is_element_present("canton")
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                assert_equal "Email*", get_text("//label[@for='email']")
         
     | 
| 
      
 66 
     | 
    
         
            +
                assert is_element_present("email")
         
     | 
| 
      
 67 
     | 
    
         
            +
                assert_equal "test.customer@bbmb.ch", get_value("email")
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                assert_equal "Tel. Geschäft", get_text("//label[@for='phone_business']")
         
     | 
| 
      
 70 
     | 
    
         
            +
                assert is_element_present("phone_business")
         
     | 
| 
      
 71 
     | 
    
         
            +
                assert_equal "Tel. Privat", get_text("//label[@for='phone_private']")
         
     | 
| 
      
 72 
     | 
    
         
            +
                assert is_element_present("phone_private")
         
     | 
| 
      
 73 
     | 
    
         
            +
                assert_equal "Tel. Mobile", get_text("//label[@for='phone_mobile']")
         
     | 
| 
      
 74 
     | 
    
         
            +
                assert is_element_present("phone_mobile")
         
     | 
| 
      
 75 
     | 
    
         
            +
                assert_equal "Fax", get_text("//label[@for='fax']")
         
     | 
| 
      
 76 
     | 
    
         
            +
                assert is_element_present("fax")
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                assert is_element_present("change_pass")
         
     | 
| 
      
 79 
     | 
    
         
            +
                assert is_element_present("generate_pass")
         
     | 
| 
      
 80 
     | 
    
         
            +
                assert !is_element_present("pass")
         
     | 
| 
      
 81 
     | 
    
         
            +
                assert !is_element_present("confirm_pass")
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                assert is_element_present("save")
         
     | 
| 
      
 84 
     | 
    
         
            +
                assert_equal "Speichern", get_value("save")
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
              def test_customer__save_errors
         
     | 
| 
      
 87 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 88 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 89 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 90 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 91 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 92 
     | 
    
         
            +
                customer.instance_variable_set('@email', 'test.customer@bbmb.ch')
         
     | 
| 
      
 93 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 94 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 95 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 97 
     | 
    
         
            +
                }
         
     | 
| 
      
 98 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 99 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 100 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                click "change_pass"
         
     | 
| 
      
 103 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                type "ean13", "768012345678"
         
     | 
| 
      
 108 
     | 
    
         
            +
                click "save"
         
     | 
| 
      
 109 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 112 
     | 
    
         
            +
                assert is_text_present("Das Passwort war leer.")
         
     | 
| 
      
 113 
     | 
    
         
            +
                assert_equal "error", get_attribute("//label[@for='address1']@class")
         
     | 
| 
      
 114 
     | 
    
         
            +
                assert_equal "error", get_attribute("//label[@for='pass']@class")
         
     | 
| 
      
 115 
     | 
    
         
            +
                assert_equal "error", get_attribute("//label[@for='confirm_pass']@class")
         
     | 
| 
      
 116 
     | 
    
         
            +
                assert_equal "error", get_attribute("//label[@for='ean13']@class")
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                type "address1", "Address"
         
     | 
| 
      
 119 
     | 
    
         
            +
                type "pass", "secret"
         
     | 
| 
      
 120 
     | 
    
         
            +
                type "confirm_pass", "terces"
         
     | 
| 
      
 121 
     | 
    
         
            +
                click "save"
         
     | 
| 
      
 122 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 125 
     | 
    
         
            +
                assert is_text_present("Das Passwort und die Bestätigung waren nicht identisch.")
         
     | 
| 
      
 126 
     | 
    
         
            +
                assert is_text_present("Der EAN-Code war ungültig.")
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
              def test_customer__save
         
     | 
| 
      
 129 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 130 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 131 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 132 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 133 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 134 
     | 
    
         
            +
                customer.instance_variable_set('@email', 'test.customer@bbmb.ch')
         
     | 
| 
      
 135 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 136 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 137 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 138 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 139 
     | 
    
         
            +
                }
         
     | 
| 
      
 140 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 141 
     | 
    
         
            +
                user.should_receive(:get_preference).and_return('')
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 144 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
                click "change_pass"
         
     | 
| 
      
 147 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                type "ean13", "7680123456781"
         
     | 
| 
      
 150 
     | 
    
         
            +
                type "address1", "Address"
         
     | 
| 
      
 151 
     | 
    
         
            +
                type "pass", "secret"
         
     | 
| 
      
 152 
     | 
    
         
            +
                type "confirm_pass", "secret"
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                entity = flexmock('yus-entity')
         
     | 
| 
      
 155 
     | 
    
         
            +
                entity.should_receive(:valid?).and_return(true)
         
     | 
| 
      
 156 
     | 
    
         
            +
                user.should_receive(:grant).times(1).and_return { |email, action, item|
         
     | 
| 
      
 157 
     | 
    
         
            +
                  assert_equal('login', action)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  assert_equal('ch.bbmb.Customer', item)
         
     | 
| 
      
 159 
     | 
    
         
            +
                }
         
     | 
| 
      
 160 
     | 
    
         
            +
                user.should_receive(:set_password).times(1).and_return { |email, hash|
         
     | 
| 
      
 161 
     | 
    
         
            +
                  assert_equal('test.customer@bbmb.ch', email)
         
     | 
| 
      
 162 
     | 
    
         
            +
                  assert_equal(Digest::MD5.hexdigest('secret'), hash)
         
     | 
| 
      
 163 
     | 
    
         
            +
                  @yus_entities.store(email, entity)
         
     | 
| 
      
 164 
     | 
    
         
            +
                }
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
                click "save"
         
     | 
| 
      
 167 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                assert !is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 170 
     | 
    
         
            +
                assert is_element_present("change_pass")
         
     | 
| 
      
 171 
     | 
    
         
            +
                assert is_element_present("generate_pass")
         
     | 
| 
      
 172 
     | 
    
         
            +
                assert_equal "Passwort ändern", get_value("change_pass")
         
     | 
| 
      
 173 
     | 
    
         
            +
              end
         
     | 
| 
      
 174 
     | 
    
         
            +
              def test_customer__duplicate_email
         
     | 
| 
      
 175 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 176 
     | 
    
         
            +
                BBMB.server.should_receive(:rename_user).and_return { |old, new|
         
     | 
| 
      
 177 
     | 
    
         
            +
                  raise Yus::YusError, 'duplicate email'
         
     | 
| 
      
 178 
     | 
    
         
            +
                }
         
     | 
| 
      
 179 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 180 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 181 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 182 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 183 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 184 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 185 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 186 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 187 
     | 
    
         
            +
                }
         
     | 
| 
      
 188 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 189 
     | 
    
         
            +
                user.should_receive(:get_preference).and_return('')
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 192 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
                click "change_pass"
         
     | 
| 
      
 195 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                type "email", "test.user@bbmb.ch"
         
     | 
| 
      
 198 
     | 
    
         
            +
                type "address1", "Address"
         
     | 
| 
      
 199 
     | 
    
         
            +
                type "pass", "secret"
         
     | 
| 
      
 200 
     | 
    
         
            +
                type "confirm_pass", "secret"
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
                entity = flexmock('yus-entity')
         
     | 
| 
      
 203 
     | 
    
         
            +
                entity.should_receive(:valid?).and_return(true)
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
                click "save"
         
     | 
| 
      
 206 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 209 
     | 
    
         
            +
                assert is_text_present("Es gibt bereits ein Benutzerprofil für diese Email-Adresse")
         
     | 
| 
      
 210 
     | 
    
         
            +
              end
         
     | 
| 
      
 211 
     | 
    
         
            +
              def test_customer__password_not_set
         
     | 
| 
      
 212 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 213 
     | 
    
         
            +
                BBMB.server.should_receive(:rename_user)
         
     | 
| 
      
 214 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 215 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 216 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 217 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 218 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 219 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 220 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 221 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 222 
     | 
    
         
            +
                }
         
     | 
| 
      
 223 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 224 
     | 
    
         
            +
                user.should_receive(:get_preference).and_return('')
         
     | 
| 
      
 225 
     | 
    
         
            +
                user.should_receive(:grant)
         
     | 
| 
      
 226 
     | 
    
         
            +
                user.should_receive(:set_password).and_return { |old, new|
         
     | 
| 
      
 227 
     | 
    
         
            +
                  raise Yus::YusError, 'other error, user not found, privilege problem'
         
     | 
| 
      
 228 
     | 
    
         
            +
                }
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 231 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
                click "change_pass"
         
     | 
| 
      
 234 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
                type "email", "test.user@bbmb.ch"
         
     | 
| 
      
 237 
     | 
    
         
            +
                type "address1", "Address"
         
     | 
| 
      
 238 
     | 
    
         
            +
                type "pass", "secret"
         
     | 
| 
      
 239 
     | 
    
         
            +
                type "confirm_pass", "secret"
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                entity = flexmock('yus-entity')
         
     | 
| 
      
 242 
     | 
    
         
            +
                entity.should_receive(:valid?).and_return(true)
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                click "save"
         
     | 
| 
      
 245 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 248 
     | 
    
         
            +
                assert is_text_present("Das Passwort konnte nicht gespeichert werden")
         
     | 
| 
      
 249 
     | 
    
         
            +
              end
         
     | 
| 
      
 250 
     | 
    
         
            +
              def test_customer__generate_pass
         
     | 
| 
      
 251 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 252 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 253 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 254 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 255 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 256 
     | 
    
         
            +
                customer.instance_variable_set('@email', 'test.customer@bbmb.ch')
         
     | 
| 
      
 257 
     | 
    
         
            +
                customer.drtitle = 'Dr. med. vet.'
         
     | 
| 
      
 258 
     | 
    
         
            +
                customer.firstname = 'firstname'
         
     | 
| 
      
 259 
     | 
    
         
            +
                customer.lastname = 'lastname'
         
     | 
| 
      
 260 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 261 
     | 
    
         
            +
                customer.city = 'city'
         
     | 
| 
      
 262 
     | 
    
         
            +
                customer.ean13 = "7680123456781"
         
     | 
| 
      
 263 
     | 
    
         
            +
                customer.address1 = "Address"
         
     | 
| 
      
 264 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 265 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 266 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 267 
     | 
    
         
            +
                }
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 270 
     | 
    
         
            +
                user.should_receive(:get_preference).and_return('')
         
     | 
| 
      
 271 
     | 
    
         
            +
                entity = flexmock('yus-entity')
         
     | 
| 
      
 272 
     | 
    
         
            +
                entity.should_receive(:valid?).and_return(true)
         
     | 
| 
      
 273 
     | 
    
         
            +
                @yus_entities.store(customer.email, entity)
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 276 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
                flexstub(Util::PasswordGenerator).should_receive(:generate).and_return 'pass'
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
      
 280 
     | 
    
         
            +
                user.should_receive(:set_password).times(1).and_return { |email, hash|
         
     | 
| 
      
 281 
     | 
    
         
            +
                  assert_equal('test.customer@bbmb.ch', email)
         
     | 
| 
      
 282 
     | 
    
         
            +
                  assert_equal(Digest::MD5.hexdigest('pass'), hash)
         
     | 
| 
      
 283 
     | 
    
         
            +
                  @yus_entities.store(email, entity)
         
     | 
| 
      
 284 
     | 
    
         
            +
                }
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
                click "generate_pass"
         
     | 
| 
      
 287 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 288 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
      
 290 
     | 
    
         
            +
            =begin # selecting a window opened by onload does not seem to work.
         
     | 
| 
      
 291 
     | 
    
         
            +
                select_window('password')
         
     | 
| 
      
 292 
     | 
    
         
            +
                assert_equal "BBMB | Kunde", get_title
         
     | 
| 
      
 293 
     | 
    
         
            +
                assert is_text_present("Test-Customer")
         
     | 
| 
      
 294 
     | 
    
         
            +
                assert is_text_present("Dr. med. vet. firstname lastname")
         
     | 
| 
      
 295 
     | 
    
         
            +
                assert is_text_present("Address")
         
     | 
| 
      
 296 
     | 
    
         
            +
                assert is_text_present("7777")
         
     | 
| 
      
 297 
     | 
    
         
            +
                assert is_text_present("pass")
         
     | 
| 
      
 298 
     | 
    
         
            +
                assert is_text_present("test.customer@bbmb.ch")
         
     | 
| 
      
 299 
     | 
    
         
            +
                close
         
     | 
| 
      
 300 
     | 
    
         
            +
            =end
         
     | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
      
 302 
     | 
    
         
            +
                select_window("")
         
     | 
| 
      
 303 
     | 
    
         
            +
                assert !is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 304 
     | 
    
         
            +
                assert is_element_present("change_pass")
         
     | 
| 
      
 305 
     | 
    
         
            +
                assert(is_element_present("generate_pass") \
         
     | 
| 
      
 306 
     | 
    
         
            +
                       || is_element_present("show_pass"))
         
     | 
| 
      
 307 
     | 
    
         
            +
              end
         
     | 
| 
      
 308 
     | 
    
         
            +
              def test_customer__generate_pass__errors
         
     | 
| 
      
 309 
     | 
    
         
            +
                BBMB.server = flexmock('server')
         
     | 
| 
      
 310 
     | 
    
         
            +
                BBMB.server.should_ignore_missing
         
     | 
| 
      
 311 
     | 
    
         
            +
                BBMB.persistence.should_ignore_missing
         
     | 
| 
      
 312 
     | 
    
         
            +
                customer = BBMB::Model::Customer.new('007')
         
     | 
| 
      
 313 
     | 
    
         
            +
                customer.organisation = 'Test-Customer'
         
     | 
| 
      
 314 
     | 
    
         
            +
                customer.drtitle = 'Dr. med. vet.'
         
     | 
| 
      
 315 
     | 
    
         
            +
                customer.firstname = 'firstname'
         
     | 
| 
      
 316 
     | 
    
         
            +
                customer.lastname = 'lastname'
         
     | 
| 
      
 317 
     | 
    
         
            +
                customer.plz = '7777'
         
     | 
| 
      
 318 
     | 
    
         
            +
                customer.city = 'city'
         
     | 
| 
      
 319 
     | 
    
         
            +
                customer.ean13 = "7680123456781"
         
     | 
| 
      
 320 
     | 
    
         
            +
                customer.address1 = "Address"
         
     | 
| 
      
 321 
     | 
    
         
            +
                @persistence.should_receive(:all).and_return { |klass|
         
     | 
| 
      
 322 
     | 
    
         
            +
                  assert_equal(BBMB::Model::Customer, klass)
         
     | 
| 
      
 323 
     | 
    
         
            +
                  [customer]
         
     | 
| 
      
 324 
     | 
    
         
            +
                }
         
     | 
| 
      
 325 
     | 
    
         
            +
             
     | 
| 
      
 326 
     | 
    
         
            +
                user = login_admin
         
     | 
| 
      
 327 
     | 
    
         
            +
                user.should_receive(:get_preference).and_return('')
         
     | 
| 
      
 328 
     | 
    
         
            +
                entity = flexmock('yus-entity')
         
     | 
| 
      
 329 
     | 
    
         
            +
                entity.should_receive(:valid?).and_return(true)
         
     | 
| 
      
 330 
     | 
    
         
            +
                @yus_entities.store(customer.email, entity)
         
     | 
| 
      
 331 
     | 
    
         
            +
             
     | 
| 
      
 332 
     | 
    
         
            +
                click "link=Test-Customer"
         
     | 
| 
      
 333 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
      
 335 
     | 
    
         
            +
                click "generate_pass"
         
     | 
| 
      
 336 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
      
 338 
     | 
    
         
            +
                assert is_text_present("Das Benutzerprofil wurde nicht gespeichert!")
         
     | 
| 
      
 339 
     | 
    
         
            +
                assert is_text_present("Bitte speichern Sie zuerst eine gültige Email-Adresse")
         
     | 
| 
      
 340 
     | 
    
         
            +
                assert is_element_present("change_pass")
         
     | 
| 
      
 341 
     | 
    
         
            +
                assert(is_element_present("generate_pass") \
         
     | 
| 
      
 342 
     | 
    
         
            +
                       || is_element_present("show_pass"))
         
     | 
| 
      
 343 
     | 
    
         
            +
             
     | 
| 
      
 344 
     | 
    
         
            +
             
     | 
| 
      
 345 
     | 
    
         
            +
                BBMB.server.should_receive(:rename_user).and_return { |old, new|
         
     | 
| 
      
 346 
     | 
    
         
            +
                  raise Yus::YusError, 'duplicate email'
         
     | 
| 
      
 347 
     | 
    
         
            +
                }
         
     | 
| 
      
 348 
     | 
    
         
            +
             
     | 
| 
      
 349 
     | 
    
         
            +
                flexstub(Util::PasswordGenerator).should_receive(:generate).and_return 'pass'
         
     | 
| 
      
 350 
     | 
    
         
            +
                user.should_receive(:set_password).times(1).and_return { |email, hash|
         
     | 
| 
      
 351 
     | 
    
         
            +
                  raise Yus::YusError
         
     | 
| 
      
 352 
     | 
    
         
            +
                }
         
     | 
| 
      
 353 
     | 
    
         
            +
             
     | 
| 
      
 354 
     | 
    
         
            +
                type 'email', 'test.customer@bbmb.ch'
         
     | 
| 
      
 355 
     | 
    
         
            +
                customer.instance_variable_set('@email', 'test.customer@bbmb.ch')
         
     | 
| 
      
 356 
     | 
    
         
            +
                click "generate_pass"
         
     | 
| 
      
 357 
     | 
    
         
            +
                wait_for_page_to_load "30000"
         
     | 
| 
      
 358 
     | 
    
         
            +
             
     | 
| 
      
 359 
     | 
    
         
            +
                assert is_text_present("Das Passwort konnte nicht gespeichert werden")
         
     | 
| 
      
 360 
     | 
    
         
            +
              end
         
     | 
| 
      
 361 
     | 
    
         
            +
            end
         
     | 
| 
      
 362 
     | 
    
         
            +
              end
         
     | 
| 
      
 363 
     | 
    
         
            +
            end
         
     |