Visitar URL original
test(e2e): vault notification are isolated from drive · owncloud/ocis@669a76a · GitHub
Skip to content

Commit 669a76a

Browse files
committed
test(e2e): vault notification are isolated from drive
1 parent bacd899 commit 669a76a

2 files changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { fileAction } from '../../environment/constants'
2+
import { test } from '../../environment/test'
3+
import * as api from '../../steps/api/api'
4+
import * as ui from '../../steps/ui/index'
5+
6+
test.describe('Vault Notifications', { tag: '@predefined-users' }, () => {
7+
test('Vault notifications are isolated from Drive notifications', async () => {
8+
await api.usersHaveBeenCreated({ stepUser: 'Admin', users: ['Alice', 'Brian'] })
9+
await api.userHasAssignedRolesToUsers({
10+
stepUser: 'Admin',
11+
users: [
12+
{ id: 'Alice', role: 'Admin' },
13+
{ id: 'Brian', role: 'Space Admin' }
14+
]
15+
})
16+
17+
await ui.userLogsIn({ stepUser: 'Alice' })
18+
await ui.userCreatesResources({
19+
stepUser: 'Alice',
20+
resources: [{ name: 'test.txt', type: 'txtFile', content: 'some content' }]
21+
})
22+
await ui.userSharesResources({
23+
stepUser: 'Alice',
24+
actionType: fileAction.sideBarPanel,
25+
shares: [
26+
{
27+
resource: 'test.txt',
28+
recipient: 'Brian',
29+
type: 'user',
30+
role: 'Can view',
31+
resourceType: 'file'
32+
}
33+
]
34+
})
35+
await ui.userSwitchesToVaultMode({ stepUser: 'Alice' })
36+
await ui.userIsRedirectedToAuthenticatorPage({ stepUser: 'Alice' })
37+
await ui.userAuthenticatesWithOTP({ stepUser: 'Alice', deviceName: 'test' })
38+
await ui.userIsInVaultMode({ stepUser: 'Alice' })
39+
40+
await ui.userCreatesResources({
41+
stepUser: 'Alice',
42+
resources: [{ name: 'lorem.txt', type: 'txtFile', content: 'some content' }]
43+
})
44+
45+
await ui.userLogsIn({ stepUser: 'Brian' })
46+
47+
await ui.userSharesResources({
48+
stepUser: 'Alice',
49+
actionType: fileAction.sideBarPanel,
50+
shares: [
51+
{
52+
resource: 'lorem.txt',
53+
recipient: 'Brian',
54+
type: 'user',
55+
role: 'Can view',
56+
resourceType: 'file'
57+
}
58+
]
59+
})
60+
await ui.userLogsOut({ stepUser: 'Alice' })
61+
62+
await ui.userShouldSeeNotifications({
63+
stepUser: 'Brian',
64+
expectedMessages: ['%user_alice_displayName% shared test.txt with you']
65+
})
66+
await ui.userShouldNotSeeNotifications({
67+
stepUser: 'Brian',
68+
unexpectedMessages: ['%user_alice_displayName% shared lorem.txt with you']
69+
})
70+
71+
await ui.userSwitchesToVaultMode({ stepUser: 'Brian' })
72+
await ui.userIsRedirectedToAuthenticatorPage({ stepUser: 'Brian' })
73+
await ui.userAuthenticatesWithOTP({ stepUser: 'Brian', deviceName: 'test' })
74+
await ui.userIsInVaultMode({ stepUser: 'Brian' })
75+
76+
await ui.userShouldSeeNotifications({
77+
stepUser: 'Brian',
78+
expectedMessages: ['%user_alice_displayName% shared lorem.txt with you']
79+
})
80+
await ui.userShouldNotSeeNotifications({
81+
stepUser: 'Brian',
82+
unexpectedMessages: ['%user_alice_displayName% shared test.txt with you']
83+
})
84+
await ui.userLogsOut({ stepUser: 'Brian' })
85+
})
86+
})

‎web/tests/e2e/steps/ui/application.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ export async function userShouldSeeNoNotifications({
4545
expect(messages).toHaveLength(0)
4646
}
4747

48+
export async function userShouldNotSeeNotifications({
49+
stepUser,
50+
unexpectedMessages
51+
}: {
52+
stepUser: string
53+
unexpectedMessages: string[]
54+
}): Promise<void> {
55+
const world = getWorld()
56+
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
57+
const application = new objects.runtime.Application({ page })
58+
const messages = await application.getNotificationMessages()
59+
60+
for (const message of unexpectedMessages) {
61+
expect(messages).not.toContain(substitute(message))
62+
}
63+
}
64+
4865
export async function userWaitsForTokenRenewal({
4966
stepUser,
5067
renewalType

0 commit comments

Comments
 (0)