From f09d78886008261b2d38f65cc4e6b1a6a5832f49 Mon Sep 17 00:00:00 2001 From: Juha Vainio Date: Tue, 9 Apr 2024 12:47:37 +0300 Subject: [PATCH] Add waiting of change when setting or clearing device posture in clear test --- device-posture/device-posture-clear.https.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/device-posture/device-posture-clear.https.html b/device-posture/device-posture-clear.https.html index 8ac7693868cfdb..84555f7eb11953 100644 --- a/device-posture/device-posture-clear.https.html +++ b/device-posture/device-posture-clear.https.html @@ -10,10 +10,18 @@ const originalPosture = navigator.devicePosture.type; const posture = originalPosture ? 'folded' : 'continuous'; - await test_driver.set_device_posture(posture); + const watcher = new EventWatcher(t, navigator.devicePosture, ['change']); + await Promise.all([ + watcher.wait_for('change'), + test_driver.set_device_posture(posture) + ]); assert_equals(navigator.devicePosture.type, posture); - await test_driver.clear_device_posture(); + await Promise.all([ + watcher.wait_for('change'), + test_driver.clear_device_posture() + ]); assert_equals(navigator.devicePosture.type, originalPosture); }, 'Tests that device posture override can be removed.'); +