Log in as Manager::

    >>> browser.login(TEST_USER_NAME, TEST_USER_PASSWORD)

Assign cart portlet to shop::

    >>> browser.open('/shop/++contextportlets++plone.leftcolumn/+/collective.cart.core.CartPortlet')

Log out::

    >>> browser.getLink('Log out').click()

Go to Ärticle1::

    >>> browser.open('/shop/article1')

Add Ärticle1 to cart::

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

Go to cart::

    >>> browser.getLink('Go to cart').click()

Check out::

    >>> browser.getControl(name="form.checkout").click()

Fill Billing Info and select Shipping Methöd 2::

    >>> browser.getControl(name="first_name").value = 'Bılling First'
    >>> browser.getControl(name="last_name").value = 'Bılling Last'
    >>> browser.getControl(name="organization").value = 'Bılling Organization'
    >>> browser.getControl(name="vat").value = 'Bılling VAT'
    >>> browser.getControl(name="email").value = 'first.last@email.bil'
    >>> browser.getControl(name="street").value = 'Bılling Street'
    >>> browser.getControl(name="post").value = 'Bılling Post'
    >>> browser.getControl(name="city").value = 'Bılling City'
    >>> browser.getControl(name="phone").value = 'Bılling Phone'
    >>> browser.getControl(name="shipping-method").value = [shippingmethod2_uuid]
    >>> browser.getControl(name="form.to.confirmation").click()

Confirm order::

    >>> browser.getControl(name="form.buttons.ConfirmOrder").click()

Thanks page::

    >>> 'Check the order' not in browser.contents
    True

Check the newest message sent::

    >>> len(mailhost.messages)
    2

    >>> msg = mailhost.messages[-2]
    >>> prink(msg)
    MIME-Version: 1.0
    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Subject: =?utf-8?q?Order_Number=3A_1?=
    To: =?utf-8?q?B=C4=B1lling_First_B=C4=B1lling_Last?= <first.last@email.bil>
    From: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    Date: ...
    <BLANKLINE>
    Thank you for the order.
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Number: 1
    <BLANKLINE>
    <BLANKLINE>
    Billing Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    Shipping Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Contents
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    <BLANKLINE>
    SKU: SK=C3=961
    =C3=84rticle1 x 1 =3D 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Shipping Method:  0.00 =E2=82=AC
    <BLANKLINE>
    Total: 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>

    >>> msg = mailhost.messages[-1]
    >>> prink(msg)
    MIME-Version: 1.0
    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Subject: =?utf-8?q?Order_Number=3A_1?=
    To: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    From: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    Date: ...
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Number: 1
    <BLANKLINE>
    <BLANKLINE>
    Billing Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    Shipping Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Contents
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    <BLANKLINE>
    SKU: SK=C3=961
    =C3=84rticle1 x 1 =3D 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Shipping Method:  0.00 =E2=82=AC
    <BLANKLINE>
    Total: 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Link to the order: http://nohost/plone/shop/cart-container/1
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>

Go to Ärticle1::

    >>> browser.open('/shop/article1')

Add Ärticle1 to cart::

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

Go to cart::

    >>> browser.getLink('Go to cart').click()

Check out and there should be billing info filled::

    >>> browser.getControl(name="form.checkout").click()

    >>> 'value="Bılling First"' in browser.contents
    True
    >>> 'value="Bılling Last"' in browser.contents
    True
    >>> 'value="Bılling Organization"' in browser.contents
    True
    >>> 'value="Bılling VAT"' in browser.contents
    True
    >>> 'value="first.last@email.bil"' in browser.contents
    True
    >>> 'value="Bılling Street"' in browser.contents
    True
    >>> 'value="Bılling Post"' in browser.contents
    True
    >>> 'value="Bılling City"' in browser.contents
    True
    >>> 'value="Bılling Phone"' in browser.contents
    True
    >>> print browser.bycss('.shipping-methods')
        --- 1 ---
    ...
    <input name="shipping-method" type="radio" required="required" checked value="..."><span>ShippingMeth&#246;d2  0.00 EUR</span>
    ...

With different shipping address::

    >>> browser.getControl(name="billing-and-shipping-same-or-different").value = ['different']
    >>> browser.getControl(name="form.to.confirmation").click()

Input shipping info::

    >>> browser.getControl(name="first_name").value = 'Shıpping First'
    >>> browser.getControl(name="last_name").value = 'Shıpping Last'
    >>> browser.getControl(name="organization").value = 'Shıpping Organization'
    >>> browser.getControl(name="vat").value = 'Shıpping VAT'
    >>> browser.getControl(name="email").value = 'first.last@email.shi'
    >>> browser.getControl(name="street").value = 'Shıpping Street'
    >>> browser.getControl(name="post").value = 'Shıpping Post'
    >>> browser.getControl(name="city").value = 'Shıpping City'
    >>> browser.getControl(name="phone").value = 'Shıpping Phone'
    >>> browser.getControl(name="form.to.confirmation").click()

Confirm order::

    >>> browser.getControl(name="form.buttons.ConfirmOrder").click()

Thanks page::

    >>> 'Check the order' not in browser.contents
    True

