Skip to content

Commit c5c8058

Browse files
authored
Wait for animation support fading (#63)
* Init modal fade demo * Wait for animation also check visible
1 parent 30ae3d1 commit c5c8058

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Examples/utilities/wait.robot

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ Wait for element is enabled
5858
Wait Until Element Is Enabled id=prop-enable
5959
Click Element id=prop-enable
6060

61+
Wait for element finished moving animation
62+
Open browser to test page ${HOME_PAGE_URL}
63+
Run Async Keywords
64+
... Wait Until Element Is Visible id=close_modal AND
65+
... Click Element id=popup_modal
66+
Wait Until Element Finished Animating id=close_modal
67+
Click Element id=close_modal
68+
Wait Until Element Is Hidden id=close_modal
69+
70+
Wait for element finished fading animation
71+
Open browser to test page ${HOME_PAGE_URL}
72+
Run Async Keywords
73+
... Wait Until Element Is Visible id=close_modal_fade AND
74+
... Click Element id=popup_modal_fade
75+
Wait Until Element Finished Animating id=close_modal_fade timeout=1s
76+
Click Element id=close_modal_fade
77+
Wait Until Element Is Hidden id=close_modal_fade
6178

6279
*** Keywords ***
6380
Open browser to test page

PuppeteerLibrary/puppeteer/async_keywords/puppeteer_waiting.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ async def validate_is_enabled():
139139
async def wait_until_element_finished_animating(self, locator, timeout=None):
140140
prev_rect_tmp = { 'value': None }
141141
async def check_finished_animating():
142+
await self.wait_until_element_is_visible(locator)
142143
element = await self.library_ctx.get_current_page().querySelector_with_selenium_locator(locator)
143144
if prev_rect_tmp['value'] is None:
144145
prev_rect_tmp['value'] = await element.boundingBox()

demoapp/html/basic-html-elements.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,23 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
77

8+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
9+
810
<!-- Bootstrap CSS -->
911
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
1012
<link rel="stylesheet" href="css/basic-html-elements.css" media="all" type="text/css">
1113
<title>Basic HTML Elements</title>
14+
15+
<style>
16+
.fade2 {
17+
opacity: 0;
18+
transition: all 0.5s linear;
19+
}
20+
21+
.fade2.show {
22+
opacity: 1;
23+
}
24+
</style>
1225
</head>
1326
<body>
1427

@@ -226,6 +239,11 @@ <h2>Modal</h2>
226239
Launch demo modal
227240
</button>
228241
</div>
242+
<div class="row" style="margin-top: 20px;">
243+
<button id="popup_modal_fade" type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalFade">
244+
Launch demo modal fade
245+
</button>
246+
</div>
229247
<hr>
230248
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
231249
<div class="modal-dialog" role="document">
@@ -245,6 +263,26 @@ <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
245263
</div>
246264
</div>
247265
</div>
266+
267+
<div class="modal fade2" id="exampleModalFade" tabindex="-1" role="dialog" aria-labelledby="exampleModalFade" aria-hidden="true">
268+
<div class="modal-dialog" id="exampleModalFadeDialog" role="document">
269+
<div class="modal-content">
270+
<div class="modal-header">
271+
<h5 class="modal-title" id="exampleModalFadeTitle">Fade Modal title</h5>
272+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
273+
<span aria-hidden="true">&times;</span>
274+
</button>
275+
</div>
276+
<div class="modal-body">
277+
...
278+
</div>
279+
<div class="modal-footer">
280+
<button id="close_modal_fade" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
281+
</div>
282+
</div>
283+
</div>
284+
</div>
285+
248286
</div>
249287

250288
<div class="container">

0 commit comments

Comments
 (0)