| 9 | |
| 10 | |
| 11 | def test_pizza(example_app): |
| 12 | example_app.expect(textwrap.dedent("""\ |
| 13 | Hi, welcome to Python Pizza |
| 14 | ? Is this for delivery? (y/N)""")) |
| 15 | example_app.write('n') |
| 16 | example_app.expect(textwrap.dedent("""\ |
| 17 | ? Is this for delivery? No |
| 18 | ? What's your phone number? """)) |
| 19 | example_app.writeline('1111111111') |
| 20 | example_app.expect(textwrap.dedent("""\ |
| 21 | ? What's your phone number? 1111111111 |
| 22 | ? What size do you need? (Use arrow keys) |
| 23 | ❯ Large |
| 24 | Medium |
| 25 | Small""")) |
| 26 | example_app.write(keys.ENTER) |
| 27 | example_app.expect(textwrap.dedent("""\ |
| 28 | ? What size do you need? Large |
| 29 | ? How many do you need? """)) |
| 30 | example_app.writeline('2') |
| 31 | example_app.expect(textwrap.dedent("""\ |
| 32 | ? How many do you need? 2 |
| 33 | ? What about the toppings? (pawh) |
| 34 | >> Pepperoni and cheese""")) |
| 35 | example_app.write(keys.ENTER) |
| 36 | example_app.expect(textwrap.dedent("""\ |
| 37 | ? What about the toppings? PepperoniCheese |
| 38 | ? You also get a free 2L beverage |
| 39 | 1) Pepsi |
| 40 | 2) 7up |
| 41 | 3) Coke |
| 42 | Answer: 1""")) |
| 43 | example_app.write(keys.ENTER) |
| 44 | example_app.expect(textwrap.dedent("""\ |
| 45 | ? You also get a free 2L beverage Pepsi |
| 46 | ? Any comments on your purchase experience? Nope, all good!""")) |
| 47 | example_app.write(keys.ENTER) |
| 48 | example_app.expect(textwrap.dedent("""\ |
| 49 | ? Any comments on your purchase experience? Nope, all good! |
| 50 | Order receipt: |
| 51 | { |
| 52 | "beverage": "Pepsi", |
| 53 | "comments": "Nope, all good!", |
| 54 | "phone": "1111111111", |
| 55 | "quantity": 2, |
| 56 | "size": "large", |
| 57 | "toBeDelivered": false, |
| 58 | "toppings": "PepperoniCheese" |
| 59 | } |
| 60 | |
| 61 | """)) |