Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite the settings in vue #589

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ module.exports = {
'node/no-unpublished-import': ['error', {
allowModules: ['@vue/test-utils', '@testing-library/vue'],
}],
'valid-jsdoc': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed until a new version of nextcloud/eslint-config is released

},
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
js/activity-dashboard.js binary
js/activity-sidebar.js binary
js/activity-adminSettings.js binary
js/activity-userSettings.js binary
js/*.LICENCE.map binary
js/*.js.map binary
package-lock.json binary
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ nbproject
# vim ex mode
.vimrc

# vscode
.vscode

# Mac OS
.DS_Store

Expand Down
33 changes: 0 additions & 33 deletions css/settings.scss

This file was deleted.

2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"projectId": "hx9gqy",
"viewportWidth": 1280,
"viewportHeight": 720
}
}
119 changes: 119 additions & 0 deletions cypress/integration/settings.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/**
* @copyright Copyright (c) 2021 Louis Chemineau <[email protected]>
*
* @author Louis Chemineau <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/// <reference types="Cypress" />

import { randHash } from '../utils'
const randUser = randHash()

describe('Check that user\'s settings survive a reload', () => {
before(() => {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')
cy.visit('/settings/user/activity')
cy.wait(1000)
})

after(() => {
cy.logout()
})

it('Form survive a reload', () => {
cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')

cy.reload()

cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')

cy.get("#file_changed_notification").check({force: true})
cy.contains("A calendar was modified").click()
cy.contains("Other activities").parentsUntil('table').contains("Push").click()
cy.contains("Comments for files").click()
cy.contains("Your password or email was modified").click()

cy.reload()

cy.get("#file_favorite_changed_email").should('not.be.checked')
cy.get("#file_favorite_changed_notification").should('not.be.checked')
cy.get("#file_changed_email").should('not.be.checked')
cy.get("#file_changed_notification").should('be.checked')
cy.get("#favorite_email").should('not.be.checked')
cy.get("#favorite_notification").should('not.be.checked')
cy.get("#shared_email").should('not.be.checked')
cy.get("#shared_notification").should('not.be.checked')
cy.get("#remote_share_email").should('not.be.checked')
cy.get("#remote_share_notification").should('not.be.checked')
cy.get("#public_links_email").should('not.be.checked')
cy.get("#public_links_notification").should('not.be.checked')
cy.get("#calendar_email").should('be.checked')
cy.get("#calendar_notification").should('be.checked')
cy.get("#calendar_event_email").should('not.be.checked')
cy.get("#calendar_event_notification").should('not.be.checked')
cy.get("#calendar_todo_email").should('not.be.checked')
cy.get("#calendar_todo_notification").should('not.be.checked')
cy.get("#contacts_email").should('not.be.checked')
cy.get("#contacts_notification").should('not.be.checked')
cy.get("#group_settings_email").should('not.be.checked')
cy.get("#group_settings_notification").should('be.checked')
cy.get("#personal_settings_email").should('not.be.checked')
cy.get("#personal_settings_notification").should('not.be.checked')
cy.get("#security_email").should('not.be.checked')
cy.get("#security_notification").should('be.checked')
cy.get("#comments_email").should('be.checked')
cy.get("#comments_notification").should('be.checked')
cy.get("#systemtags_email").should('not.be.checked')
cy.get("#systemtags_notification").should('be.checked')
})

it('Notification frequency survive a reload', () => {
cy.get(".notification-frequency__select").select("Weekly")

cy.wait(200)
cy.reload()

cy.get('.notification-frequency__select').find(':selected').contains('Weekly')
cy.get(".notification-frequency__select").select("Hourly")

cy.wait(200)
cy.reload()

cy.get('.notification-frequency__select').find(':selected').contains('Hourly')
})

it('Activity summary survive a reload', () => {
let input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section.summary-form').children('input')

input.check({force: true})

cy.reload()
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section.summary-form').children('input')

input.should('be.checked')

input.uncheck({force: true})

cy.reload()
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section.summary-form').children('input')

input.should('not.be.checked')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
*
*/

/// <reference types="Cypress" />

