|
| 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 | +}) |
0 commit comments