Bug 1857669 - Take screenshot during selenium tests r=releng-reviewers,gbrown

Differential Revision: https://phabricator.services.mozilla.com/D190473
This commit is contained in:
Alexandre Lissy 2023-10-11 07:30:40 +00:00
Родитель a4a6fc1772
Коммит 5ad50a5861
3 изменённых файлов: 15 добавлений и 1 удалений

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

@ -24,6 +24,10 @@ job-defaults:
tier: 2
worker:
max-run-time: 900
artifacts:
- name: public/build
type: directory
path: /builds/worker/artifacts/
jobs:
basic:
@ -35,7 +39,7 @@ jobs:
using: run-task
checkout: false
command: >-
cd $MOZ_FETCHES_DIR/ && ./tests.sh
export TASKCLUSTER_ROOT_DIR=$PWD && cd $MOZ_FETCHES_DIR/ && ./tests.sh
fetches:
snap-upstream-build:
- firefox.snap

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

@ -52,8 +52,13 @@ class SnapTests:
for m in object_methods:
if m.startswith("test_"):
print("Running: {}".format(m))
self._driver.save_screenshot("screenshot_{}_pre.png".format(m))
getattr(self, m)(self._expectations[m])
self._driver.save_screenshot("screenshot_{}_post.png".format(m))
except TimeoutException:
self._driver.save_screenshot("screenshot_timeout.png")
finally:
self._driver.save_screenshot("screenshot_final.png")
self._driver.quit()
def get_timeout(self):

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

@ -4,6 +4,9 @@ set -ex
pwd
ARTIFACT_DIR=$TASKCLUSTER_ROOT_DIR/builds/worker/artifacts/
mkdir -p "$ARTIFACT_DIR"
sudo snap refresh --hold=24h firefox
sudo snap install --name firefox --dangerous ./firefox.snap
@ -15,3 +18,5 @@ python3 -m pip install --user -r requirements.txt
sed -e "s/#RUNTIME_VERSION#/${RUNTIME_VERSION}/#" < expectations.json.in > expectations.json
python3 basic_tests.py expectations.json
cp ./*.png "$ARTIFACT_DIR/"