Skip to content

Commit

Permalink
chore(ci): force refresh page on firefox browser
Browse files Browse the repository at this point in the history
A simple driver.refresh() wouldn't refresh script cache for web
workers. Thus leading to page not fully charged and having all
test and benchmarks buttons in disabled state.
That triggering timeout while browsing with Selenium.

Console log print has also been curated for Chrome browser.
  • Loading branch information
soonum committed Oct 14, 2024
1 parent 41b3edf commit ff0609f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
15 changes: 13 additions & 2 deletions ci/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver import Keys
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.common.by import By
Expand Down Expand Up @@ -223,15 +224,25 @@ def print_log(self, log_type):
if "using deprecated parameters" in log["message"]:
continue

print(f"{log['level']}: {log['message']}")
# String pattern is `<server url> <line:col> "<log message>"`
# We only care for <log message> part.
content = log["message"].split(maxsplit=2)[-1].strip('"')
print(f"{log['level']}: {content}")

def _threaded_logs(self):
while not self.shutting_down:
self.print_log("browser")
time.sleep(0.2)

def refresh(self):
self.get_driver().refresh()
match self.browser_kind:
case BrowserKind.chrome:
self.get_driver().refresh()
case BrowserKind.firefox:
# Need to force refresh in Firefox to avoid script caching by web workers
self.get_driver().find_element(By.TAG_NAME, "body").send_keys(
Keys.CONTROL + Keys.SHIFT + "R"
)

def quit(self):
self.shutting_down = True
Expand Down
29 changes: 17 additions & 12 deletions tfhe/web_wasm_parallel_tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,36 @@
value="Compressed Compact Public Key Test 256 Bits Small"
disabled
/>

<input
type="button"
id="compressedCompactPublicKeyTest256BitBig"
value="Compressed Compact Public Key Test 256 Bits Big"
disabled
/>

<input
type="button"
id="compactPublicKeyZeroKnowledgeTest"
value="Compact Public Key Test 64 Bits Big With Zero Knowledge Proof"
max="3600"
disabled
/>

<input
type="button"
id="compactPublicKeyWithCastingTest256Bit"
value="Compact Public Key With Casting Test 256 Bit"
disabled
/>

<input
type="button"
id="compressedCompactPublicKeyWithCastingTest256Bit"
value="Compressed Compact Public Key With Casting Test 256 Bit"
disabled
/>

<input type="checkbox" id="testSuccess" disabled />
<label for="testSuccess"> TestSuccess </label><br />

Expand Down Expand Up @@ -81,18 +98,6 @@
value="Compact Public Key Bench 256 Bits Big"
disabled
/>
<input
type="button"
id="compactPublicKeyWithCastingTest256Bit"
value="Compact Public Key With Casting Test 256 Bit"
disabled
/>
<input
type="button"
id="compressedCompactPublicKeyWithCastingTest256Bit"
value="Compressed Compact Public Key With Casting Test 256 Bit"
disabled
/>
<input
type="button"
id="compressedServerKeyBenchMessage1Carry1"
Expand Down
4 changes: 2 additions & 2 deletions tfhe/web_wasm_parallel_tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function setup() {

let button = document.getElementById(id);
if (button === null) {
console.error("button with id: ", id, "not found");
console.error(`button with id: ${id} not found`);
return null;
}

Expand All @@ -56,7 +56,7 @@ async function setup() {
document.getElementById("testSuccess").checked = false;
setButtonsDisabledState(demoNames, true);

console.log("Running: ", id);
console.log(`Running: ${id}`);
try {
let results = await fn();
document.getElementById("testSuccess").checked = true;
Expand Down

0 comments on commit ff0609f

Please sign in to comment.