import { randHash } from '../utils'
const randUser = randHash()

describe('Open test.md in viewer', function() {
describe('Check activity listing in the sidebar', function() {
before(function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')
Expand Down
91 changes: 1 addition & 90 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import axios from '@nextcloud/axios'
/// <reference types="Cypress" />

const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
Expand Down Expand Up @@ -68,92 +68,3 @@ Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
cy.log(`Created user ${user}`, response.status)
})
})

Cypress.Commands.add('createFolder', dirName => {
cy.get('#controls .actions > .button.new').click()
cy.get('#controls .actions .newFileMenu a[data-action="folder"]').click()
cy.get('#controls .actions .newFileMenu a[data-action="folder"] input[type="text"]').type(dirName)
cy.get('#controls .actions .newFileMenu a[data-action="folder"] input.icon-confirm').click()
cy.log('Created folder', dirName)
cy.wait(500)
})

Cypress.Commands.add('moveFile', (fileName, dirName) => {
cy.get(`#fileList tr[data-file="${fileName}"] .icon-more`).click()
cy.get(`#fileList tr[data-file="${fileName}"] .action-movecopy`).click()
cy.get(`.oc-dialog tr[data-entryname="${dirName}"]`).click()
cy.contains(`Move to ${dirName}`).click()
cy.wait(500)
})

Cypress.Commands.add('showSidebarForFile', fileName => {
cy.hideSidebar('welcome.txt')
cy.get('#fileList tr[data-file="welcome.txt"] .icon-more').click()
cy.contains('Details').click()
cy.get('#app-sidebar-vue').contains('Activity').click()
})

Cypress.Commands.add('hideSidebar', fileName => {
cy.get('body')
.then(($body) => {
if ($body.find('.app-sidebar__close').length !== 0) {
cy.get('.app-sidebar__close').click()
}
})
})

Cypress.Commands.add('showActivityTab', fileName => {
cy.showSidebarForFile()
cy.get('#app-sidebar-vue').contains('Activity').click()
})

Cypress.Commands.add('addToFavorites', fileName => {
cy.get(`#fileList tr[data-file="${fileName}"] .icon-more`).click()
cy.contains('Add to favorites').click()
})

Cypress.Commands.add('removeFromFavorites', fileName => {
cy.get(`#fileList tr[data-file="${fileName}"] .icon-more`).click()
cy.contains('Remove from favorites').click()
})

Cypress.Commands.add('createPublicShare', fileName => {
cy.get(`#fileList tr[data-file="${fileName}"] .icon-more`).click()
cy.contains('Details').click()
cy.get('#app-sidebar-vue').contains('Sharing').click()

cy.get('#app-sidebar-vue a#sharing').trigger('click')
cy.get('#app-sidebar-vue button.new-share-link').trigger('click')
cy.get('#app-sidebar-vue a.sharing-entry__copy')
})

Cypress.Commands.add('renameFile', (fileName, newName) => {
cy.get(`#fileList tr[data-file="${fileName}"] .icon-more`).click()
cy.get(`#fileList tr[data-file="${fileName}"] .action-rename`).click()
cy.get(`#fileList tr[data-file="${fileName}"] input.filename`).type(newName).parent().submit()
cy.wait(500)
})

Cypress.Commands.add('goToDir', (dirName) => {
cy.get(`#fileList tr[data-file="${dirName}"]`).click()
cy.wait(500)
})

Cypress.Commands.add('addTag', (fileName, tag) => {
cy.showSidebarForFile('welcome.txt')

cy.get('.app-sidebar-header__menu .action-item__menutoggle').click()
cy.get('.action-button__icon.icon-tag').click()
cy.get('.systemTagsInputField input').type('my_tag{enter}{esc}')

cy.wait(500)
})

Cypress.Commands.add('addComment', (fileName, comment) => {
cy.showSidebarForFile('welcome.txt')
cy.get('#app-sidebar-vue').contains('Comments').click()
cy.get('.comment__editor .rich-contenteditable__input').type(comment)
cy.get('input.comment__submit').click()

cy.wait(500)
})
5 changes: 1 addition & 4 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
import './sidebar'
Loading