Skip to content

Commit 8dfe93d

Browse files
committed
Test Domain Selection
- Added Domain suggestion, product fetching, and adding to cart API mocks - Select domain and confirm selection in UI tests
1 parent 317e04f commit 8dfe93d

File tree

5 files changed

+476
-0
lines changed

5 files changed

+476
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"request": {
3+
"urlPath": "/rest/v1.1/domains/suggestions",
4+
"method": "GET"
5+
},
6+
"response": {
7+
"status": 200,
8+
"jsonBody": [
9+
{
10+
"domain_name": "domainexample.com",
11+
"relevance": 1,
12+
"supports_privacy": true,
13+
"vendor": "donuts",
14+
"match_reasons": ["tld-common"],
15+
"product_id": 6,
16+
"product_slug": "domain_reg",
17+
"cost": "19,00\u00a0\u20ac",
18+
"raw_price": 19,
19+
"currency_code": "EUR"
20+
},
21+
{
22+
"domain_name": "domainexample.ink",
23+
"relevance": 1,
24+
"supports_privacy": true,
25+
"vendor": "donuts",
26+
"product_id": 359,
27+
"product_slug": "dotink_domain",
28+
"cost": "26,00\u00a0\u20ac",
29+
"raw_price": 26,
30+
"currency_code": "EUR"
31+
},
32+
{
33+
"domain_name": "domainexample.blog",
34+
"relevance": 0.99,
35+
"supports_privacy": true,
36+
"vendor": "donuts",
37+
"match_reasons": ["tld-common"],
38+
"product_id": 76,
39+
"product_slug": "dotblog_domain",
40+
"cost": "22,00\u00a0\u20ac",
41+
"raw_price": 22,
42+
"currency_code": "EUR",
43+
"sale_cost": 4.84
44+
},
45+
{
46+
"domain_name": "domainexample.org",
47+
"relevance": 0.98,
48+
"supports_privacy": true,
49+
"vendor": "donuts",
50+
"match_reasons": ["tld-common"],
51+
"product_id": 6,
52+
"product_slug": "domain_reg",
53+
"cost": "19,00\u00a0\u20ac",
54+
"raw_price": 19,
55+
"currency_code": "EUR"
56+
},
57+
{
58+
"domain_name": "domainexample.maison",
59+
"relevance": 0.93,
60+
"supports_privacy": true,
61+
"vendor": "donuts",
62+
"product_id": 200,
63+
"product_slug": "dotmaison_domain",
64+
"cost": "49,00\u00a0\u20ac",
65+
"raw_price": 49,
66+
"currency_code": "EUR"
67+
}
68+
],
69+
"headers": {
70+
"Content-Type": "application/json",
71+
"Connection": "keep-alive",
72+
"Cache-Control": "no-cache, must-revalidate, max-age=0"
73+
}
74+
}
75+
}
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
{
2+
"request": {
3+
"urlPattern": "/rest/v1.1/me/shopping-cart/*",
4+
"method": "POST"
5+
},
6+
"response": {
7+
"status": 200,
8+
"jsonBody": {
9+
"cart_generated_at_timestamp": 1684777767,
10+
"blog_id": 218645783,
11+
"cart_key": 218645783,
12+
"coupon": "",
13+
"coupon_discounts": [],
14+
"coupon_discounts_integer": [],
15+
"coupon_discounts_display": [],
16+
"is_coupon_applied": false,
17+
"next_domain_is_free": false,
18+
"next_domain_condition": "",
19+
"products": [{
20+
"product_id": 76,
21+
"billing_plan_id": "1562",
22+
"product_name": ".blog Domain Registration",
23+
"product_name_en": ".blog Domain Registration",
24+
"product_slug": "dotblog_domain",
25+
"product_cost": 22,
26+
"product_cost_display": "22\u00a0\u20ac",
27+
"product_cost_integer": 2200,
28+
"meta": "domainexample.blog",
29+
"cost": 4.84,
30+
"currency": "EUR",
31+
"volume": 1,
32+
"quantity": null,
33+
"current_quantity": null,
34+
"price_tier_minimum_units": null,
35+
"price_tier_maximum_units": null,
36+
"price_tier_transform_quantity_divide_by": null,
37+
"price_tier_transform_quantity_round": null,
38+
"free_trial": false,
39+
"introductory_offer_terms": null,
40+
"cost_before_coupon": 22,
41+
"coupon_savings": 0,
42+
"coupon_savings_integer": 0,
43+
"coupon_savings_display": "0\u00a0\u20ac",
44+
"is_sale_coupon_applied": true,
45+
"extra": {
46+
"privacy": true,
47+
"added_from_shopping_cart": true,
48+
"registrar": "KS_RAM",
49+
"domain_registration_agreement_url": "https:\/\/wordpress.com\/automattic-domain-name-registration-agreement\/",
50+
"privacy_available": true,
51+
"premium": false
52+
},
53+
"bill_period": "365",
54+
"months_per_bill_period": 12,
55+
"is_domain_registration": true,
56+
"time_added_to_cart": 1684777766,
57+
"is_bundled": false,
58+
"item_original_cost": 22,
59+
"item_original_cost_integer": 2200,
60+
"item_original_cost_display": "22\u00a0\u20ac",
61+
"item_original_monthly_cost_integer": 183,
62+
"item_original_monthly_cost_display": "1,83\u00a0\u20ac",
63+
"item_original_cost_for_quantity_one_integer": 900,
64+
"item_original_cost_for_quantity_one_display": "9\u00a0\u20ac",
65+
"item_subtotal_monthly_cost_integer": 17,
66+
"item_subtotal_monthly_cost_display": "0,17\u00a0\u20ac",
67+
"item_original_subtotal": 22,
68+
"item_original_subtotal_integer": 2200,
69+
"item_original_subtotal_display": "22\u00a0\u20ac",
70+
"item_subtotal": 4.84,
71+
"item_subtotal_integer": 484,
72+
"item_subtotal_display": "4,84\u00a0\u20ac",
73+
"item_tax": 0,
74+
"item_tax_rate": 0,
75+
"item_tax_breakdown": [],
76+
"item_total": 4.84,
77+
"item_total_integer": 484,
78+
"subscription_id": 0,
79+
"is_renewal": false,
80+
"domain_post_renewal_expiration_date": null,
81+
"cost_overrides": [{
82+
"old_price": 9,
83+
"new_price": 1.98,
84+
"reason": "Sale_Coupon->apply_sale_discount"
85+
}],
86+
"is_gift_purchase": false,
87+
"product_variants": []
88+
}],
89+
"unmerged_products": [{
90+
"product_id": 76,
91+
"billing_plan_id": "1562",
92+
"product_name": ".blog Domain Registration",
93+
"product_name_en": ".blog Domain Registration",
94+
"product_slug": "dotblog_domain",
95+
"product_cost": 9,
96+
"product_cost_display": "9\u00a0\u20ac",
97+
"product_cost_integer": 900,
98+
"meta": "domainexample.blog",
99+
"cost": 1.98,
100+
"currency": "EUR",
101+
"volume": 1,
102+
"quantity": null,
103+
"current_quantity": null,
104+
"price_tier_minimum_units": null,
105+
"price_tier_maximum_units": null,
106+
"price_tier_transform_quantity_divide_by": null,
107+
"price_tier_transform_quantity_round": null,
108+
"free_trial": false,
109+
"introductory_offer_terms": null,
110+
"cost_before_coupon": 9,
111+
"coupon_savings": 0,
112+
"coupon_savings_integer": 0,
113+
"coupon_savings_display": "0\u00a0\u20ac",
114+
"is_sale_coupon_applied": true,
115+
"extra": {
116+
"privacy": true,
117+
"added_from_shopping_cart": true,
118+
"registrar": "KS_RAM",
119+
"domain_registration_agreement_url": "https:\/\/wordpress.com\/automattic-domain-name-registration-agreement\/",
120+
"privacy_available": true,
121+
"premium": false
122+
},
123+
"bill_period": "365",
124+
"months_per_bill_period": 12,
125+
"is_domain_registration": true,
126+
"time_added_to_cart": 1684777766,
127+
"is_bundled": false,
128+
"item_original_cost": 9,
129+
"item_original_cost_integer": 900,
130+
"item_original_cost_display": "9\u00a0\u20ac",
131+
"item_original_monthly_cost_integer": 75,
132+
"item_original_monthly_cost_display": "0,75\u00a0\u20ac",
133+
"item_original_cost_for_quantity_one_integer": 900,
134+
"item_original_cost_for_quantity_one_display": "9\u00a0\u20ac",
135+
"item_subtotal_monthly_cost_integer": 17,
136+
"item_subtotal_monthly_cost_display": "0,17\u00a0\u20ac",
137+
"item_original_subtotal": 9,
138+
"item_original_subtotal_integer": 900,
139+
"item_original_subtotal_display": "9\u00a0\u20ac",
140+
"item_subtotal": 1.98,
141+
"item_subtotal_integer": 198,
142+
"item_subtotal_display": "1,98\u00a0\u20ac",
143+
"item_tax": 0,
144+
"item_tax_rate": 0,
145+
"item_tax_breakdown": [],
146+
"item_total": 1.98,
147+
"item_total_integer": 198,
148+
"subscription_id": 0,
149+
"is_renewal": false,
150+
"domain_post_renewal_expiration_date": null,
151+
"cost_overrides": [{
152+
"old_price": 9,
153+
"new_price": 1.98,
154+
"reason": "Sale_Coupon->apply_sale_discount"
155+
}],
156+
"is_gift_purchase": false,
157+
"product_variants": []
158+
}, {
159+
"product_id": 5,
160+
"billing_plan_id": "912",
161+
"product_name": "Domain Connection",
162+
"product_name_en": "Domain Connection",
163+
"product_slug": "domain_map",
164+
"product_cost": 13,
165+
"product_cost_display": "13\u00a0\u20ac",
166+
"product_cost_integer": 1300,
167+
"meta": "domainexample.com",
168+
"cost": 2.86,
169+
"currency": "EUR",
170+
"volume": 1,
171+
"quantity": null,
172+
"current_quantity": null,
173+
"price_tier_minimum_units": null,
174+
"price_tier_maximum_units": null,
175+
"price_tier_transform_quantity_divide_by": null,
176+
"price_tier_transform_quantity_round": null,
177+
"free_trial": false,
178+
"introductory_offer_terms": null,
179+
"cost_before_coupon": 13,
180+
"coupon_savings": 0,
181+
"coupon_savings_integer": 0,
182+
"coupon_savings_display": "0\u00a0\u20ac",
183+
"is_sale_coupon_applied": true,
184+
"extra": {
185+
"privacy": true,
186+
"added_from_shopping_cart": true
187+
},
188+
"bill_period": "365",
189+
"months_per_bill_period": 12,
190+
"is_domain_registration": false,
191+
"time_added_to_cart": 1684777767,
192+
"is_bundled": false,
193+
"item_original_cost": 13,
194+
"item_original_cost_integer": 1300,
195+
"item_original_cost_display": "13\u00a0\u20ac",
196+
"item_original_monthly_cost_integer": 108,
197+
"item_original_monthly_cost_display": "1,08\u00a0\u20ac",
198+
"item_original_cost_for_quantity_one_integer": 1300,
199+
"item_original_cost_for_quantity_one_display": "13\u00a0\u20ac",
200+
"item_subtotal_monthly_cost_integer": 24,
201+
"item_subtotal_monthly_cost_display": "0,24\u00a0\u20ac",
202+
"item_original_subtotal": 13,
203+
"item_original_subtotal_integer": 1300,
204+
"item_original_subtotal_display": "13\u00a0\u20ac",
205+
"item_subtotal": 2.86,
206+
"item_subtotal_integer": 286,
207+
"item_subtotal_display": "2,86\u00a0\u20ac",
208+
"item_tax": 0,
209+
"item_tax_rate": 0,
210+
"item_tax_breakdown": [],
211+
"item_total": 2.86,
212+
"item_total_integer": 286,
213+
"subscription_id": 0,
214+
"is_renewal": false,
215+
"domain_post_renewal_expiration_date": null,
216+
"cost_overrides": [{
217+
"old_price": 13,
218+
"new_price": 2.86,
219+
"reason": "Sale_Coupon->apply_sale_discount"
220+
}],
221+
"is_gift_purchase": false,
222+
"product_variants": []
223+
}],
224+
"total_cost": 4.84,
225+
"currency": "EUR",
226+
"total_cost_display": "4,84\u00a0\u20ac",
227+
"total_cost_integer": 484,
228+
"temporary": false,
229+
"tax": {
230+
"location": {},
231+
"display_taxes": false
232+
},
233+
"coupon_savings_total": 0,
234+
"coupon_savings_total_display": "0\u00a0\u20ac",
235+
"coupon_savings_total_integer": 0,
236+
"sub_total_with_taxes_display": "4,84\u00a0\u20ac",
237+
"sub_total_with_taxes_integer": 484,
238+
"sub_total": 4.84,
239+
"sub_total_display": "4,84\u00a0\u20ac",
240+
"sub_total_integer": 484,
241+
"total_tax": 0,
242+
"total_tax_display": "0\u00a0\u20ac",
243+
"total_tax_integer": 0,
244+
"total_tax_breakdown": [],
245+
"credits": 0,
246+
"credits_display": "0\u00a0\u20ac",
247+
"credits_integer": 0,
248+
"allowed_payment_methods": ["WPCOM_Billing_MoneyPress_Paygate", "WPCOM_Billing_PayPal_Express", "WPCOM_Billing_Stripe_Payment_Method", "WPCOM_Billing_MoneyPress_Stored", "WPCOM_Billing_Web_Payment"],
249+
"terms_of_service": [],
250+
"did_use_cached_taxes": false,
251+
"is_gift_purchase": false,
252+
"gift_details": null,
253+
"messages": {
254+
"errors": [],
255+
"success": [],
256+
"persistent_errors": []
257+
}
258+
},
259+
"headers": {
260+
"Content-Type": "application/json",
261+
"Connection": "keep-alive",
262+
"Cache-Control": "no-cache, must-revalidate, max-age=0"
263+
}
264+
}
265+
}

0 commit comments

Comments
 (0)