Merge pull request #3569 from nextcloud/enh/cypress-helpers

Use cypress helpers from `@nextcloud/cypress`
This commit is contained in:
max-nextcloud 2022-12-14 05:50:36 +01:00 коммит произвёл GitHub
Родитель 75126f4331 96720a1ac2
Коммит 0f28b3f712
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 5 добавлений и 36 удалений

Просмотреть файл

@ -10,8 +10,6 @@ cy.getContent()
### Available custom commands
| Command | Function | Parameters |
| -------------------- | ---------------------- | ----------------------------------- |
| `nextcloudUpdateUser`| Update user setting | `user`, `password`, `key`, `value` |
| `nextcloudDeleteUser`| Delete user | `user` |
| `uploadFile` | Upload file | `fileName`, `mimeType`, `target` |
| `createFile` | Create file | `target`, `content`, `mimeType` |
| `moveFile` | Move a file | `path`, `destinationPath` |
@ -33,12 +31,4 @@ cy.getContent()
| `getActionSubEntry` | Get submenu entry (after menu clicked) | `name` |
| `openWorkspace` | Open workspace and return Editor content | |
### Commands from `@nextcloud/cypress`
We also use some commands from `@nextcloud/cypress`:
* `login(user)`
* `logout()`
* `createRandomUser().then(user => login(user))`
* `createUser(user)`
see https://github.com/nextcloud/nextcloud-cypress
We also use some commands from the [`@nextcloud/cypress`](https://github.com/nextcloud/nextcloud-cypress) package.

Просмотреть файл

@ -413,8 +413,8 @@ describe('Test all attachment insertion methods', () => {
})
it('Delete the user', () => {
cy.nextcloudDeleteUser(user)
cy.nextcloudDeleteUser(recipient)
cy.deleteUser(user)
cy.deleteUser(recipient)
})
})

Просмотреть файл

@ -273,7 +273,7 @@ describe('Workspace', function() {
describe('localize', () => {
it('takes localized file name into account', function() {
cy.updateUserSetting('language', 'de_DE')
cy.modifyUser(user, 'language', 'de_DE')
cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`)
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.get('.files-fileList').should('contain', 'Anleitung.md')
@ -282,7 +282,7 @@ describe('Workspace', function() {
})
it('ignores localized file name in other language', function() {
cy.updateUserSetting('language', 'fr')
cy.modifyUser(user, 'language', 'fr')
cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`)
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
cy.get('.files-fileList').should('contain', 'Anleitung.md')

Просмотреть файл

@ -52,27 +52,6 @@ Cypress.Commands.add('ocsRequest', (options) => {
})
})
Cypress.Commands.add('updateUserSetting', (key, value) => {
cy.ocsRequest({
method: 'PUT',
url: `${url}/ocs/v2.php/cloud/users/${auth.user}`,
body: { key, value },
}).then(response => {
cy.log(`Updated ${auth.user} ${key} to ${value}`, response.status)
})
})
Cypress.Commands.add('nextcloudDeleteUser', (user) => {
cy.clearCookies()
cy.ocsRequest({
method: 'DELETE',
url: `${url}/ocs/v1.php/cloud/users/${user}`,
auth: { user: 'admin', pass: 'admin' },
}).then(response => {
cy.log(`Deleted user ${user}`, response.status)
})
})
Cypress.Commands.add('uploadFile', (fileName, mimeType, target) => {
return cy.fixture(fileName, 'base64')
.then(Cypress.Blob.base64StringToBlob)