-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathrequest-logic.robot
167 lines (156 loc) · 9.15 KB
/
request-logic.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
*** Settings ***
Documentation Verify scenarios of importing a series from an external site
Library SeleniumLibrary
Library DateTime
Resource ../../auth.steps.robot
Resource ../../selenium.utils.robot
Suite Setup Before Test Suite
Suite Teardown Close Browser
Test Setup Before Test
Force Tags series import-series logic
*** Test Cases ***
Import series from an external site (in English, use category, country and date locators)
[Documentation] Verify import from a page in English and with different locators
[Tags] htmx
${importUrl}= Set Variable http://127.0.0.1:8080/series/2?lang=en
Input Text id:url ${importUrl}
Submit Form id:import-series-form
${requestLocation}= Get Location
${category}= Get Selected List Label id:category
${country}= Get Selected List Label id:country
${quantity}= Get Value id:quantity
${year}= Get Selected List Label id:year
Element Text Should Be id:request-url ${importUrl}
Element Text Should Be id:request-status ParsingSucceeded
Should Be Equal ${category} Prehistoric animals
Should Be Equal ${country} Italy
Should Be Empty ${quantity}
Checkbox Should Be Selected id:perforated
Textfield Value Should Be id:image-url http://127.0.0.1:8080/image/1
Should Be Equal ${year} 2000
Input Text id:quantity 1
Submit Form id:create-series-form
${seriesLocation}= Get Location
Element Text Should Be id:category_name Prehistoric animals
Element Text Should Be id:country_name Italy
Element Text Should Be id:issue_date 2000
Element Text Should Be id:quantity 1
Element Text Should Be id:perforated Yes
# @todo #749 /series/{id}: add integration test that import info is only visible to admin
Element Text Should Be id:import-info ${importUrl}
Page Should Contain Image id:series-image-1
Go To ${requestLocation}
Element Text Should Be id:request-status ImportSucceeded
Element Should Be Disabled id:category
Element Should Be Disabled id:country
Page Should Not Contain Element id:quantity
Page Should Not Contain Element id:perforated
Element Should Be Disabled id:image-url
Element Should Be Disabled id:year
Page Should Not Contain Element id:create-series-btn
Page Should Contain Link link:${seriesLocation}
Import series from an external site (in Russian, use description locator)
[Documentation] Verify import from a page in Russian and shared locator
Input Text id:url http://localhost:8080/series/2?lang=ru&str=тест
Submit Form id:import-series-form
${category}= Get Selected List Label id:category
${country}= Get Selected List Label id:country
${quantity}= Get Value id:quantity
${year}= Get Selected List Label id:year
Element Text Should Be id:request-url http://localhost:8080/series/2?lang=ru&str=тест
Element Text Should Be id:request-status ParsingSucceeded
Should Be Equal ${category} Prehistoric animals
Should Be Equal ${country} Italy
Should Be Empty ${quantity}
Checkbox Should Be Selected id:perforated
Textfield Value Should Be id:image-url http://localhost:8080/image/1
Should Be Equal ${year} 2000
Import series from external site with catalog numbers (use description locator)
[Documentation] Verify import of catalog numbers by extracting them from a description
[Tags] htmx
Input Text id:url ${MOCK_SERVER}/series/import/request-logic/catalog-numbers-in-description.html
Submit Form id:import-series-form
Textfield Value Should Be id:michel-numbers 2242-2246
Submit Form id:create-series-form
Element Text Should Be id:michel_catalog_info \#2242-2246
Click Link id:import-request-link
Element Should Be Disabled id:michel-numbers
Import series when a page in a non-utf-8 charset
[Documentation] Verify that a page's charset is respected
Input Text id:url ${MOCK_SERVER}/series/import/request-logic/charset-windows-1251.html
Submit Form id:import-series-form
Element Text Should Be id:request-status ParsingSucceeded
${category}= Get Selected List Label id:category
${country}= Get Selected List Label id:country
Should Be Equal ${category} Prehistoric animals
Should Be Equal ${country} Italy
Import series and series sale with existing seller from an external site
[Documentation] Verify import series and sale (with existing seller)
[Tags] htmx
Input Text id:url ${MOCK_SERVER}/series/import/request-logic/existing-seller.html
Submit Form id:import-series-form
${requestLocation}= Get Location
# sale info should be parsed and shown at the request page
List Selection Should Be id:seller Eicca Toppinen
Textfield Value Should Be id:price 111
List Selection Should Be id:currency RUB
Textfield Value Should Be id:alt-price 1.5
List Selection Should Be id:alt-currency EUR
Submit Form id:create-series-form
# after importing a series, sale info should be shown at the info page
${currentDate}= Get Current Date result_format=%d.%m.%Y
Element Text Should Be id:series-sale-1-info ${currentDate} Eicca Toppinen was selling for 111.00 RUB (1.50 EUR)
Link Should Point To id:series-sale-1-seller http://example.com/eicca-toppinen
Link Should Point To id:series-sale-1-transaction ${MOCK_SERVER}/series/import/request-logic/existing-seller.html
Go To ${requestLocation}
# after importing a series, sale info at the request page should be shown as read-only
Element Should Be Disabled id:seller
Element Should Be Disabled id:price
Element Should Be Disabled id:currency
Element Should Be Disabled id:alt-price
Element Should Be Disabled id:alt-currency
Import series and series sale with a new seller from an external site
[Documentation] Verify import series and sale (with a new seller)
[Tags] htmx
Input Text id:url ${MOCK_SERVER}/series/import/request-logic/new-seller.html
Submit Form id:import-series-form
${requestLocation}= Get Location
# seller info should be parsed and shown at the request page
${group}= Get Selected List Label id:seller-group
Should Be Equal ${group} example.com
Textfield Value Should Be id:seller-name Lando Livianus
Textfield Value Should Be id:seller-url http://example.com/lando-livianus
Submit Form id:create-series-form
# after importing a series, sale info should contain a new seller
${currentDate}= Get Current Date result_format=%d.%m.%Y
Element Text Should Be id:series-sale-1-info ${currentDate} Lando Livianus was selling for 320.50 RUB
Link Should Point To id:series-sale-1-seller http://example.com/lando-livianus
# @todo #857 Check that a just created seller belongs to the "example.com" group
Go To ${requestLocation}
# after importing a series, sale info at the request page should be shown as read-only
Element Should Be Disabled id:seller-group
Element Should Be Disabled id:seller-name
Element Should Be Disabled id:seller-url
Submit a request that will fail to download a file
Input Text id:url ${MOCK_SERVER}/series/response-404
Submit Form id:import-series-form
Element Text Should Be id:request-status DownloadingFailed
Submit a request with a document that couldn't be parsed
[Documentation] Verify submitting a URL with an empty HTML document
Input Text id:url ${MOCK_SERVER}/series/import/request-logic/simple.html
Submit Form id:import-series-form
Element Text Should Be id:request-status ParsingFailed
Retry of downloading allows the import to be succeed
[Documentation] Verify that a failed request can be re-triggered
Go To ${SITE_URL}/series/import/request/1
Element Text Should Be id:request-url http://127.0.0.1:8080/series/1?lang=en
Element Text Should Be id:request-status DownloadingFailed
Submit Form id:retry-import-series-form
Element Text Should Be id:request-status ParsingSucceeded
*** Keywords ***
Before Test Suite
Open Browser ${SITE_URL}/account/auth ${BROWSER}
Register Keyword To Run On Failure Log Source
Log In As login=admin password=test
Before Test
Go To ${SITE_URL}/series/import/request