Skip to content

Commit 757b97e

Browse files
committed
Port settings to vue
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent cc3beff commit 757b97e

47 files changed

Lines changed: 1947 additions & 292 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ js/activity-dashboard.js binary
22
js/activity-sidebar.js binary
33
js/*.LICENCE.map binary
44
js/*.js.map binary
5+
js/activity-*.js binary
56
package-lock.json binary
67
src/test/__snapshots__/*.snap

css/settings.css

Lines changed: 0 additions & 29 deletions
This file was deleted.

cypress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"projectId": "hx9gqy",
44
"viewportWidth": 1280,
55
"viewportHeight": 720
6-
}
6+
}

cypress/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/nextcloud/continuous-integration-server:latest
1+
FROM nextcloudci/server:latest
22

33
RUN mkdir /var/www/html/data
44
RUN chown -R www-data:www-data /var/www/html/data
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/**
2+
* @copyright Copyright (c) 2021 Louis Chemineau <louis@chmn.me>
3+
*
4+
* @author Louis Chemineau <louis@chmn.me>
5+
*
6+
* @license GNU AGPL version 3 or any later version
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
/// <reference types="Cypress" />
24+
25+
import { randHash } from '../utils'
26+
const randUser = randHash()
27+
28+
describe('Check that user\'s settings survive a reload', () => {
29+
before(() => {
30+
cy.nextcloudCreateUser(randUser, 'password')
31+
cy.login(randUser, 'password')
32+
cy.visit('/settings/user/notifications')
33+
cy.wait(1000)
34+
})
35+
36+
after(() => {
37+
cy.logout()
38+
})
39+
40+
it('Form survive a reload', () => {
41+
cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')
42+
43+
cy.reload()
44+
45+
cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')
46+
47+
cy.get("#file_changed_notification").check({force: true})
48+
cy.contains("A calendar was modified").click()
49+
cy.contains("Comments for files").click()
50+
cy.contains("Your password or email was modified").click()
51+
52+
cy.reload()
53+
54+
cy.get("#file_changed_email").should('not.be.checked')
55+
cy.get("#file_changed_notification").should('be.checked')
56+
cy.get("#shared_email").should('not.be.checked')
57+
cy.get("#shared_notification").should('not.be.checked')
58+
cy.get("#remote_share_email").should('not.be.checked')
59+
cy.get("#remote_share_notification").should('not.be.checked')
60+
cy.get("#public_links_email").should('not.be.checked')
61+
cy.get("#public_links_notification").should('not.be.checked')
62+
cy.get("#calendar_email").should('be.checked')
63+
cy.get("#calendar_notification").should('be.checked')
64+
cy.get("#calendar_event_email").should('not.be.checked')
65+
cy.get("#calendar_event_notification").should('not.be.checked')
66+
cy.get("#calendar_todo_email").should('not.be.checked')
67+
cy.get("#calendar_todo_notification").should('not.be.checked')
68+
cy.get("#contacts_email").should('not.be.checked')
69+
cy.get("#contacts_notification").should('not.be.checked')
70+
cy.get("#group_settings_email").should('not.be.checked')
71+
cy.get("#group_settings_notification").should('not.be.checked')
72+
cy.get("#personal_settings_email").should('not.be.checked')
73+
cy.get("#personal_settings_notification").should('be.checked')
74+
cy.get("#security_email").should('be.checked')
75+
cy.get("#security_notification").should('not.be.checked')
76+
cy.get("#comments_email").should('be.checked')
77+
cy.get("#comments_notification").should('be.checked')
78+
cy.get("#systemtags_email").should('not.be.checked')
79+
cy.get("#systemtags_notification").should('not.be.checked')
80+
})
81+
82+
it('Notification frequency survive a reload', () => {
83+
cy.get(".notification-frequency__select").select("Weekly")
84+
85+
cy.wait(200)
86+
cy.reload()
87+
88+
cy.get('.notification-frequency__select').find(':selected').contains('Weekly')
89+
cy.get(".notification-frequency__select").select("Hourly")
90+
91+
cy.wait(200)
92+
cy.reload()
93+
94+
cy.get('.notification-frequency__select').find(':selected').contains('Hourly')
95+
})
96+
97+
it('Activity summary survive a reload', () => {
98+
let input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')
99+
100+
input.check({force: true})
101+
input.should('be.checked')
102+
103+
cy.reload()
104+
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')
105+
106+
input.should('be.checked')
107+
108+
input.uncheck({force: true})
109+
110+
cy.reload()
111+
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')
112+
113+
input.should('not.be.checked')
114+
})
115+
})
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* @copyright Copyright (c) 2021 Louis Chemineau <louis@chmn.me>
3+
*
4+
* @author Louis Chemineau <louis@chmn.me>
5+
*
6+
* @license GNU AGPL version 3 or any later version
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
/// <reference types="Cypress" />
24+
25+
import { randHash } from '../utils'
26+
const randUser = randHash()
27+
28+
describe('Check activity listing in the sidebar', function() {
29+
before(function() {
30+
cy.nextcloudCreateUser(randUser, 'password')
31+
cy.login(randUser, 'password')
32+
33+
cy.visit('/apps/files')
34+
35+
cy.wait(1000)
36+
})
37+
38+
after(function() {
39+
cy.logout()
40+
})
41+
42+
it('Has creation activity', function() {
43+
cy.showActivityTab('welcome.txt')
44+
cy.get('.activity-entry').eq(0).should('contains.text', 'You created')
45+
})
46+
47+
it('Has favorite activity', function() {
48+
cy.addToFavorites('welcome.txt')
49+
cy.showActivityTab('welcome.txt')
50+
cy.get('.activity-entry').eq(0).should('contains.text', 'Added to favorites')
51+
52+
cy.removeFromFavorites('welcome.txt')
53+
cy.showActivityTab('welcome.txt')
54+
cy.get('.activity-entry').eq(0).should('contains.text', 'Removed from favorites')
55+
})
56+
57+
it('Has share activity', function() {
58+
cy.createPublicShare('welcome.txt')
59+
cy.showActivityTab('welcome.txt')
60+
cy.get('.activity-entry').eq(0).should('contains.text', 'Shared as public link')
61+
})
62+
63+
it('Has rename activity', function() {
64+
cy.renameFile('welcome.txt', 'new name')
65+
cy.renameFile('new name.txt', 'welcome')
66+
67+
cy.showActivityTab('welcome.txt')
68+
cy.get('.activity-entry').eq(0).should('contains.text', 'You renamed')
69+
})
70+
71+
it('Has move activity', function() {
72+
cy.createFolder('Test folder')
73+
cy.moveFile('welcome.txt', 'Test folder')
74+
cy.goToDir('Test folder')
75+
76+
cy.showActivityTab('welcome.txt')
77+
cy.get('.activity-entry').eq(0).should('contains.text', 'You moved')
78+
})
79+
80+
it('Has tag activity', function() {
81+
cy.addTag('welcome.txt', 'my_tag')
82+
83+
cy.showActivityTab('welcome.txt')
84+
cy.get('.activity-entry').eq(0).should('contains.text', 'Added system tag')
85+
})
86+
87+
it('Has comment activity', function() {
88+
cy.addComment('welcome.txt', 'A comment')
89+
90+
cy.showActivityTab('welcome.txt')
91+
cy.get('.activity-entry').eq(0).should('contains.text', 'You commented')
92+
})
93+
94+
})

cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*/
2222