Check the newest message sent::

    >>> len(mailhost.messages)
    4

    >>> msg = mailhost.messages[-2]
    >>> prink(msg)
    MIME-Version: 1.0
    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Subject: =?utf-8?q?Order_Number=3A_2?=
    To: =?utf-8?q?B=C4=B1lling_First_B=C4=B1lling_Last?= <first.last@email.bil>
    From: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    Date: ...
    <BLANKLINE>
    Thank you for the order.
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Number: 2
    <BLANKLINE>
    <BLANKLINE>
    Billing Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    Shipping Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    Sh=C4=B1pping First Sh=C4=B1pping Last  Sh=C4=B1pping Organization  Sh=C4=
    =B1pping VAT
    Sh=C4=B1pping Street
    Sh=C4=B1pping Post Sh=C4=B1pping City
    Sh=C4=B1pping Phone
    first.last@email.shi
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Contents
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    <BLANKLINE>
    SKU: SK=C3=961
    =C3=84rticle1 x 1 =3D 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Shipping Method:  0.00 =E2=82=AC
    <BLANKLINE>
    Total: 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>

    >>> msg = mailhost.messages[-1]
    >>> prink(msg)
    MIME-Version: 1.0
    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: quoted-printable
    Subject: =?utf-8?q?Order_Number=3A_2?=
    To: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    From: =?utf-8?q?Sh=C3=B6p?= <info@shop.com>
    Date: ...
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Number: 2
    <BLANKLINE>
    <BLANKLINE>
    Billing Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    B=C4=B1lling First B=C4=B1lling Last  B=C4=B1lling Organization  B=C4=B1lli=
    ng VAT
    B=C4=B1lling Street
    B=C4=B1lling Post B=C4=B1lling City
    B=C4=B1lling Phone
    first.last@email.bil
    <BLANKLINE>
    Shipping Address
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    Sh=C4=B1pping First Sh=C4=B1pping Last  Sh=C4=B1pping Organization  Sh=C4=
    =B1pping VAT
    Sh=C4=B1pping Street
    Sh=C4=B1pping Post Sh=C4=B1pping City
    Sh=C4=B1pping Phone
    first.last@email.shi
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Order Contents
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D
    <BLANKLINE>
    SKU: SK=C3=961
    =C3=84rticle1 x 1 =3D 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Shipping Method:  0.00 =E2=82=AC
    <BLANKLINE>
    Total: 12.40 =E2=82=AC
    <BLANKLINE>
    <BLANKLINE>
    Link to the order: http://nohost/plone/shop/cart-container/2
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>

Log in as Manager::

    >>> browser.login(TEST_USER_NAME, TEST_USER_PASSWORD)

Check the stock of article1::

    >>> browser.open('/shop/article1/@@stock')
    >>> print browser.bycss('.documentFirstHeading')
    --- 1 ---
    <h1 class="documentFirstHeading">&#196;rticle1: 8 pcs</h1>

Go to Cart Container::

    >>> browser.open('/shop/cart-container')
    >>> print browser.bycss('#order-list')
    --- 1 ---
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner"></td>
    <td class="cart-state">Ordered</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.ChangeState" type="submit" value="canceled">Canceled</button>
    <button name="form.buttons.ChangeState" type="submit" value="paid">Paid</button>
    <button name="form.buttons.ChangeState" type="submit" value="charged">Charged</button>
    </form>
    </td>
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner"></td>
    <td class="cart-state">Ordered</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.ChangeState" type="submit" value="canceled">Canceled</button>
    <button name="form.buttons.ChangeState" type="submit" value="paid">Paid</button>
    <button name="form.buttons.ChangeState" type="submit" value="charged">Charged</button>
    ...

Cancel the order::

    >>> browser.getControl(name="form.buttons.ChangeState", index=0).click()
    >>> browser.open('/shop/article1/@@stock')
    >>> print browser.bycss('.documentFirstHeading')
    --- 1 ---
    <h1 class="documentFirstHeading">&#196;rticle1: 9 pcs</h1>

    >>> browser.open('/shop/cart-container')
    >>> print browser.bycss('#order-list')
    --- 1 ---
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner">test_user_1_</td>
    <td class="cart-state">Canceled</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.RemoveCart" value="form.buttons.RemoveCart" type="submit">Remove</button>
    </form>
    </td>
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner"></td>
    <td class="cart-state">Ordered</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.ChangeState" type="submit" value="canceled">Canceled</button>
    <button name="form.buttons.ChangeState" type="submit" value="paid">Paid</button>
    <button name="form.buttons.ChangeState" type="submit" value="charged">Charged</button>
    ...

    >>> browser.getControl(name="form.buttons.ChangeState", index=0).click()
    >>> browser.open('/shop/article1/@@stock')
    >>> print browser.bycss('.documentFirstHeading')
    --- 1 ---
    <h1 class="documentFirstHeading">&#196;rticle1: 10 pcs</h1>

Remove carts::

    >>> browser.open('/shop/cart-container')
    >>> print browser.bycss('#order-list')
    --- 1 ---
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner">test_user_1_</td>
    <td class="cart-state">Canceled</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.RemoveCart" value="form.buttons.RemoveCart" type="submit">Remove</button>
    </form>
    </td>
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner">test_user_1_</td>
    <td class="cart-state">Canceled</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.RemoveCart" value="form.buttons.RemoveCart" type="submit">Remove</button>
    ...

    >>> browser.getControl(name="form.buttons.RemoveCart", index=0).click()
    >>> print browser.bycss('#order-list')
    --- 1 ---
    ...
    <td class="cart-updated">...</td>
    <td class="cart-owner">test_user_1_</td>
    <td class="cart-state">Canceled</td>
    <td>
    <form id="transition" method="post" action="http://nohost/plone/shop/cart-container">
    <input name="cart-id" type="hidden" value="..."><button name="form.buttons.RemoveCart" value="form.buttons.RemoveCart" type="submit">Remove</button>
    ...

    >>> browser.getControl(name="form.buttons.RemoveCart", index=0).click()
    >>> print browser.bycss('#order-list')
