انتقل إلى المحتوى الرئيسي

استعادة

استعادة جميع الوظائف الأصلية التي تم تجاوزها. يتم استدعاء هذا تلقائيًا بين الاختبارات، لذلك عمومًا لا توجد حاجة لاستخدامه.

الاستخدام
const clock = await browser.emulate('clock', { ... })
await clock.restore()
مثال
restore.js
console.log(new Date()) // returns e.g. 1722560447102

const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000

await clock.restore()
console.log(await browser.execute(() => new Date().getTime())) // returns 1722560447102
العائد
  • < Promise<void> >

Welcome! How can I help?

WebdriverIO AI Copilot