Skip to content

Commit ee3511f

Browse files
nemesifierpraptisharma28
authored andcommitted
[ci/tests] Temporary workaround for beforeunload event #902
Simulate gestures but is not enough. Ref: https://chromium.googlesource.com/chromium/src/+/5b3168e8f8c4487320c654dd761622b89d548514. Use chromium 125 for testing. Added pip dependency caching. I had to set CI to run on ubuntu-22.04, on ubuntu-24.04 the workaround did not work. Related to #902
1 parent e36b586 commit ee3511f

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/ci.yml

+18-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
build:
1515
name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }}
16-
runs-on: ubuntu-24.04
16+
runs-on: ubuntu-22.04
1717

1818
services:
1919
redis:
@@ -50,6 +50,22 @@ jobs:
5050
uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ matrix.python-version }}
53+
cache: 'pip'
54+
cache-dependency-path: |
55+
**/requirements*.txt
56+
57+
- uses: browser-actions/setup-chrome@v1
58+
# Using a fixed version, see here for more information on why:
59+
# https://github.com/openwisp/openwisp-controller/issues/902#issuecomment-2266219715
60+
# TODO: find a solution to allow using recent versions
61+
with:
62+
chrome-version: 125
63+
install-chromedriver: true
64+
id: setup-chrome
65+
66+
- run: |
67+
${{ steps.setup-chrome.outputs.chrome-path }} --version
68+
chromedriver --version
5369
5470
- name: Install Dependencies
5571
id: deps
@@ -80,6 +96,7 @@ jobs:
8096
coverage xml
8197
env:
8298
SELENIUM_HEADLESS: 1
99+
CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }}
83100

84101
- name: Upload Coverage
85102
if: ${{ success() }}

openwisp_controller/config/tests/test_selenium.py

+8
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,21 @@ def test_unsaved_changes(self):
144144
self.fail('Unsaved changes alert displayed without any change')
145145

146146
with self.subTest('Alert should be displayed after making changes'):
147+
# simulate hand gestures
148+
self.web_driver.find_element(by=By.TAG_NAME, value='body').click()
149+
self.web_driver.find_element(by=By.NAME, value='name').click()
150+
# set name
147151
self.web_driver.find_element(by=By.NAME, value='name').send_keys(
148152
'new.device.name'
149153
)
154+
# simulate hand gestures
155+
self.web_driver.find_element(by=By.TAG_NAME, value='body').click()
150156
self.web_driver.refresh()
151157
try:
152158
WebDriverWait(self.web_driver, 1).until(EC.alert_is_present())
153159
except TimeoutException:
160+
for entry in self.web_driver.get_log('browser'):
161+
print(entry)
154162
self.fail('Timed out wating for unsaved changes alert')
155163
else:
156164
alert = Alert(self.web_driver)

0 commit comments

Comments
 (0)