File size: 1,512 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { test, expect } from '@playwright/test'
import { userSessionFile } from './lib'
import Chance from 'chance'
const c = new Chance()
const baseURL = 'http://localhost:6130'

test.describe.configure({ mode: 'parallel' })
test.use({ storageState: userSessionFile })

let scheduleID: string

test.beforeEach(async ({ page }) => {
  // create schedule
  const name = 'sched-spec ' + c.string({ length: 10, alpha: true })

  await page.goto(`${baseURL}/schedules`)
  await page.getByRole('button', { name: 'Create Schedule' }).click()
  await page.fill('input[name=name]', name)
  await page.locator('button[type=submit]').click()
  await page.waitForURL(/\/schedules\/.{36}/)
  scheduleID = page.url().split('/schedules/')[1]
})

test.afterEach(async ({ page }) => {
  // delete schedule
  await page.goto(`${baseURL}/schedules/${scheduleID}`)
  await page.click('[data-testid="DeleteIcon"]')
  await page.click('button:has-text("Confirm")')
})

test('local time hover', async ({ page }) => {
  // change schedule tz to Europe/Amsterdam
  await page.click('[aria-label="Edit"]')
  await page.fill('input[name=time-zone]', 'Europe/Amsterdam')
  await page.click('li:has-text("Europe/Amsterdam")')
  await page.getByRole('button', { name: 'Submit' }).click()

  await page.goto(`${baseURL}/schedules/${scheduleID}/shifts`)

  // should display schedule tz on hover
  await page.hover(`[data-testid="shift-details"]`)
  await expect(page.locator('[data-testid="shift-tooltip"]')).toContainText(
    'GMT',
  )
})