Skip to content

Search by catalog number: add integration test for an empty result #1066

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
php-coder opened this issue Jul 2, 2019 · 11 comments
Closed

Search by catalog number: add integration test for an empty result #1066

php-coder opened this issue Jul 2, 2019 · 11 comments
Assignees
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Jul 2, 2019

Create the following test:

  • open a main page
  • fill Search by catalog form:
    • provide non-existent catalog number (let's say 888)
    • chose a catalog (let's pick a random one from Michel/Scott/Yvert/Gibbons)
    • click on the Search button
  • ensure that the resulted page contains the message No series found

Requirements:

  • the test should be located in the src/test/robotframework/series/search/logic.robot file

Hint:

Extracted from #340 to reduce the scope.

@mukeshk
Copy link
Contributor

mukeshk commented Jul 8, 2019

@mukeshk
Copy link
Contributor

mukeshk commented Jul 8, 2019

No series found

- should we add an id to this element for checking the text value ?

@php-coder
Copy link
Owner Author

https://stackoverflow.com/questions/55791753/robot-framework-random-selection-of-drop-downs.
Can we use this solution?

Unfortunatelly, no, we can't use it because it requires a library on Python while we use Robot Framework that is running under JVM. Anyway, it makes a little sense to add a dependency on a library for just a few lines.

should we add an id to this element for checking the text value ?

Definitely, we should. In most of the cases, when there is no id, we should add it.

@mukeshk
Copy link
Contributor

mukeshk commented Jul 8, 2019 via email

@mukeshk
Copy link
Contributor

mukeshk commented Jul 9, 2019

image

@mukeshk
Copy link
Contributor

mukeshk commented Jul 9, 2019

I am able to access the list. I get the length of items. Is there any way I can get a random number between 0 and ListLength-1. which I can pass use for setting the selected index.

@php-coder
Copy link
Owner Author

Is there any way I can get a random number between 0 and ListLength-1. which I can pass use for setting the selected index.

Hey, good question! Thank you!

It seems that we can use Evaluate keyword and execute random.randint() function from Python:

@php-coder
Copy link
Owner Author

php-coder commented Jul 9, 2019

P.S. Could you, please, create a separate keyword Select Random Option From List for that and put it to src/test/robotframework/selenium.utils.robot so we can re-use it across the tests? This keyword should get a locator of the <select> element and choose a random option from this element.

@mukeshk
Copy link
Contributor

mukeshk commented Jul 9, 2019

Yes.

Search non existent catalog number results in no series found
Input Text id=catalogNumber 888
${catalogItems} = Get List Items catalogName
${catalogListLength}= Get Length ${catalogItems}
${randomCatalogIndex}= Evaluate random.randint(0,${catalogListLength}) random
log to console \nvalue: ${randomCatalogIndex}
Select from list by index catalogName ${randomCatalogIndex}
Submit Form id=search-series-form
Element Text Should Be id=no-series-found No series found

@mukeshk
Copy link
Contributor

mukeshk commented Jul 9, 2019

I will try to move a few steps to reusable keyword

@php-coder
Copy link
Owner Author

If you have some code, why not submit it as a pull request? Just prepend PR's title with [WIP] to show that you still work on it. In this case, it will be easier to me to help you and I'll be able to put a commit on a particular line, for example.

mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 12, 2019
@php-coder php-coder added the estimation/20m Estimated time: 20 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

No branches or pull requests

2 participants