Bug 1897042 - Allow per-channel Snap QA tests expectations r=benchatt

Differential Revision: https://phabricator.services.mozilla.com/D210769
This commit is contained in:
Alexandre Lissy 2024-05-18 06:48:55 +00:00
Родитель dedae3e0b3
Коммит 514e682a58
3 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -62,6 +62,8 @@ class SnapTestsBase:
assert self._dir is not None
self._update_channel = None
self._wait = WebDriverWait(self._driver, self.get_timeout())
self._longwait = WebDriverWait(self._driver, 60)
@ -71,11 +73,17 @@ class SnapTestsBase:
rv = False
try:
first_tab = self._driver.window_handles[0]
channel = self.update_channel()
for m in object_methods:
tabs_before = set(self._driver.window_handles)
self._driver.switch_to.window(first_tab)
self._logger.test_start(m)
rv = getattr(self, m)(self._expectations[m])
expectations = (
self._expectations[m]
if not channel in self._expectations[m]
else self._expectations[m][channel]
)
rv = getattr(self, m)(expectations)
self._driver.switch_to.parent_frame()
if rv:
self._logger.test_end(m, status="OK")
@ -144,6 +152,19 @@ class SnapTestsBase:
return self._driver.current_window_handle
def update_channel(self):
if self._update_channel is None:
self._driver.set_context("chrome")
self._update_channel = self._driver.execute_script(
"return Services.prefs.getStringPref('app.update.channel');"
)
self._logger.info("Update channel: {}".format(self._update_channel))
self._driver.set_context("content")
return self._update_channel
def is_esr(self):
return self.update_channel() == "esr"
def assert_rendering(self, exp, element_or_driver):
# wait a bit for things to settle down
time.sleep(0.5)

Просмотреть файл

@ -261,15 +261,6 @@ class QATests(SnapTestsBase):
self._wait.until(lambda d: pdf_div.is_displayed() is True)
return pdf_div
def is_esr(self):
self._driver.set_context("chrome")
update_channel = self._driver.execute_script(
"return Services.prefs.getStringPref('app.update.channel');"
)
self._logger.info("Update channel: {}".format(update_channel))
self._driver.set_context("content")
return update_channel == "esr"
def pdf_get_page(self, page, long=False):
waiter = self._longwait if long is True else self._wait
page = waiter.until(

Просмотреть файл

@ -1,5 +1,8 @@
{
"test_custom_fonts": {
"nightly": {
"reference": "test_custom_fonts_ref_nightly.png"
},
"reference": "test_custom_fonts_ref.png"
},
"test_h264_mov": {},