Skip to content
Open
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
36 changes: 0 additions & 36 deletions .eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
_config.yml
.codecov.yml
.drone.yml
.eslintrc.js
.eslintrc.yml
.git
.github
.gitignore
Expand All @@ -19,6 +17,7 @@ composer.json
composer.lock
cypress
cypress.config.ts
eslint.config.mjs
img/screenshots
issue_template.md
krankerl.toml
Expand Down
4 changes: 2 additions & 2 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ stylelintConfig.rules['no-invalid-position-at-import-rule'] = null
stylelintConfig.rules['selector-pseudo-element-no-unknown'] = [
true,
{
ignorePseudoElements: ['v-deep']
}
ignorePseudoElements: ['v-deep'],
},
]

module.exports = stylelintConfig
2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-PackageSupplier = "Nextcloud <info@nextcloud.com>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/richdocuments"

[[annotations]]
path = [".gitattributes", ".github/issue_template.md", ".github/CODEOWNERS", ".editorconfig", "package-lock.json", "package.json", "composer.json", "composer.lock", "**/composer.json", "**/composer.lock", ".l10nignore", "cypress/tsconfig.json", "vendor-bin/**/composer.json", "vendor-bin/**/composer.lock", ".tx/config", "tsconfig.json", "js/vendor.LICENSE.txt", "krankerl.toml", ".npmignore", ".nextcloudignore", ".eslintrc.json", ".tx/backport", "fonts/.gitkeep"]
path = [".gitattributes", ".github/issue_template.md", ".github/CODEOWNERS", ".editorconfig", "package-lock.json", "package.json", "composer.json", "composer.lock", "**/composer.json", "**/composer.lock", ".l10nignore", "cypress/tsconfig.json", "vendor-bin/**/composer.json", "vendor-bin/**/composer.lock", ".tx/config", "tsconfig.json", "js/vendor.LICENSE.txt", "krankerl.toml", ".npmignore", ".nextcloudignore", ".tx/backport", "fonts/.gitkeep"]
precedence = "aggregate"
SPDX-FileCopyrightText = "none"
SPDX-License-Identifier = "CC0-1.0"
Expand Down
33 changes: 16 additions & 17 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { defineConfig } from 'cypress'
import setupPlugins from './cypress/plugins/index.js'

export default defineConfig({
env: {
collaboraUrl: process.env.CYPRESS_collaboraUrl ?? 'https://localhost:9980/',
},
projectId: 'fef71b',
viewportWidth: 1280,
viewportHeight: 720,
chromeWebSecurity: false,
modifyObstructiveCode: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'https://localhost:8081/index.php/',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
env: {
collaboraUrl: process.env.CYPRESS_collaboraUrl ?? 'https://localhost:9980/',
},
projectId: 'fef71b',
viewportWidth: 1280,
viewportHeight: 720,
chromeWebSecurity: false,
modifyObstructiveCode: false,
e2e: {
setupNodeEvents(on, config) {
return setupPlugins(on, config)
},
baseUrl: 'https://localhost:8081/index.php/',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
})
37 changes: 17 additions & 20 deletions cypress/e2e/direct.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
const baseUrl = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')

const getTemplates = (user, type) => {
function getTemplates(user, type) {
return cy.request({
method: 'GET',
url: `${baseUrl}/ocs/v2.php/apps/richdocuments/api/v1/templates/${type}?format=json`,
Expand All @@ -13,14 +13,14 @@ const getTemplates = (user, type) => {
'OCS-ApiRequest': 'true',
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
}).then((response) => {
cy.log(response)
const templates = response.body?.ocs?.data
cy.wrap(templates)
})
}

const createDirectEditingLink = (user, fileId) => {
function createDirectEditingLink(user, fileId) {
cy.login(user)
return cy.request({
method: 'POST',
Expand All @@ -34,37 +34,38 @@ const createDirectEditingLink = (user, fileId) => {
'OCS-ApiRequest': 'true',
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
}).then((response) => {
cy.log(response)
const token = response.body?.ocs?.data?.url
cy.log(`Created direct editing token for ${user.userId}`, token)
cy.wrap(token)
})
}

const createNewFileDirectEditingLink = (user, path, template) => {
function createNewFileDirectEditingLink(user, path, template) {
cy.login(user)
return cy.request({
method: 'POST',
url: `${baseUrl}/ocs/v2.php/apps/richdocuments/api/v1/templates/new?format=json`,
form: true,
body: {
path, template,
path,
template,
},
// auth: { user: user.userId, pass: user.password },
headers: {
'OCS-ApiRequest': 'true',
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
}).then((response) => {
cy.log(response)
const token = response.body?.ocs?.data?.url
cy.log(`Created direct editing token for ${user.userId}`, token)
cy.wrap(token)
})
}

const createDirectEditingLinkForShareToken = (shareToken, host = undefined, path = '', password = undefined) => {
function createDirectEditingLinkForShareToken(shareToken, host = undefined, path = '', password = undefined) {
cy.logout()
return cy.request({
method: 'POST',
Expand All @@ -81,10 +82,10 @@ const createDirectEditingLinkForShareToken = (shareToken, host = undefined, path
'OCS-ApiRequest': 'true',
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
}).then((response) => {
cy.log(response)
const token = response.body?.ocs?.data?.url
cy.log(`Created direct editing token for share link`, token)
cy.log('Created direct editing token for share link', token)
cy.wrap(token)
})
}
Expand All @@ -93,7 +94,7 @@ describe('Direct editing (legacy)', function() {
let randUser

before(function() {
cy.createRandomUser().then(user => {
cy.createRandomUser().then((user) => {
randUser = user
})
})
Expand Down Expand Up @@ -204,14 +205,11 @@ describe('Direct editing (legacy)', function() {
cy.waitForCollabora(false)
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })

cy.window().then(win => {
cy.window().then((win) => {
cy.spy(win.console, 'warn').as('consoleWarn')
})
cy.dispatchMessageFromOrigin('https://evil.example.com', { MessageId: 'Action_Save', Values: {} })
cy.get('@consoleWarn').should('have.been.calledWith',
'PostMessageService: rejected message from unexpected origin',
'https://evil.example.com'
)
cy.get('@consoleWarn').should('have.been.calledWith', 'PostMessageService: rejected message from unexpected origin', 'https://evil.example.com')
})
})

Expand All @@ -227,7 +225,7 @@ describe('Direct editing (legacy)', function() {
})
cy.waitForCollabora(false)
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
cy.get('[data-cy="coolframe"]').then($iframe => {
cy.get('[data-cy="coolframe"]').then(($iframe) => {
const collaboraOrigin = $iframe[0].contentWindow.location.origin
cy.spy($iframe[0].contentWindow, 'postMessage').as('postMessage')
cy.dispatchMessageFromOrigin(collaboraOrigin, { MessageId: 'Action_Paste', Values: {} })
Expand All @@ -238,10 +236,10 @@ describe('Direct editing (legacy)', function() {
})

it.skip('Open a remotely shared file', () => {
cy.createRandomUser().then(shareRecipient => {
cy.createRandomUser().then((shareRecipient) => {
cy.login(randUser)
cy.shareFileToRemoteUser(randUser, '/document.odt', shareRecipient)
.then(incomingFileId => {
.then((incomingFileId) => {
createDirectEditingLink(shareRecipient, incomingFileId)
.then((token) => {
cy.logout()
Expand Down Expand Up @@ -286,5 +284,4 @@ describe('Direct editing (legacy)', function() {
cy.closeDirectDocument()
})
})

})
8 changes: 4 additions & 4 deletions cypress/e2e/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Nextcloud integration', function() {

before(function() {
cy.nextcloudTestingAppConfigSet('richdocuments', 'uiDefaults-UIMode', 'notebookbar')
cy.createRandomUser().then(user => {
cy.createRandomUser().then((user) => {
randUser = user
cy.login(user)
cy.uploadFile(randUser, 'image.png', 'image/png', '/image.png')
Expand Down Expand Up @@ -111,8 +111,8 @@ describe('Nextcloud integration', function() {
cy.get('@shortcuts-bar').should('be.visible')

cy.get('@shortcuts-bar')
.find('button[aria-label="Open in local editor"]')
.click()
.find('button[aria-label="Open in local editor"]')
.click()
})

cy.get('.confirmation-dialog').should('be.visible')
Expand All @@ -125,7 +125,7 @@ describe('Nextcloud integration', function() {
}).as('getLocalToken')
cy.window()
.then((window) => {
cy.stub(window, 'open').as('open')
cy.stub(window, 'open').as('open')
})
cy.get('.confirmation-dialog button:contains("Open locally")').click()
cy.wait('@getLocalToken').its('response.statusCode').should('equal', 200)
Expand Down
8 changes: 5 additions & 3 deletions cypress/e2e/new.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
*/

describe('New file menu', function() {

let randUser
before(function() {
cy.createRandomUser().then(user => {
cy.createRandomUser().then((user) => {
randUser = user
cy.login(user)
})
Expand Down Expand Up @@ -35,7 +34,10 @@ describe('New file menu', function() {

describe('Creates a new file', function() {
const newFileTypeLabels = [
'document', 'spreadsheet', 'presentation', 'diagram',
'document',
'spreadsheet',
'presentation',
'diagram',
]

newFileTypeLabels.forEach((filetype) => {
Expand Down
Loading
Loading