-
Notifications
You must be signed in to change notification settings - Fork 155
/
notifications.ts
35 lines (32 loc) · 1.29 KB
/
notifications.ts
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
import { DataTable, Then, When } from '@cucumber/cucumber'
import { World } from '../../environment'
import { objects } from '../../../support'
import { expect } from '@playwright/test'
Then(
'{string} should see the following notification(s)',
async function (this: World, stepUser: string, stepTable: DataTable): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const application = new objects.runtime.Application({ page })
const messages = await application.getNotificationMessages()
for (const { message } of stepTable.hashes()) {
expect(messages).toContain(message)
}
}
)
Then(
'{string} should see no notification(s)',
async function (this: World, stepUser: string): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const application = new objects.runtime.Application({ page })
const messages = await application.getNotificationMessages()
expect(messages.length).toBe(0)
}
)
When(
'{string} marks all notifications as read',
async function (this: World, stepUser: string): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const application = new objects.runtime.Application({ page })
await application.markNotificationsAsRead()
}
)