Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Side by Side Diff: components/test/data/autofill/automated_integration/tasks/sites.py

Issue 2116583004: Automated Autofill testing library + extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed indentation Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from autofill_task.autofill_task import AutofillTask
6
7 # pylint: disable=g-multiple-import
8 # pylint: disable=unused-import
9 from autofill_task.actions import (SetContext, Open, Click, Type, Wait, Select,
10 ByID, ByClassName, ByCssSelector, Screenshot,
11 ByXPath, ValidateFields, TriggerAutofill)
12
13 from autofill_task.generator import Generator
14
15
16 class TestNeweggComGuestCheckout(AutofillTask):
17 def _create_script(self):
18 self.script = [
19 Open('http://www.newegg.com/Product/Product.aspx?Item=N82E16823126097'),
20 Click(ByXPath('//*[@id="landingpage-cart"]/div/div[2]/button['
21 'contains(., \'ADD TO CART\')]')),
22 Click(ByXPath('//a[contains(., \'View Shopping Cart\')]'), True),
23 Click(ByXPath('//a[contains(., \'Secure Checkout\')]')),
24 Click(ByXPath('//a[contains(., \'CONTINUE AS A GUEST\')]'), True),
25 TriggerAutofill(ByXPath('//*[@id="SFirstName"]'), 'NAME_FIRST'),
26 ValidateFields([
27 (ByXPath('//*[@id="SFirstName"]'), 'NAME_FIRST'),
28 (ByXPath('//*[@id="SLastName"]'), 'NAME_LAST'),
29 (ByXPath('//*[@id="SAddress1"]'), 'ADDRESS_HOME_LINE1'),
30 (ByXPath('//*[@id="SAddress2"]'), 'ADDRESS_HOME_LINE2'),
31 (ByXPath('//*[@id="SCity"]'), 'ADDRESS_HOME_CITY'),
32 (ByXPath('//*[@id="SState_Option_USA"]'), 'ADDRESS_HOME_STATE',
33 'CA'),
34 (ByXPath('//*[@id="SZip"]'), 'ADDRESS_HOME_ZIP', '94035-____'),
35 (ByXPath('//*[@id="ShippingPhone"]'), 'PHONE_HOME_CITY_AND_NUMBER',
36 '(650) 670-1234 x__________'),
37 (ByXPath('//*[@id="email"]'), 'EMAIL_ADDRESS'),
38 ]),
39 ]
40
41
42 class TestGamestopCom(AutofillTask):
43 def _create_script(self):
44 self.script = [
45 Open('http://www.gamestop.com/ps4/consoles/playstation-4-500gb-system-'
46 'white/118544'),
47 # First redirects you to the canadian site if run internationally
48 Open('http://www.gamestop.com/ps4/consoles/playstation-4-500gb-system-'
49 'white/118544'),
50 Click(ByXPath('//*[@id="mainContentPlaceHolder_dynamicContent_ctl00_'
51 'RepeaterRightColumnLayouts_RightColumnPlaceHolder_0_'
52 'ctl00_0_ctl00_0_StandardPlaceHolder_2_ctl00_2_'
53 'rptBuyBoxes_2_lnkAddToCart_0"]')),
54 Click(ByXPath('//*[@id="checkoutButton"]')),
55 Click(ByXPath('//*[@id="cartcheckoutbtn"]')),
56 Click(ByXPath('//*[@id="buyasguest"]')),
57 TriggerAutofill(ByXPath('//*[@id="ShipTo_FirstName"]'), 'NAME_FIRST'),
58 ValidateFields([
59 (ByXPath('//*[@id="ShipTo_CountryCode"]'), 'ADDRESS_HOME_COUNTRY',
60 'US'),
61 (ByXPath('//*[@id="ShipTo_FirstName"]'), 'NAME_FIRST'),
62 (ByXPath('//*[@id="ShipTo_LastName"]'), 'NAME_LAST'),
63 (ByXPath('//*[@id="ShipTo_Line1"]'), 'ADDRESS_HOME_LINE1'),
64 (ByXPath('//*[@id="ShipTo_Line2"]'), 'ADDRESS_HOME_LINE2'),
65 (ByXPath('//*[@id="ShipTo_City"]'), 'ADDRESS_HOME_CITY'),
66 (ByXPath('//*[@id="USStates"]'), 'ADDRESS_HOME_STATE', 'CA'),
67 (ByXPath('//*[@id="ShipTo_PostalCode"]'), 'ADDRESS_HOME_ZIP'),
68 (ByXPath('//*[@id="ShipTo_PhoneNumber"]'),
69 'PHONE_HOME_CITY_AND_NUMBER'),
70 (ByXPath('//*[@id="ShipTo_EmailAddress"]'), 'EMAIL_ADDRESS'),
71 ])
72 ]
73
74
75 class TestLowesCom(AutofillTask):
76 def _create_script(self):
77 self.script = [
78 Open('http://www.lowes.com/pd/Weber-Original-Kettle-22-in-Black-'
79 'Porcelain-Enameled-Kettle-Charcoal-Grill/3055249'),
80 Type(ByXPath('//*[@id="zipcode-input"]'),
81 self.profile_data('ADDRESS_HOME_ZIP'), True),
82 Click(ByXPath('//button[contains(., \'Ok\')]'), True),
83 Click(ByXPath('//*[@id="storeList"]/li[1]/div/div[2]/button['
84 'contains(., \'Shop this store\')]'), True),
85 Wait(3),
86 Click(ByXPath('//button[contains(., \'Add To Cart\')]')),
87 Click(ByXPath('//a[contains(., \'View Cart\')]')),
88 Click(ByXPath('//*[@id="LDshipModeId_1"]')),
89 Click(ByXPath('//*[@id="ShopCartForm"]/div[2]/div[2]/a[contains(.,'
90 ' \'Start Secure Checkout\')]')),
91 Click(ByXPath('//*[@id="login-container"]/div[2]/div/div/div/a['
92 'contains(., \'Check Out\')]')),
93 TriggerAutofill(ByXPath('//*[@id="fname"]'), 'NAME_FIRST'),
94 ValidateFields([
95 (ByXPath('//*[@id="fname"]'), 'NAME_FIRST'),
96 (ByXPath('//*[@id="lname"]'), 'NAME_LAST'),
97 (ByXPath('//*[@id="company-name"]'), 'COMPANY_NAME'),
98 (ByXPath('//*[@id="address-1"]'), 'ADDRESS_HOME_LINE1'),
99 (ByXPath('//*[@id="address-2"]'), 'ADDRESS_HOME_LINE2'),
100 (ByXPath('//*[@id="city"]'), 'ADDRESS_HOME_CITY'),
101 (ByXPath('//*[@id="state"]'), 'ADDRESS_HOME_STATE', 'CA'),
102 (ByXPath('//*[@id="zip"]'), 'ADDRESS_HOME_ZIP'),
103 ]),
104 Click(ByXPath('//*[@id="revpay_com_order"]')),
105 Wait(1), # Buttons with the same xPath exists on both pages
106 Click(ByXPath('//*[@id="revpay_com_order"]')),
107 Wait(1), # Buttons with the same xPath exists on both pages
108 TriggerAutofill(ByXPath('//*[@name="cardNumber"]'),
109 'CREDIT_CARD_NUMBER'),
110 Type(ByXPath('//*[@id="s-code"]'),
111 self.profile_data('CREDIT_CARD_VERIFICATION_CODE')),
112 Type(ByXPath('//*[@id="billing-address-phone1"]'),
113 self.profile_data('PHONE_HOME_CITY_AND_NUMBER')),
114 Type(ByXPath('//*[@id="billingEmailAddress"]'),
115 self.profile_data('EMAIL_ADDRESS')),
116 ValidateFields([
117 (ByXPath('//*[@id="checkout-card-type"]'), 'CREDIT_CARD_TYPE'),
118 (ByXPath('//*[@name="cardNumber"]'), 'CREDIT_CARD_NUMBER'),
119 (ByXPath('//*[@id="s-code"]'), 'CREDIT_CARD_VERIFICATION_CODE'),
120 (ByXPath('//*[@id="expiration-month"]'), 'CREDIT_CARD_EXP_MONTH'),
121 (ByXPath('//*[@id="expiration-year"]'),
122 'CREDIT_CARD_EXP_4_DIGIT_YEAR'),
123 (ByXPath('//*[@id="billing-address-phone1"]'),
124 'PHONE_HOME_CITY_AND_NUMBER', '(650) 670-1234'),
125 (ByXPath('//*[@id="billingEmailAddress"]'), 'EMAIL_ADDRESS'),
126 ]),
127 Click(ByXPath('//*[@id="revpay_com_order"]'))
128 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698