Log in as Manager::

    >>> browser.login(TEST_USER_NAME, TEST_USER_PASSWORD)

    >>> browser.open('/shop/cart-container')
    Traceback (most recent call last):
    ...
    HTTPError: HTTP Error 404: Not Found

    >>> browser.open('/shop/shipping-methods')
    Traceback (most recent call last):
    ...
    HTTPError: HTTP Error 404: Not Found

Add Shop::

    >>> browser.open('/++add++collective.cart.shopping.Shop')
    >>> browser.getControl(name="form.widgets.IDublinCore.title").value = 'Shöp'
    >>> browser.getControl(name="form.widgets.IDublinCore.description").value = 'Descriptiön of Shöp.'
    >>> browser.getControl(name="form.buttons.save").click()

    >>> browser.open('/shop/cart-container')

    >>> browser.open('/shop/shipping-methods')

Add ArticleContainer::

    >>> browser.open('/shop/++add++collective.cart.shopping.ArticleContainer')
    >>> browser.getControl(name="form.widgets.IDublinCore.title").value = 'Article Container'
    >>> browser.getControl(name="form.buttons.save").click()

Add Article::

    >>> browser.open('/shop/article-container/++add++collective.cart.core.Article')
    >>> browser.getControl(name="form.widgets.IDublinCore.title").value = 'Ärticle1'
    >>> browser.getControl(name="form.widgets.IDublinCore.description").value = 'Description of Ärticle1'
    >>> browser.getControl(name="form.widgets.ISKU.sku").value = 'SKÖ1'
    >>> browser.getControl(name="form.widgets.IDiscount.price").value = '12.30'
    >>> browser.getControl(name="form.widgets.ISize.weight").value = '100.0'
    >>> browser.getControl(name="form.buttons.save").click()

    >>> article1_url = browser.url

    >>> print browser.bycss('.documentFirstHeading')
    --- 1 ---
    <h1 class="documentFirstHeading">&#196;rticle1</h1>

    >>> print browser.bycss('.documentDescription')
    --- 1 ---
    <div class="documentDescription">Description of &#196;rticle1</div>

    >>> print browser.bycss('.sold-out')
    --- 1 ---
    <p class="sold-out">Sold Out</p>

Add Stock to Ärticle1::

    >>> browser.open('/shop/article-container/article1/++add++collective.cart.stock.Stock')
    >>> browser.getControl(name="form.widgets.IBasic.title").value = 'Stöck1'
    >>> browser.getControl(name="form.widgets.IBasic.description").value = 'Description of Stöck1'
    >>> browser.getControl(name="form.widgets.stock").value = '100'
    >>> browser.getControl( name="form.widgets.IStockPrice.price").value = '0.0'
    >>> browser.getControl(name="form.buttons.save").click()

Go to Ärticle1::

    >>> browser.open(article1_url)

    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article1/view">
    <section id="money"><section id="price" class="gross">12.30 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="100" maxlength="3" size="3"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 100 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

    >>> print browser.bycss('.sold-out')

    >>> article1 = portal['shop']['article-container']['article1']
    >>> article1.money
    12.30 EUR
    >>> article1.vat_money
    2.30 EUR
    >>> article1.net_money
    10.00 EUR

Go to cart::

    >>> browser.open('/shop/@@cart')
    >>> print browser.bycss('#cart-is-empty')
    --- 1 ---
    <p id="cart-is-empty">Cart is empty.</p>

Go to Ärticle1 and add to cart::

    >>> browser.open(article1_url)
    >>> browser.getControl(name="form.buttons.AddToCart").click()

    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article1/view">
    <section id="money"><section id="price" class="gross">12.30 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="99" maxlength="2" size="2"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 99 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

Check Stöck1::

    >>> browser.open('/shop/article-container/article1/stock1')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">100</span>

