Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax <max@nextcloud.com>2022-02-22 06:15:39 +0300
committerMax <max@nextcloud.com>2022-03-02 10:19:16 +0300
commitd3315bf32a8c966b3a7aea45c3df762277e1e2a0 (patch)
tree2a6e3b9a8c0aba35a0c90f160fdeb02733704fbf /cypress
parent7782f4ddfb05bbbb78f25778999c8b74290b4874 (diff)
fix: workspace with alternative file names
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/integration/workspace.spec.js28
-rw-r--r--cypress/support/commands.js24
2 files changed, 45 insertions, 7 deletions
diff --git a/cypress/integration/workspace.spec.js b/cypress/integration/workspace.spec.js
index fd0289d53..efa3e5953 100644
--- a/cypress/integration/workspace.spec.js
+++ b/cypress/integration/workspace.spec.js
@@ -32,10 +32,9 @@ describe('Workspace', function() {
beforeEach(function() {
cy.login(randUser, 'password')
- cy.visit('/apps/files')
// isolate tests - each happens in it's own folder
cy.createFolder(Cypress.currentTest.title)
- cy.openFile(Cypress.currentTest.title)
+ cy.visit(`apps/files?dir=/${encodeURIComponent(Cypress.currentTest.title)}`)
})
it('adds a Readme.md', function() {
@@ -105,6 +104,31 @@ describe('Workspace', function() {
})
})
+ it('takes README.md into account', function() {
+ cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/README.md`)
+ cy.reload()
+ cy.get('#fileList').should('contain', 'README.md')
+ cy.get('#rich-workspace .ProseMirror')
+ .should('contain', 'Hello world')
+ })
+
+ it('takes localized file name into account', function() {
+ cy.nextcloudUpdateUser(randUser, 'password', 'language', 'de_DE')
+ cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`)
+ cy.reload()
+ cy.get('#fileList').should('contain', 'Anleitung.md')
+ cy.get('#rich-workspace .ProseMirror')
+ .should('contain', 'Hello world')
+ })
+
+ it('ignores localized file name in other language', function() {
+ cy.nextcloudUpdateUser(randUser, 'password', 'language', 'fr')
+ cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`)
+ cy.reload()
+ cy.get('#fileList').should('contain', 'Anleitung.md')
+ cy.get('.empty-workspace').should('contain', 'Ajoutez des notes, listes ou liens')
+ })
+
})
const menuButton = (name) => {
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 53ab81b63..90d179b93 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -62,6 +62,22 @@ Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
})
})
+Cypress.Commands.add('nextcloudUpdateUser', (user, password, key, value) => {
+ cy.request({
+ method: 'PUT',
+ url: `${Cypress.env('baseUrl')}/ocs/v2.php/cloud/users/${user}`,
+ form: true,
+ body: { key, value },
+ auth: { user, pass: password },
+ headers: {
+ 'OCS-ApiRequest': 'true',
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ }
+ }).then(response => {
+ cy.log(`Updated user ${user} ${key} to ${value}`, response.status)
+ })
+})
+
Cypress.Commands.add('nextcloudDeleteUser', (user) => {
cy.clearCookies()
cy.request({
@@ -100,11 +116,9 @@ Cypress.Commands.add('uploadFile', (fileName, mimeType, target) => {
})
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.window().then( win => {
+ win.OC.Files.getClient().createDirectory(dirName)
+ })
})
Cypress.Commands.add('openFile', fileName => {