23-
import axios from '@nextcloud/axios'
23+
/// <reference types="Cypress" />
2424

2525
const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
2626
Cypress.env('baseUrl', url)

cypress/support/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@
1313
// https://on.cypress.io/configuration
1414
// ***********************************************************
1515

16-
// Import commands.js using ES2015 syntax:
1716
import './commands'
18-
19-
// Alternatively you can use CommonJS syntax:
20-
// require('./commands')
17+
import './sidebar'

cypress/support/sidebar.js

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/**
2+
* @copyright Copyright (c) 2021 Louis Chemineau <louis@chmn.me>
3+
*
4+
* @author Louis Chemineau <louis@chmn.me>
5+
*
6+
* @license GNU AGPL version 3 or any later version
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
/// <reference types="Cypress" />
24+
25+
Cypress.Commands.add('createFolder', dirName => {
26+
cy.get('.files-controls .actions > .button.new').click()
27+
cy.get('.files-controls .actions .newFileMenu a[data-action="folder"]').click()
28+
cy.get('.files-controls .actions .newFileMenu a[data-action="folder"] input[type="text"]').type(dirName)
29+
cy.get('.files-controls .actions .newFileMenu a[data-action="folder"] input.icon-confirm').click()
30+
cy.log('Created folder', dirName)
31+
cy.wait(500)
32+
})
33+
34+
Cypress.Commands.add('moveFile', (fileName, dirName) => {
35+
cy.get(`.files-fileList tr[data-file="${fileName}"] .icon-more`).click()
36+
cy.get(`.files-fileList tr[data-file="${fileName}"] .action-movecopy`).click()
37+
cy.get(`.oc-dialog tr[data-entryname="${dirName}"]`).click()
38+
cy.contains(`Move to ${dirName}`).click()
39+
cy.wait(500)
40+
})
41+
42+
Cypress.Commands.add('showSidebarForFile', fileName => {
43+
cy.hideSidebar('welcome.txt')
44+
cy.get('.files-fileList tr[data-file="welcome.txt"] .icon-more').click()
45+
cy.contains('Details').click()
46+
cy.get('#app-sidebar-vue').contains('Activity').click()
47+
})
48+
49+
Cypress.Commands.add('hideSidebar', fileName => {
50+
cy.get('body')
51+
.then(($body) => {
52+
if ($body.find('.app-sidebar__close').length !== 0) {
53+
cy.get('.app-sidebar__close').click()
54+
}
55+
})
56+
})
57+
58+
Cypress.Commands.add('showActivityTab', fileName => {
59+
cy.showSidebarForFile()
60+
cy.get('#app-sidebar-vue').contains('Activity').click()
61+
})
62+
63+
Cypress.Commands.add('addToFavorites', fileName => {
64+
cy.get(`.files-fileList tr[data-file="${fileName}"] .icon-more`).click()
65+
cy.contains('Add to favorites').click()
66+
})
67+
68+
Cypress.Commands.add('removeFromFavorites', fileName => {
69+
cy.get(`.files-fileList tr[data-file="${fileName}"] .icon-more`).click()
70+
cy.contains('Remove from favorites').click()
71+
})
72+
73+
Cypress.Commands.add('createPublicShare', fileName => {
74+
cy.get(`.files-fileList tr[data-file="${fileName}"] .icon-more`).click()
75+
cy.contains('Details').click()
76+
cy.get('#app-sidebar-vue').contains('Sharing').click()
77+
78+
cy.get('#app-sidebar-vue a#sharing').trigger('click')
79+
cy.get('#app-sidebar-vue button.new-share-link').trigger('click')
80+
cy.get('#app-sidebar-vue a.sharing-entry__copy')
81+
})
82+
83+
Cypress.Commands.add('renameFile', (fileName, newName) => {
84+
cy.get(`.files-fileList tr[data-file="${fileName}"] .icon-more`).click()
85+
cy.get(`.files-fileList tr[data-file="${fileName}"] .action-rename`).click()
86+
cy.get(`.files-fileList tr[data-file="${fileName}"] input.filename`).type(newName).parent().submit()
87+
cy.wait(500)
88+
})
89+
90+
Cypress.Commands.add('goToDir', (dirName) => {
91+
cy.get(`.files-fileList tr[data-file="${dirName}"]`).click()
92+
cy.wait(500)
93+
})
94+
95+
Cypress.Commands.add('addTag', (fileName, tag) => {
96+
cy.showSidebarForFile('welcome.txt')
97+
98+
cy.get('.app-sidebar-header__menu .action-item__menutoggle').click()
99+
cy.get('.action-button__icon.icon-tag').click()
100+
cy.get('.systemTagsInputField input').type('my_tag{enter}{esc}')
101+
102+
cy.wait(500)
103+
})
104+
105+
Cypress.Commands.add('addComment', (fileName, comment) => {
106+
cy.showSidebarForFile('welcome.txt')
107+
cy.get('#app-sidebar-vue').contains('Comments').click()
108+
cy.get('.comment__editor .rich-contenteditable__input').type(comment)
109+
cy.get('button.comment__submit').click()
110+
111+
cy.wait(500)
112+
})

0 commit comments

Comments
 (0)