Check Cart::

    >>> browser.open('/shop/@@cart')
    >>> print browser.bycss('.cart')
    --- 1 ---
    <section class="checkout-content cart"><section id="cart-articles"><table><tbody><tr><td class="image">
    <a href="http://nohost/plone/shop/article-container/article1" title="&#196;rticle1">
    <img src="http://nohost/plone/fallback.png"></a>
    </td>
    <td class="name">
    <h3>
    <a href="http://nohost/plone/shop/article-container/article1">&#196;rticle1</a>
    </h3>
    <p>Description of &#196;rticle1</p>
    </td>
    <td class="price-and-quantity">
    <form method="post" action="http://nohost/plone/shop/@@cart">
    <input id="quantity" min="0" name="quantity" type="number" max="100" maxlength="3" size="3" value="1">
    &#160;&#215;&#160;
    <span class="gross">12.30 &#8364;</span>
    <br><span class="vat">Including VAT: 23.00 %</span>
    <section class="buttons"><button class="shopping-button update" name="form.update.article" type="submit" value="...">Update</button>
    <button class="shopping-button remove" name="form.delete.article" type="submit" value="...">Delete</button>
    </section></form>
    ...

Go to Ärticle1 and add more to cart::

    >>> browser.open(article1_url)
    >>> browser.getControl(name="quantity").value = '9'
    >>> browser.getControl(name="form.buttons.AddToCart").click()
    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article1/view">
    <section id="money"><section id="price" class="gross">12.30 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="90" maxlength="2" size="2"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 90 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

Check Stöck1::

    >>> browser.open('/shop/article-container/article1/stock1')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">100</span>

Check Cart::

    >>> browser.open('/shop/@@cart')
    >>> print browser.bycss('#quantity')
    --- 1 ---
    <input id="quantity" min="0" name="quantity" type="number" max="100" maxlength="3" size="3" value="10">
    &#160;&#215;&#160;

Add another Article::

    >>> browser.open('/shop/article-container/++add++collective.cart.core.Article')
    >>> browser.getControl(name="form.widgets.IDublinCore.title").value = 'Ärticle2'
    >>> browser.getControl(name="form.widgets.IDublinCore.description").value = 'Description of Ärticle2'
    >>> browser.getControl(name="form.widgets.ISKU.sku").value = 'SKU2'
    >>> browser.getControl(name="form.widgets.IDiscount.price").value = '24.60'
    >>> browser.getControl(name="form.widgets.ISize.weight").value = '100.0'
    >>> browser.getControl(name="form.buttons.save").click()

    >>> article2_url = browser.url

Add Stock to Ärticle2::

    >>> browser.open('/shop/article-container/article2/++add++collective.cart.stock.Stock')
    >>> browser.getControl(name="form.widgets.IBasic.title").value = 'Stöck2'
    >>> browser.getControl(name="form.widgets.IBasic.description").value = 'Description of Stöck2'
    >>> browser.getControl(name="form.widgets.stock").value = '20'
    >>> browser.getControl( name="form.widgets.IStockPrice.price").value = '0.0'
    >>> browser.getControl(name="form.buttons.save").click()

Add another stock to Ärticle2

    >>> browser.open(article2_url)
    >>> browser.open('/shop/article-container/article2/++add++collective.cart.stock.Stock')
    >>> browser.getControl(name="form.widgets.IBasic.title").value = 'Stöck3'
    >>> browser.getControl(name="form.widgets.IBasic.description").value = 'Description of Stöck3'
    >>> browser.getControl(name="form.widgets.stock").value = '10'
    >>> browser.getControl( name="form.widgets.IStockPrice.price").value = '0.0'
    >>> browser.getControl(name="form.buttons.save").click()

Go to Ärtile2:

    >>> browser.open(article2_url)
    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article2/view">
    <section id="money"><section id="price" class="gross">24.60 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="30" maxlength="2" size="2"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 30 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

Add to Cart::

    >>> browser.getControl(name="quantity").value = '5'
    >>> browser.getControl(name="form.buttons.AddToCart").click()
    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article2/view">
    <section id="money"><section id="price" class="gross">24.60 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="25" maxlength="2" size="2"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 25 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

Check Stöck2::

    >>> browser.open('/shop/article-container/article2/stock2')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">20</span>

Check Stöck3::

    >>> browser.open('/shop/article-container/article2/stock3')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">10</span>

