Skip to content

Commit

Permalink
Fix behat test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Nguyen committed Jun 30, 2022
1 parent 0344500 commit 32ded95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ on: [push, pull_request]
jobs:
test:
uses: catalyst/catalyst-moodle-workflows/.github/workflows/group-39-plus-ci.yml@main
with:
disable_behat: true
3 changes: 1 addition & 2 deletions tests/behat/disable_in_layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Feature: Disable warning bar in embedded layout
| Name | ipsumFile |
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Select files" filemanager
And I press "Save and return to course"
And I follow "PageName1"
And I navigate to "Edit settings" in current page administration
And I am on the PageName1 "page activity editing" page
And I click on "Insert H5P" "button" in the "#fitem_id_page" "css_element"
And I click on "Browse repositories..." "button" in the "Insert H5P" "dialogue"
And I click on "Server files" "link" in the ".fp-repo-area" "css_element"
Expand Down
13 changes: 11 additions & 2 deletions views/warningbar/warningbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,17 @@ var authOutageWarningBar = {
xmlhttp.open("GET", this.checkfinishedurl, true);
xmlhttp.send();

// Checking if the site is back online every 4-6 minutes.
var sleepSeconds = 4 * MINSECS + (2 * MINSECS * Math.random());
// Date now and client time is in milliseconds while server time is in seconds.
var estimatedServerTime = this.servertime + ((Date.now() - this.clienttime) / 1000);
var sleepSeconds = this.stops - estimatedServerTime; // How long to sleep until it stops.

if (sleepSeconds <= MINSECS) {
// Checking every 5 seconds.
sleepSeconds = 5;
} else {
// Checking if the site is back online every 4-6 minutes.
sleepSeconds = 4 * MINSECS + (2 * MINSECS * Math.random());
}

setTimeout(function() {
$this.tickOngoing();
Expand Down

0 comments on commit 32ded95

Please sign in to comment.