Repository navigation
issue #463 - #724
issue #463#724Gaurang033 wants to merge 4 commits into
Conversation
…ssue robotframework#463 table_cell_should_not_contain table_column_should_not_contain table_footer_should_not_contain table_header_should_not_contain table_row_should_not_contain table_should_not_contain
aaltat
left a comment
There was a problem hiding this comment.
In practice code in new keywords looks quite OK. There are some updates needed, but they do not need big refactoring. I did not read acceptance test, but I will read those in near future.
| self.log_source(loglevel) | ||
| raise AssertionError(message) | ||
|
|
||
| def table_cell_should_not_contain(self, table_locator, row, column, expected, loglevel='INFO'): |
There was a problem hiding this comment.
For all the new code, try to follow pep8 maximum line length: https://www.python.org/dev/peps/pep-0008/#maximum-line-length. Fix in all places where it is exceeded in code which you have written. You do not need fix the existing code.
There was a problem hiding this comment.
Perhaps expected is not good argument name, because we expect that string is not there. Could not_contain or value be better argument names.
There was a problem hiding this comment.
I have kept all the arguments name same as other functions in the file to keep the consistency, if like I can change that.
There was a problem hiding this comment.
Please change only argument name only for new keywords. Changing the old ones would be backwards incompatible change and I am reluctant to do so.
| except AssertionError, err: | ||
| self._info(err) | ||
| self.log_source(loglevel) | ||
| raise AssertionError(message) |
There was a problem hiding this comment.
The exception text is not correct. It should say that:
Cell in table '%s' in row #%s and column #%s was not found
But the text is correct for the exception in line 105.
| % (table_locator, row, column, expected)) | ||
| try: | ||
| content = self.get_table_cell(table_locator, row, column, loglevel='NONE') | ||
| except AssertionError, err: |
There was a problem hiding this comment.
Write:
except AssertionError as err:
that is supported by Python 2 and Python 3
| `loglevel` argument. | ||
| """ | ||
| element = self._table_element_finder.find_by_col(self._current_browser(), table_locator, col, expected) | ||
| if element is not None: |
There was a problem hiding this comment.
It is more Python way to write:
if not element:
| self.log_source(loglevel) | ||
| raise AssertionError("Column #%s in table identified by '%s' " | ||
| "should not have contained text '%s'." | ||
| % (col, table_locator, expected)) |
There was a problem hiding this comment.
The indentation is not following pep8.
| self.log_source(loglevel) | ||
| raise AssertionError(message) | ||
| self._info("Cell contains %s." % content) | ||
|
|
| `loglevel` argument. | ||
| """ | ||
| element = self._table_element_finder.find_by_footer(self._current_browser(), table_locator, expected) | ||
| if element is not None: |
There was a problem hiding this comment.
It is more Python way to write:
if not element:
| `loglevel` argument. | ||
| """ | ||
| element = self._table_element_finder.find_by_header(self._current_browser(), table_locator, expected) | ||
| if element is not None: |
There was a problem hiding this comment.
It is more Python way to write:
if not element:
| See `Page Should Contain Element` for explanation about `loglevel` argument. | ||
| """ | ||
| element = self._table_element_finder.find_by_row(self._current_browser(), table_locator, row, expected) | ||
| if element is not None: |
There was a problem hiding this comment.
It is more Python way to write:
if not element:
| `loglevel` argument. | ||
| """ | ||
| element = self._table_element_finder.find_by_content(self._current_browser(), table_locator, expected) | ||
| if element is not None: |
There was a problem hiding this comment.
It is more Python way to write:
if not element:
|
Also you can add your name to the https://github.com/robotframework/Selenium2Library/blob/master/BUILD.rst file if you want credit. |
|
@aaltat I am not sure what you mean by the following comment.
|
|
You can add, if you want, your name to the file and short description what you have done. |
|
Ah but the file was wrong, here the correct file https://github.com/robotframework/Selenium2Library/blob/master/CHANGES.rst |
|
@aaltat That's what I was wondering. Should I mentioned the changes under 1.8.1 or create the new section 1.8.2 and mentioned under that? |
|
1.8.1 is the right one, it should actually say next release. |
|
Is that TODO comment valid one? |
|
Could you remove the comment then? This week is busy but I hope that I time in the weekend to read the code |
aaltat
left a comment
There was a problem hiding this comment.
Could you remove the ToDo comment
| % (table_locator, row, column, value)) | ||
| cell_not_exist_message = ("Cell in table '%s' in row #%s and column #%s was not found" | ||
| % (table_locator, row, column)) | ||
| # TODO new message as per comment |
There was a problem hiding this comment.
This line indicates that PR is not ready.
There was a problem hiding this comment.
Could you remove the comment, because it looks invalid
|
There are some comments for the test. |
|
|
||
| def table_cell_should_not_contain(self, table_locator, row, column, value, loglevel='INFO'): | ||
| """ | ||
| Verifies that a certain cell in a table does not contain `expected`. |
There was a problem hiding this comment.
Join lines 77 and 78 as a single line.
| self.log_source(loglevel) | ||
| raise AssertionError(message) | ||
|
|
||
| def table_cell_should_not_contain(self, table_locator, row, column, value, loglevel='INFO'): |
There was a problem hiding this comment.
Following PEP8[1] is required, fix the line length. Fix only in places where you did provide new code.
|
|
||
| *** Test Cases *** | ||
| Should Give Error Message When Content Found In Table | ||
| [Documentation] Should Give Error Message When Content Found In Table |
There was a problem hiding this comment.
Do repeats what test name says and therefore it is not needed. Remove the documentation.
| *** Keywords *** | ||
| Verify Table Does Contain With CSS And XPath Locators | ||
| [Arguments] ${locator} ${value} | ||
| [Documentation] Verify Table Contains With CSS And XPath Locators |
There was a problem hiding this comment.
Remove documentation because it repeats the keyword name.
|
|
||
|
|
||
| *** Keywords *** | ||
| Verify Table Does Contain With CSS And XPath Locators |
There was a problem hiding this comment.
Keyword does not have anything to do with the CSS or xpath locators. Better name for keyword could be: Table Should Not Contain keyword raises correct error when value is found from table.
| Test Table Row Should Give Error When It Contains | ||
| [Documentation] Test Table Row Should Give Error When It Contains | ||
| ${table}= set variable tableWithSingleHeader | ||
| ${value} = set variable tableWithSingleHeader_A1 |
There was a problem hiding this comment.
Value is an exact match, right? Expand test partial text too. Also add test when value is in table header and footer.
| [Documentation] Test Table column Should Not Contain | ||
| ${table}= set variable simpleTable | ||
| ${column}= set variable 1 | ||
| ${value} = set variable simpleTable_B2 |
There was a problem hiding this comment.
Value is an exact match, right? Expand test partial text too. Also add test when value is in table header and footer.
| [Documentation] Test Table column Should Give Error When It Contains | ||
| ${table}= set variable tableWithSingleHeader | ||
| ${column}= set variable 1 | ||
| ${value} = set variable tableWithSingleHeader_A1 |
There was a problem hiding this comment.
Value is an exact match, right? Expand test partial text too. Also add test when value is in table header and footer.
There was a problem hiding this comment.
The value is in the header, should I just rename the test case and add new where value is in footer? or modify this and add condition to verify when value is in footer.
There was a problem hiding this comment.
Use a way that feels the best for your. Both options are fine.
| [Documentation] Test Table Header Should Not Contain | ||
| ${table}= set variable tableWithSingleHeader | ||
| ${value} = set variable tableWithSingleHeader_A3 | ||
| table header should not contain ${table} ${value} |
There was a problem hiding this comment.
Add test when value is table body and table footer but value is not in table header.
There was a problem hiding this comment.
the value is in the body. Should I rename this test case to reflect that and add new test case to verify when value is in footer but not in header? or should I rename this test case to reflect both condition where value is in body and footer but not in header and add verification. I can't do that with single value as there is not table where same value is in footer and body but not in header. if you like I can create a new table.
There was a problem hiding this comment.
- Create test when value is not in header, body or footer, like with
tidiior something. - Test when value is in body (the current test)
- Create test when value is in footer.
These test can be combined to one test if it feels natural to write test in such way.
| [Documentation] Test Table Footer Should Not Contain | ||
| ${table}= set variable withHeadAndFoot | ||
| ${expected} = set variable withHeadAndFoot_A1 | ||
| table footer should not contain ${table} ${expected} |
There was a problem hiding this comment.
Add test where value is in table header and body.
There was a problem hiding this comment.
The value withHeadAndFoot_A1 is already in the body, should i just add one more verification where value is not in header and rename the test? or should I rename this test to verify that value is in body but not in footer and then add another test to verify where value is in footer but not in header?
|
Closing due inactivity. |
…ssue #463
table_cell_should_not_contain
table_column_should_not_contain
table_footer_should_not_contain
table_header_should_not_contain
table_row_should_not_contain
table_should_not_contain