首页 > 解决方案 > 如何对 UI 计时器进行 Angular e2e 测试

问题描述

我有一个 UI 功能,在计时器用完之前我会显示一些信息,当它用完时,我会显示另一个 UI 来重新生成信息。

最初,我显示了意味着计时器将运行X一段时间的信息。

    let timer = timeLimit * 60;
    const timerInterval = setInterval(() => {

      this.timeLimitViewer = '';
      timeinfo = this.getTimeRemaining(timer);
      hours   = timeinfo.hours   <= 0 ? '' : timeinfo.hours + ' hrs ';
      minutes = timeinfo.minutes <= 0 ? '' : timeinfo.minutes + ' mins ';
      seconds = timeinfo.seconds <= 0 ? '' : timeinfo.seconds + ' secs ';

      this.timeLimitViewer = hours + minutes + seconds;

      if (--timer <= 0) {
        clearInterval(timerInterval);
        this.showRegenrate = true;
        this.timeLimitViewer = undefined;
      }
    }, 1000);

问题是我将如何在量角器中测试这样的东西,以便我可以期待一段X时间后重新生成操作按钮。

标签: angular-e2e

解决方案


推荐阅读