Skip to content

Commit

Permalink
Merge pull request #4557 from Sebastian-Webster/fix-line-realtime-test
Browse files Browse the repository at this point in the history
fix: line/realtime test
  • Loading branch information
junedchhipa committed Jul 6, 2024
2 parents 0b60df9 + 0cf0752 commit 20863df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion samples/source/line/realtime.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ legend: {
</chart>

<vanilla-js-script>
window.setInterval(function () {
var intervalRuns = 0;
var interval = window.setInterval(function () {
intervalRuns++
getNewSeries(lastDate, {
min: 10,
max: 90
Expand All @@ -113,6 +115,10 @@ window.setInterval(function () {
chart.updateSeries([{
data: data
}])

if (intervalRuns === 2 && window.isATest === true) {
clearInterval(interval)
}
}, 1000)
</vanilla-js-script>

Expand Down
8 changes: 7 additions & 1 deletion samples/vanilla-js/line/realtime.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@
chart.render();


window.setInterval(function () {
var intervalRuns = 0;
var interval = window.setInterval(function () {
intervalRuns++
getNewSeries(lastDate, {
min: 10,
max: 90
Expand All @@ -161,6 +163,10 @@
chart.updateSeries([{
data: data
}])

if (intervalRuns === 2 && window.isATest === true) {
clearInterval(interval)
}
}, 1000)

</script>
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ async function processSample(page, sample, command) {
page.on('pageerror', (error) => consoleErrors.push(error.message))

await page.evaluateOnNewDocument(() => {
window.isATest = true

//Keep track of running timers and intervals in the page
window.activeTimerCount = 0
window.activeIntervalCount = 0
Expand Down

0 comments on commit 20863df

Please # to comment.