Commit e6fb4a89 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: update the relative times of posts periodically

otherwise the test stays on "a few seconds ago" and this becomes "wrong
information", unlike an absolute date with stays correct.
parent 65a57d30
......@@ -257,6 +257,14 @@
return queue;
});
})
.onLoop(function () {
// update relative time
this.element.querySelectorAll("li>time").forEach(
function (element) {
element.textContent = moment(element.getAttribute('datetime')).fromNow();
}
);
}, 5000)
.onEvent('submit', function () {
this.submitPostComment();
});
......
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1539140577.69</float>
<float>1539939405.65</float>
<string>GMT+9</string>
</tuple>
</state>
......
......@@ -198,6 +198,37 @@ post ingested when submitting a new support request.
<td>Post test 2</td>
</tr>
<!-- The post show a relative time -->
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]//li[3]/time</td>
<td>a few seconds ago</td>
</tr>
<!-- This relative time will be updated periodically.
To prove this, we break the text, wait 6 seconds - because this is refreshed every 5 seconds
and check that the relative time was updated.
-->
<tr>
<td>assertEval</td>
<td>(function(){
selenium.browserbot.findElement('//ol[@id="post_list"]//li[3]/time').textContent = "this will be updated";
return "ok";
})()</td>
<td>ok</td>
</tr>
<tr>
<td>pause</td> <!-- we are waiting for the next onLoop tic -->
<td>6000</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]//li[3]/time</td>
<td>a few seconds ago</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment