|
3 | 3 | * SPDX-License-Identifier: AGPL-3.0-or-later |
4 | 4 | */ |
5 | 5 |
|
6 | | -import { createFolder, goToDir, moveFile, renameFile } from './filesUtils' |
7 | | -import { addComment, addTag, addToFavorites, createPublicShare, removeFromFavorites, showActivityTab } from './sidebarUtils' |
| 6 | +import { createFolder, goToDir, moveFile, renameFile, showSidebarForFile, toggleFavorite } from './filesUtils' |
| 7 | +import { SidebarPage } from '../pages/SidebarPage' |
8 | 8 |
|
9 | 9 | describe('Check activity listing in the sidebar', { testIsolation: true }, () => { |
| 10 | + let sidebar: SidebarPage |
| 11 | + |
10 | 12 | beforeEach(function() { |
11 | 13 | cy.createRandomUser() |
12 | 14 | .then((user) => { |
13 | 15 | cy.login(user) |
14 | 16 | cy.visit('/apps/files') |
| 17 | + sidebar = new SidebarPage() |
15 | 18 | }) |
16 | 19 | }) |
17 | 20 |
|
18 | 21 | it('Has creation activity', () => { |
19 | | - showActivityTab('welcome.txt') |
20 | | - cy.get('.activity-entry').last().should('contains.text', 'You created') |
| 22 | + showSidebarForFile('welcome.txt') |
| 23 | + sidebar.getActivities() |
| 24 | + .last() |
| 25 | + .should('contains.text', 'You created') |
21 | 26 | }) |
22 | 27 |
|
23 | 28 | it('Has favorite activity', () => { |
24 | | - addToFavorites('welcome.txt') |
25 | | - showActivityTab('welcome.txt') |
26 | | - cy.get('.activity-entry').first().should('contains.text', 'Added to favorites') |
| 29 | + toggleFavorite('welcome.txt') |
| 30 | + |
| 31 | + showSidebarForFile('welcome.txt') |
| 32 | + sidebar.getActivities() |
| 33 | + .first() |
| 34 | + .should('contains.text', 'Added to favorites') |
| 35 | + sidebar.close() |
| 36 | + |
| 37 | + cy.reload() |
| 38 | + toggleFavorite('welcome.txt') |
27 | 39 |
|
28 | | - removeFromFavorites('welcome.txt') |
29 | | - showActivityTab('welcome.txt') |
30 | | - cy.get('.activity-entry').first().should('contains.text', 'Removed from favorites') |
| 40 | + showSidebarForFile('welcome.txt') |
| 41 | + sidebar.getActivities() |
| 42 | + .first() |
| 43 | + .should('contains.text', 'Removed from favorites') |
31 | 44 | }) |
32 | 45 |
|
33 | 46 | it('Has share activity', () => { |
34 | | - createPublicShare('welcome.txt') |
35 | | - cy.get('body').contains('Link share created').should('exist') |
36 | | - cy.get('.toast-close').click({ multiple: true }) |
37 | | - showActivityTab('welcome.txt') |
38 | | - cy.get('.activity-entry').first().should('contains.text', 'Shared as public link') |
| 47 | + showSidebarForFile('welcome.txt') |
| 48 | + sidebar.createPublicShare() |
| 49 | + sidebar.close() |
| 50 | + |
| 51 | + showSidebarForFile('welcome.txt') |
| 52 | + sidebar.getActivities() |
| 53 | + .first() |
| 54 | + .should('contains.text', 'Shared as public link') |
39 | 55 | }) |
40 | 56 |
|
41 | | - it('Has rename activity', () => { |
42 | | - renameFile('welcome.txt', 'new name') |
43 | | - renameFile('new name.txt', 'welcome') |
| 57 | + it('Has rename activity', { retries: 5 }, () => { |
| 58 | + renameFile('welcome.txt', 'new name.txt') |
| 59 | + renameFile('new name.txt', 'welcome.txt') |
44 | 60 |
|
45 | | - showActivityTab('welcome.txt') |
46 | | - cy.get('.activity-entry').first().should('contains.text', 'You renamed') |
| 61 | + showSidebarForFile('welcome.txt') |
| 62 | + sidebar.getActivities() |
| 63 | + .first() |
| 64 | + .should('contains.text', 'You renamed') |
47 | 65 | }) |
48 | 66 |
|
49 | 67 | it('Has move activity', () => { |
50 | 68 | createFolder('Test folder') |
51 | 69 | moveFile('welcome.txt', 'Test folder') |
52 | 70 | cy.get('.toast-close').click({ multiple: true }) |
| 71 | + |
53 | 72 | goToDir('Test folder') |
54 | 73 |
|
55 | | - showActivityTab('welcome.txt') |
56 | | - cy.get('.activity-entry').first().should('contains.text', 'You moved') |
| 74 | + showSidebarForFile('welcome.txt') |
| 75 | + sidebar.getActivities() |
| 76 | + .first() |
| 77 | + .should('contains.text', 'You moved') |
57 | 78 | }) |
58 | 79 |
|
59 | 80 | it('Has tag activity', () => { |
60 | | - addTag('welcome.txt', 'my_tag') |
| 81 | + showSidebarForFile('welcome.txt') |
| 82 | + sidebar.addTag('some cool tag') |
| 83 | + sidebar.close() |
61 | 84 |
|
62 | | - showActivityTab('welcome.txt') |
63 | | - cy.get('.activity-entry').first().should('contains.text', 'Added system tag') |
| 85 | + showSidebarForFile('welcome.txt') |
| 86 | + sidebar.getActivities() |
| 87 | + .first() |
| 88 | + .should('contains.text', 'Added system tag') |
64 | 89 | }) |
65 | 90 |
|
66 | 91 | it('Has comment activity', () => { |
67 | | - addComment('welcome.txt', 'A comment') |
| 92 | + showSidebarForFile('welcome.txt') |
| 93 | + sidebar.addComment('A comment') |
| 94 | + sidebar.close() |
68 | 95 |
|
69 | | - showActivityTab('welcome.txt') |
70 | | - cy.get('.comments-activity').first().should('contains.text', 'A comment') |
| 96 | + showSidebarForFile('welcome.txt') |
| 97 | + sidebar.getActivities() |
| 98 | + .first() |
| 99 | + .should('contains.text', 'A comment') |
71 | 100 | }) |
72 | 101 |
|
73 | 102 | }) |
0 commit comments