stopwatch and timer test
This commit is contained in:
parent
c138433be0
commit
7bcddfe631
@ -3,7 +3,6 @@ const e = require('../core/elements');
|
||||
const { timeInSeconds } = require('./util');
|
||||
const { expect } = require('@playwright/test');
|
||||
const { sleep } = require('../core/helpers');
|
||||
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
||||
|
||||
class Timer extends MultiUsers {
|
||||
constructor(browser, context) {
|
||||
@ -18,27 +17,20 @@ class Timer extends MultiUsers {
|
||||
const timerIndicatorLocator = await this.modPage.getLocator(e.timerIndicator);
|
||||
|
||||
const initialValeuStopWatch = await timeInSeconds(timerCurrentLocator);
|
||||
console.log(initialValeuStopWatch);
|
||||
const initialValeuStopWatchIndicator = await timeInSeconds(timerIndicatorLocator);
|
||||
|
||||
await this.modPage.hasText(e.timerCurrent, /00:00:00/);
|
||||
await this.modPage.waitAndClick(e.startStopTimer);
|
||||
await sleep(5000);
|
||||
const currentValueStopwatch = await timeInSeconds(timerCurrentLocator);
|
||||
console.log(currentValueStopwatch);
|
||||
const currentValueStopwatchIndicator = await timeInSeconds(timerIndicatorLocator);
|
||||
await expect(currentValueStopwatch).toBeGreaterThan(initialValeuStopWatch);
|
||||
await expect(currentValueStopwatchIndicator).toBeGreaterThan(initialValeuStopWatchIndicator);
|
||||
|
||||
await this.modPage.waitAndClick(e.resetTimer);
|
||||
await this.modPage.hasText(e.timerCurrent, /00:00:00/);
|
||||
await this.modPage.hasText(e.timerIndicator, /00:00:00/, ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.modPage.hasText(e.timerIndicator, /00:00:00/);
|
||||
|
||||
/*
|
||||
const timerIndicatorValue = await timeInSeconds(timerIndicatorLocator);
|
||||
await this.modPage.waitAndClick(e.timerIndicator);
|
||||
await sleep(5000);
|
||||
const timerIndicatorCurrentValue = await timeInSeconds(timerIndicatorLocator);
|
||||
await expect(timerIndicatorCurrentValue).toBeGreaterThan(timerIndicatorValue);
|
||||
*/
|
||||
await this.modPage.waitAndClick(e.timerButton);
|
||||
await this.modPage.hasText(e.timerCurrent, /00:05:00/);
|
||||
await this.modPage.hasText(e.timerIndicator, /00:05:00/);
|
||||
@ -49,13 +41,24 @@ class Timer extends MultiUsers {
|
||||
await this.modPage.hasText(e.timerIndicator, /00:06:00/);
|
||||
|
||||
const timerInitialValue = await timeInSeconds(timerCurrentLocator);
|
||||
|
||||
await this.modPage.waitAndClick(e.startStopTimer);
|
||||
|
||||
await sleep(5000);
|
||||
|
||||
const timerCurrentValue = await timeInSeconds(timerCurrentLocator);
|
||||
await expect(timerInitialValue).toBeGreaterThan(timerCurrentValue);
|
||||
|
||||
await this.modPage.waitAndClick(e.startStopTimer);
|
||||
await this.modPage.waitAndClick(e.resetTimer);
|
||||
|
||||
await this.modPage.hasText(e.timerCurrent, /00:06:00/);
|
||||
await this.modPage.hasText(e.timerIndicator, /00:06:00/);
|
||||
|
||||
//Testing Timer Indicator
|
||||
const initialValueIndicator = await timeInSeconds(timerIndicatorLocator);
|
||||
await this.modPage.waitAndClick(e.timerIndicator);
|
||||
await sleep(5000);
|
||||
|
||||
const currentValueIndicator = await timeInSeconds(timerIndicatorLocator);
|
||||
await expect(initialValueIndicator).toBeGreaterThan(currentValueIndicator);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user