Check Cart::

    >>> browser.open('/shop/@@cart')
    >>> print browser.bycss('.name')
    --- 1 ---
    <td class="name">
    <h3>
    <a href="http://nohost/plone/shop/article-container/article1">&#196;rticle1</a>
    </h3>
    <p>Description of &#196;rticle1</p>
    </td>
    --- 2 ---
    <td class="name">
    <h3>
    <a href="http://nohost/plone/shop/article-container/article2">&#196;rticle2</a>
    </h3>
    <p>Description of &#196;rticle2</p>
    </td>

    >>> print browser.bycss('.gross')
    --- 1 ---
    <span class="gross">12.30 &#8364;</span>
    --- 2 ---
    <span class="gross">24.60 &#8364;</span>
    >>> print browser.bycss('.vat')
    --- 1 ---
    <span class="vat">Including VAT: 23.00 %</span>
    --- 2 ---
    <span class="vat">Including VAT: 23.00 %</span>

    >>> print browser.bycss('#quantity')
    --- 1 ---
    <input id="quantity" min="0" name="quantity" type="number" max="100" maxlength="3" size="3" value="10">
    &#160;&#215;&#160;
    --- 2 ---
    <input id="quantity" min="0" name="quantity" type="number" max="30" maxlength="2" size="2" value="5">
    &#160;&#215;&#160;

Go to Ärticle2 and add more to cart::

    >>> browser.open(article2_url)
    >>> browser.getControl(name="quantity").value = '25'
    >>> browser.getControl(name="form.buttons.AddToCart").click()
    >>> print browser.bycss('.sold-out')

Check Stöck2::

    >>> browser.open('/shop/article-container/article2/stock2')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">20</span>

Check Stöck3::

    >>> browser.open('/shop/article-container/article2/stock3')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">10</span>

Check Cart::

    >>> browser.open('/shop/@@cart')
    >>> print browser.bycss('#quantity')
    --- 1 ---
    <input id="quantity" min="0" name="quantity" type="number" max="100" maxlength="3" size="3" value="10">
    &#160;&#215;&#160;
    --- 2 ---
    <input id="quantity" min="0" name="quantity" type="number" max="30" maxlength="2" size="2" value="30">
    &#160;&#215;&#160;

Delete Ärticle1::

    >>> browser.getControl(name="form.delete.article", index=0).click()
    >>> print browser.bycss('.name')
    --- 1 ---
    <td class="name">
    <h3>
    <a href="http://nohost/plone/shop/article-container/article2">&#196;rticle2</a>
    </h3>
    <p>Description of &#196;rticle2</p>
    </td>

Check Stöck1::

    >>> browser.open('/shop/article-container/article1/stock1')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">100</span>

Go to Ärticle1::

    >>> browser.open(article1_url)

    >>> print browser.bycss('#add-to-cart')
    --- 1 ---
    <section id="add-to-cart"><form method="post" action="http://nohost/plone/shop/article-container/article1/view">
    <section id="money"><section id="price" class="gross">12.30 &#8364;</section><section id="vat">Including VAT: 23.00 %</section></section><section id="quantity"><label>Quantity</label>
    <input min="1" name="quantity" required="required" type="number" value="1" max="100" maxlength="3" size="3"><span id="pcs">pcs</span>
    </section><section id="stock">Stock: 100 pcs</section><button class="shopping-button update" name="form.buttons.AddToCart" type="submit" value="...">Add To Cart</button>
    </form>
    </section>

Go to Cart::

    >>> browser.open('/shop/@@cart')

Update Ärticle2 in Cart::

    >>> browser.getControl(name="quantity").value = '2'
    >>> browser.getControl(name="form.update.article").click()
    >>> print browser.bycss('#quantity')
    --- 1 ---
    <input id="quantity" min="0" name="quantity" type="number" max="30" maxlength="2" size="2" value="2">
    &#160;&#215;&#160;

    >>> browser.getControl(name="quantity").value = '20'
    >>> browser.getControl(name="form.update.article").click()
    >>> print browser.bycss('#quantity')
    --- 1 ---
    <input id="quantity" min="0" name="quantity" type="number" max="30" maxlength="2" size="2" value="20">
    &#160;&#215;&#160;

Check Stöck2::

    >>> browser.open('/shop/article-container/article2/stock2')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">20</span>

Check Stöck3::

    >>> browser.open('/shop/article-container/article2/stock3')
    >>> print browser.bycss('#form-widgets-stock')
    --- 1 ---
    <span id="form-widgets-stock" class="text-widget required int-field">10</span>

Delete Ärticle2 from cart by updating cart with value zero::

    >>> browser.open('/shop/@@cart')
    >>> browser.getControl(name="quantity").value = '0'
    >>> browser.getControl(name="form.update.article").click()
    >>> print browser.bycss('#quantity')

    >>> print browser.bycss('#cart-is-empty')
    --- 1 ---
    <p id="cart-is-empty">Cart is empty.</p>
