Skip to content

Add integration tests for collection estimation page #1115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public String showInfoBySlug(
return "collection/info";
}

// @todo #884 Add integration tests for collection estimation page
@GetMapping(CollectionUrl.ESTIMATION_COLLECTION_PAGE)
public String showPrices(
@PathVariable("slug") String slug,
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/views/collection/estimation.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ <h3 class="text-center" th:text="#{t_collection_of(${ownerName})}">
</h3>

<!--/*/
<p class="text-center" th:if="${#lists.isEmpty(seriesOfCollection)}" th:text="#{t_empty_collection}">
<p id="empty-collection-msg" class="text-center" th:if="${#lists.isEmpty(seriesOfCollection)}" th:text="#{t_empty_collection}">
In this collection is no stamps
</p>
/*/-->

<table class="table table-hover" th:if="${not #lists.isEmpty(seriesOfCollection)}">
<table id="collection-estimation" class="table table-hover" th:if="${not #lists.isEmpty(seriesOfCollection)}">
<thead>
<tr class="active">
<th th:text="#{t_series}">Series</th>
Expand Down
44 changes: 44 additions & 0 deletions src/test/robotframework/collection/estimation/logic.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
*** Settings ***
Documentation Verify collection estimation scenarios
Library SeleniumLibrary
Resource ../../auth.steps.robot
Resource ../../selenium.utils.robot
Suite Setup Before Test Suite
Suite Teardown Close Browser
Force Tags collection estimation logic

*** Test Cases ***
Message should be shown when a collection is empty
Go To ${SITE_URL}/collection/paid/estimation
Element Text Should Be id=empty-collection-msg In this collection is no stamps

Series with its price should be taken into account
[Tags] unstable
Go To ${SITE_URL}/series/1
Input Text id=paid-price 100
Select From List By Value id=paid-currency ${expectedCurrency}
Submit Form id=add-series-form
Go To ${SITE_URL}/collection/paid/estimation
Table Cell Should Contain collection-estimation row=2 column=2 text=100.00 ${expectedCurrency}
# TODO: use "Table Footer Should Contain" instead, when it will be fixed.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, I forgot that we shouldn't use TODO as 0pdd is also looking on it:

ERROR: src/test/robotframework/collection/estimation/logic.robot; puzzle at line #23; TODO found, but puzzle can't be parsed, most probably because TODO is not followed by a puzzle marker, as this page explains: https://github.com/yegor256/pdd#how-to-format

I'll fix it later.

# See https://github.com/Hi-Fi/robotframework-seleniumlibrary-java/issues/88
Table Header Should Contain collection-estimation 100.00 ${expectedCurrency}

Series without price should be shown but not taken into account
[Tags] unstable
Go To ${SITE_URL}/series/2
Submit Form id=add-series-form
Go To ${SITE_URL}/collection/paid/estimation
Table Cell Should Contain collection-estimation row=3 column=2 text=${EMPTY}
# TODO: use "Table Footer Should Contain" instead, when it will be fixed.
# See https://github.com/Hi-Fi/robotframework-seleniumlibrary-java/issues/88
Table Header Should Contain collection-estimation 100.00 ${expectedCurrency}

*** Keywords ***
Before Test Suite
@{currencies}= Create List USD EUR RUB CZK
${randomCurrency}= Evaluate random.choice(${currencies}) modules=random
Set Suite Variable ${expectedCurrency} ${randomCurrency}
Open Browser ${SITE_URL}/account/auth ${BROWSER}
Register Keyword To Run On Failure Log Source
Log In As login=paid password=test