diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a663f92..00b286e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/tests/behat/disable_in_layout.feature b/tests/behat/disable_in_layout.feature index 9175835..33d9569 100644 --- a/tests/behat/disable_in_layout.feature +++ b/tests/behat/disable_in_layout.feature @@ -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" diff --git a/views/warningbar/warningbar.js b/views/warningbar/warningbar.js index 92e55b0..21b2382 100644 --- a/views/warningbar/warningbar.js +++ b/views/warningbar/warningbar.js @@ -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();