Skip to content

Add integration tests for collection estimation page #893

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

Closed
0pdd opened this issue Jun 21, 2018 · 15 comments · Fixed by #1115
Closed

Add integration tests for collection estimation page #893

0pdd opened this issue Jun 21, 2018 · 15 comments · Fixed by #1115
Assignees
Milestone

Comments

@0pdd
Copy link

0pdd commented Jun 21, 2018

The puzzle 884-d2a3ddba from #884 has to be resolved:

// @todo #884 Add integration tests for collection estimation page

The puzzle was created by Slava Semushin on 20-Jun-18.


I see that we can have at least the following 3 tests:

  1. Before Test Suite:

    • login as paid user (with a password test)
  2. Message should be shown when a collection is empty

    • open /collection/paid/estimation
    • the message "In this collection is no stamps" should be shown
  3. Series with its price should be taken into account

    • open /series/1 and it to the collection with a some price (let's use 100) and random currency
    • open /collection/paid/estimation page
    • the series should be listed and price should be 100 $currency (perhaps, we can use Table Row Should Contain for that? or Get Table Cell)
    • Total should be 100 $currency (perhaps, we can use Table Footer Should Contain for that?)
  4. Series without price should be shown but not taken into account

    • open /series/2
    • add this series without specifying a price
    • the series should be listed without price
    • Total should be the same as before (100 $currency)

Notes:

  • test cases should be placed into src/test/robotframework/collection/estimation/logic.robot file
@0pdd 0pdd added the techdebt label Jun 21, 2018
php-coder added a commit that referenced this issue Jun 15, 2019
php-coder added a commit that referenced this issue Jun 15, 2019
…stead of paid user.

Correction for dbb2185 commit.

Addressed to #893
@php-coder php-coder added this to the 0.4.1 milestone Aug 25, 2019
@mukeshk mukeshk self-assigned this Aug 28, 2019
@mukeshk
Copy link
Contributor

mukeshk commented Aug 28, 2019

"Selenium.Utils.Robot": Select Random Option From List, - doesn't support option to skip a blank option element. Can I add an argument startIndex, which will indicate the start index in the options list?
So if we configure,
Select Random Option From List id="paid-currency" 1
in another place, where the first option is not blank we can pass
Select Random Option From List id=catalogName 0

The idea was to reuse random selection keyword which we implemented earlier.

@php-coder
Copy link
Owner

php-coder commented Aug 28, 2019

@mukeshk Thank you for the good question! Yes, I think we should modify this keyword and re-use it. But I'd suggest to implement it a little differently:

  • add parameter "ignoreEmptyOption" and set it to false by default (for backward compatibility; do we need it?)
  • use if + Remove Values From List to remove an empty value when this option is set to true

WDYT?

@mukeshk
Copy link
Contributor

mukeshk commented Aug 28, 2019 via email

@mukeshk
Copy link
Contributor

mukeshk commented Aug 28, 2019

${options}=                Get List Items  ${locator}
${size}=                   Get Length  ${options}
${randomIndex}=            Evaluate  random.randint(0, ${size}-1)  modules=random
Select From List By Index  ${locator}  ${randomIndex}

if we remove empty values from ${options} . Then we will not able to correctly identify the index , since size of array will change.

  1. Should we have ignoreFirstOption?
    Or
  2. Should we change
Get List Items ${locator}  - to - Get List Items ${locator} value=${True}
    Run Keyword If ${ignoreEmptyValue}  .... remove..
    ${size}=                   Get Length  ${options}
    ${randomValue}=            Evaluate  random.randint(0, ${size}-1)  modules=random
    Select From List By Value  ${locator}  ${randomValue}
    

@php-coder
Copy link
Owner

@mukeshk Very good point!

I agree that we should use Select From List By Value instead of Select From List By Index in this case.

Select From List By Value  ${locator}  ${randomValue}

Should be something like

     Select From List By Value  ${locator}  @{options}[${randomValue}]

@php-coder
Copy link
Owner

@mukeshk
Copy link
Contributor

mukeshk commented Aug 29, 2019

image

Remove Values From List ${options} "" ' ' '' null is not working as expected.
the original drop-down contains five options.

image

Should we change the first option to value="" in the series/info.html.

@mukeshk
Copy link
Contributor

mukeshk commented Aug 29, 2019

image

in the collection\estimation.html page - for the cell are represented by th instead of td.
The above image i have converted the th to td.
The keyword "Table Footer Should Contain" works with tfoot - containing - td .
it does not work with a tfoot containing th.

If I convert the th to td, we lose the bold formatting, should i apply bold tag to the content so that it looks like th - text content.

@mukeshk
Copy link
Contributor

mukeshk commented Aug 29, 2019

We get the data table error after we submit the "add-series-form".
The same which is due to the charts. So this test also we need to tag as unstable.

@php-coder
Copy link
Owner

php-coder commented Aug 29, 2019

Remove Values From List ${options} "" ' ' '' null is not working as expected.

It's not what I expected actually :) Would it work with ${EMPTY}?

Remove Values From List ${options}  ${EMPTY}

@php-coder
Copy link
Owner

The keyword "Table Footer Should Contain" works with tfoot - containing - td . it does not work with a tfoot containing th.

Thanks for finding and reporting this! I've done the same -- reported it back to upstream: MarketSquare/robotframework-seleniumlibrary-java#88

As I looked to the sources I found out that due to a little weird behavior of "Table Header Should Contain" we can use it for checking the footer :) See MarketSquare/robotframework-seleniumlibrary-java#89 for details.

What do you think?

@php-coder
Copy link
Owner

P.S. Anyway, it both these keywords won't work for us, we can get elements and their text by CSS/XPath/etc as we do with other elements.

@php-coder
Copy link
Owner

We get the data table error after we submit the "add-series-form". The same which is due to the charts. So this test also we need to tag as unstable.

Hm, you're right. Thank you for letting me know.

By the way, if you have a code, it's always better to discuss details in the PR ;)

@mukeshk
Copy link
Contributor

mukeshk commented Aug 29, 2019

Remove Values From List ${options} "" ' ' '' null is not working as expected.

It's not what I expected actually :) Would it work with ${EMPTY}?

Remove Values From List ${options}  ${EMPTY}

You rock !!! it works :)

@mukeshk
Copy link
Contributor

mukeshk commented Aug 29, 2019

The keyword "Table Footer Should Contain" works with tfoot - containing - td . it does not work with a tfoot containing th.

Thanks for finding and reporting this! I've done the same -- reported it back to upstream: Hi-Fi/robotframework-seleniumlibrary-java#88

As I looked to the sources I found out that due to a little weird behavior of "Table Header Should Contain" we can use it for checking the footer :) See Hi-Fi/robotframework-seleniumlibrary-java#89 for details.

What do you think?

Again Table Header Should Contain ... It works.

mukeshk added a commit to mukeshk/mystamps that referenced this issue Sep 1, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Sep 1, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Sep 1, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Sep 2, 2019
0pdd referenced this issue Sep 2, 2019
@php-coder php-coder added the estimation/30m Estimated time: 30 minutes label Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants