Skip to content
Merged
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 cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ module.exports = defineConfig({
experimentalSessionAndOrigin: true,
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
retries: 2,
})
12 changes: 9 additions & 3 deletions cypress/e2e/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const waitForRequestAndCheckImage = (requestAlias, index) => {
describe('Test all image insertion methods', () => {
before(() => {
initUserAndFiles(randUser, 'test.md', 'empty.md')

cy.uploadFile('github.png', 'image/png')

cy.nextcloudCreateUser(randUser2, 'password')
Expand All @@ -161,6 +162,7 @@ describe('Test all image insertion methods', () => {

it('Insert an image from files', () => {
cy.openFile('test.md')

clickOnImageAction(ACTION_INSERT_FROM_FILES)
.then(() => {
const requestAlias = 'insertPathRequest'
Expand All @@ -171,7 +173,7 @@ describe('Test all image insertion methods', () => {
cy.log('Click OK in the filepicker')
cy.get('.oc-dialog > .oc-dialog-buttonrow button').click()

waitForRequestAndCheckImage(requestAlias)
return waitForRequestAndCheckImage(requestAlias)
})
})

Expand All @@ -192,8 +194,12 @@ describe('Test all image insertion methods', () => {
})

it('Upload images with the same name', () => {
cy.uploadFile('empty.md', 'text/markdown')
cy.openFile('empty.md')
// make sure we start from an emtpy file even on retries
const filename = randHash() + '.md'

cy.uploadFile('empty.md', 'text/markdown', filename)
cy.reloadFileList()
cy.openFile(filename)

const assertImage = index => {
return clickOnImageAction(ACTION_UPLOAD_LOCAL_FILE)
Expand Down
14 changes: 7 additions & 7 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,26 +163,26 @@ Cypress.Commands.add('shareFileToUser', (userId, password, path, targetUserId) =
})

Cypress.Commands.add('createFolder', dirName => {
cy.window().then(win => {
return cy.window().then(win => {
return win.OC.Files.getClient().createDirectory(dirName)
})
})

Cypress.Commands.add('moveFile', (path, destinationPath) => {
cy.window().then(win => {
win.OC.Files.getClient().move(path, destinationPath)
return cy.window().then(win => {
return win.OC.Files.getClient().move(path, destinationPath)
})
})

Cypress.Commands.add('copyFile', (path, destinationPath) => {
cy.window().then(win => {
win.OC.Files.getClient().copy(path, destinationPath)
return cy.window().then(win => {
return win.OC.Files.getClient().copy(path, destinationPath)
})
})

Cypress.Commands.add('reloadFileList', () => {
cy.window().then(win => {
win.OCA?.Files?.App?.fileList?.reload()
return cy.window().then(win => {
return win.OCA?.Files?.App?.fileList?.reload()
})
})

Expand Down
8 changes: 3 additions & 5 deletions cypress/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ export const getSearchParams = url => {
* Can be used e.g. for a `before()`
*
* @param {string} userName Username of the user to create
* @param {...string} file one ore more markdown file names to create
* @param {...string} files one ore more markdown file names to create
*/
export function initUserAndFiles(userName, file) {
const files = [...arguments].slice(1)

export function initUserAndFiles(userName, ...files) {
// Init user
cy.nextcloudCreateUser(userName, 'password')
cy.login(userName, 'password')

// Upload test files
files.forEach(file => {
;(files || []).forEach(file => {
cy.uploadFile(file, 'text/markdown')
})
}
Expand Down
4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/vendors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/vendors.js.map

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"stylelint:fix": "stylelint src/**/*.vue src/**/*.scss src/**/*.css --fix",
"test": "NODE_ENV=test jest",
"test:cypress": "cd cypress && ./runLocal.sh run",
"test:cypress:open": "cd cypress && ./runLocal.sh open",
"test:coverage": "NODE_ENV=test jest --coverage"
},
"browserslist": [
Expand Down Expand Up @@ -77,7 +78,7 @@
"markdown-it": "^13.0.0",
"markdown-it-container": "^3.0.0",
"markdown-it-task-lists": "^2.1.1",
"path-normalize": "^6.0.2",
"path-normalize": "^6.0.6",
"prosemirror-collab": "^1.3.0",
"prosemirror-inputrules": "^1.2.0",
"prosemirror-markdown": "^1.9.1",
Expand All @@ -87,7 +88,7 @@
"prosemirror-tables-contently": "^1.1.2",
"prosemirror-transform": "^1.6.0",
"prosemirror-utils": "^1.0.0-0",
"prosemirror-view": "^1.26.1",
"prosemirror-view": "^1.26.3",
"proxy-polyfill": "^0.3.2",
"tippy.js": "^6.3.7",
"vue": "^2.6.14",
Expand All @@ -109,7 +110,7 @@
"@nextcloud/webpack-vue-config": "^5.1.0",
"@vue/test-utils": "^1.3.0",
"@vue/vue2-jest": "^27.0.0",
"cypress": "^10.2.0",
"cypress": "^10.3.0",
"cypress-file-upload": "^5.0.8",
"debounce": "^1.2.1",
"escape-html": "^1.0.3",
Expand Down