Skip to content

Commit

Permalink
[#530] TEST: more attribute..value_containing.each cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yashaka committed Jul 17, 2024
1 parent eb62e5a commit 54a4bf5
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@

def test_have_attribute__condition_variations(session_browser):
browser = session_browser.with_(timeout=0.1)
s = lambda selector: browser.element(selector)
ss = lambda selector: browser.all(selector)
GivenPage(session_browser.driver).opened_with_body(
GivenPage(browser.driver).opened_with_body(
'''
<ul>Hey:
<ul class="names">Hey:
<li><label>First Name:</label> <input type="text" class="name" id="firstname" value="John 20th"></li>
<li><label>Last Name:</label> <input type="text" class="name" id="lastname" value="Doe 2nd"></li>
</ul>
<ul>Your training today:
<ul class="exercises">Your training today:
<li><label>Pull up:</label><input type="text" class='exercise' id="pullup" value="20"></li>
<li><label>Push up:</label><input type="text" class='exercise' id="pushup" value="30"></li>
</ul>
Expand All @@ -48,7 +49,7 @@ def test_have_attribute__condition_variations(session_browser):
names = browser.all('.name')
exercises = browser.all('.exercise')

# the following passes too, cause js prop exists, are we ok with that?
# todo: the following passes too, cause js prop exists, are we ok with that?
browser.element('ul').should(have.attribute('id'))

names.should(have.attribute('id').values('firstname', 'lastname'))
Expand Down Expand Up @@ -118,6 +119,13 @@ def test_have_attribute__condition_variations(session_browser):
'lastname\n'
'Screenshot: '
) in str(error)
# - just in case... trying to cover more complex examples:
s('ul.names').all('.name').should(
have.attribute('id').value_containing('name').each
)
s('body').element('ul.names').all('.name').should(
have.attribute('id').value_containing('name').each
)
# assuming two inputs for names: #firstname and #lastname
# not each name contain 'first' (one contain 'last' instead of 'first')
names.should(have.attribute('id').value_containing('first').each.not_)
Expand Down

0 comments on commit 54a4bf5

Please sign in to comment.