Skip to content

Commit

Permalink
Port settings to vue
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Aug 16, 2022
1 parent d41b3ea commit f344fc8
Show file tree
Hide file tree
Showing 50 changed files with 7,010 additions and 5,283 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ js/activity-dashboard.js binary
js/activity-sidebar.js binary
js/*.LICENCE.map binary
js/*.js.map binary
js/activity-*.js binary
package-lock.json binary
src/test/__snapshots__/*.snap
29 changes: 0 additions & 29 deletions css/settings.css

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
}
}
2 changes: 1 addition & 1 deletion cypress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/nextcloud/continuous-integration-server:latest
FROM nextcloudci/server:latest

RUN mkdir /var/www/html/data
RUN chown -R www-data:www-data /var/www/html/data
Expand Down
115 changes: 115 additions & 0 deletions cypress/integration/settings.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/**
* @copyright Copyright (c) 2021 Louis Chemineau <louis@chmn.me>
*
* @author Louis Chemineau <louis@chmn.me>
*
* @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/notifications')
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("Comments for files").click()
cy.contains("Your password or email was modified").click()

cy.reload()

cy.get("#file_changed_email").should('not.be.checked')
cy.get("#file_changed_notification").should('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('not.be.checked')
cy.get("#personal_settings_email").should('not.be.checked')
cy.get("#personal_settings_notification").should('be.checked')
cy.get("#security_email").should('be.checked')
cy.get("#security_notification").should('not.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('not.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').children('input')

input.check({force: true})
input.should('be.checked')

cy.reload()
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').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').children('input')

input.should('not.be.checked')
})
})
94 changes: 94 additions & 0 deletions cypress/integration/sidebar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* @copyright Copyright (c) 2021 Louis Chemineau <louis@chmn.me>
*
* @author Louis Chemineau <louis@chmn.me>
*
* @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 activity listing in the sidebar', function() {
before(function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')

cy.visit('/apps/files')

cy.wait(1000)
})

after(function() {
cy.logout()
})

it('Has creation activity', function() {
cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'You created')
})

it('Has favorite activity', function() {
cy.addToFavorites('welcome.txt')
cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'Added to favorites')

cy.removeFromFavorites('welcome.txt')
cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'Removed from favorites')
})

it('Has share activity', function() {
cy.createPublicShare('welcome.txt')
cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'Shared as public link')
})

it('Has rename activity', function() {
cy.renameFile('welcome.txt', 'new name')
cy.renameFile('new name.txt', 'welcome')

cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'You renamed')
})

it('Has move activity', function() {
cy.createFolder('Test folder')
cy.moveFile('welcome.txt', 'Test folder')
cy.goToDir('Test folder')

cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'You moved')
})

it('Has tag activity', function() {
cy.addTag('welcome.txt', 'my_tag')

cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'Added system tag')
})

it('Has comment activity', function() {
cy.addComment('welcome.txt', 'A comment')

cy.showActivityTab('welcome.txt')
cy.get('.activity-entry').eq(0).should('contains.text', 'You commented')
})

})
4 changes: 2 additions & 2 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 All @@ -33,7 +33,7 @@ Cypress.Commands.add('login', (user, password, route = '/apps/files') => {
cy.visit(route)
cy.get('input[name=user]').type(user)
cy.get('input[name=password]').type(password)
cy.get('.submit-wrapper input[type=submit]').click()
cy.get('form[name=login] .button-vue[type=submit]').click()
cy.url().should('include', route)
})

Expand Down
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

0 comments on commit f344fc8

Please sign in to comment.