test: workspace in public share

Also remove all the timeouts and error workarounds from share tests.
We increase the timeout in CI for all commands
and that works quite well so far.

Signed-off-by: Max <max@nextcloud.com>
This commit is contained in:
Max 2022-02-24 15:03:11 +01:00
Родитель 3e40b7bce4
Коммит 8bd6b0c4d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 0F5BFA367A00BACE
1 изменённых файлов: 14 добавлений и 21 удалений

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

@ -31,21 +31,14 @@ describe('Open test.md in viewer', function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')
// FIXME: files app is thowing the following error for some reason
// Uncaught TypeError: Cannot read property 'protocol' of undefined
// Same for appswebroots setting in tests
cy.on('uncaught:exception', (err, runnable) => {
return false
})
// Upload test files
cy.createFolder('folder')
cy.uploadFile('test.md', 'text/markdown', 'folder/test.md')
cy.uploadFile('test.md', 'text/markdown', 'folder/Readme.md')
cy.uploadFile('test.md', 'text/markdown', 'test2.md')
cy.uploadFile('test.md', 'text/markdown')
cy.wait(1000)
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test.md"]', {timeout: 10000})
cy.get('#fileList tr[data-file="test.md"]')
.should('contain', 'test.md')
})
beforeEach(function() {
@ -53,8 +46,8 @@ describe('Open test.md in viewer', function() {
})
it('Shares the file as a public read only link', function () {
cy.visit('/apps/files', { timeout: 10000 })
cy.get('#fileList tr[data-file="test.md"] a.action-share', { timeout: 10000 })
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test.md"] a.action-share')
.click({force: true})
cy.get('#app-sidebar-vue')
.should('be.visible')
@ -67,7 +60,7 @@ describe('Open test.md in viewer', function() {
cy.window().then(win => {
win.OC.appswebroots['files_texteditor'] = true
cy.wait(1000)
cy.get('#editor', { timeout: 4000 }).should('be.visible')
cy.get('#editor').should('be.visible')
cy.get('#editor .ProseMirror').should('contain', 'Hello world')
cy.get('#editor .ProseMirror h2').should('contain', 'Hello world')
})
@ -76,7 +69,7 @@ describe('Open test.md in viewer', function() {
it('Shares the file as a public link with write permissions', function () {
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test2.md"] a.action-share', {timeout: 10000})
cy.get('#fileList tr[data-file="test2.md"] a.action-share')
.click({force: true})
cy.get('#app-sidebar-vue')
.should('be.visible')
@ -85,14 +78,14 @@ describe('Open test.md in viewer', function() {
cy.get('#app-sidebar-vue .sharing-link-list .action-item__menutoggle').trigger('click')
const checkboxAllowEditing = '.popover.open input[type=checkbox]'
cy.get(checkboxAllowEditing).first().check({ force: true })
cy.get(checkboxAllowEditing, { timeout: 4000 }).first().should('be.checked')
cy.get(checkboxAllowEditing).first().should('be.checked')
cy.get('#app-sidebar-vue a.sharing-entry__copy')
.should('have.attr', 'href').and('include', '/s/')
.then((href) => {
cy.visit(href)
cy.window().then(win => {
win.OC.appswebroots['files_texteditor'] = true
cy.get('#editor', {timeout: 10000}).should('be.visible')
cy.get('#editor').should('be.visible')
cy.get('#editor .ProseMirror').should('contain', 'Hello world')
cy.get('#editor .ProseMirror h2').should('contain', 'Hello world')
cy.get('#editor .menubar .menubar-icons .icon-undo').should('be.visible')
@ -104,7 +97,7 @@ describe('Open test.md in viewer', function() {
it('Opens the editor as guest', function () {
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test2.md"] a.action-share', {timeout: 10000})
cy.get('#fileList tr[data-file="test2.md"] a.action-share')
.click({force: true})
cy.get('#app-sidebar-vue')
.should('be.visible')
@ -117,7 +110,7 @@ describe('Open test.md in viewer', function() {
cy.window().then(win => {
win.OC.appswebroots['files_texteditor'] = true
cy.wait(1000)
cy.get('#editor', {timeout: 10000}).should('be.visible')
cy.get('#editor').should('be.visible')
cy.get('#editor .ProseMirror').should('contain', 'Hello world')
cy.get('#editor .ProseMirror h2').should('contain', 'Hello world')
cy.get('#editor .menubar .menubar-icons .icon-undo').should('be.visible')
@ -128,8 +121,8 @@ describe('Open test.md in viewer', function() {
})
it('Shares a folder as a public read only link', function () {
cy.visit('/apps/files', { timeout: 10000 })
cy.get('#fileList tr[data-file="folder"] a.action-share', {timeout: 10000})
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="folder"] a.action-share')
.click({force: true})
cy.get('#app-sidebar-vue')
.should('be.visible')
@ -141,9 +134,9 @@ describe('Open test.md in viewer', function() {
cy.visit(href)
cy.window().then(win => {
win.OC.appswebroots['files_texteditor'] = true
cy.wait(1000)
cy.get('#rich-workspace').should('contain', 'Hello world')
cy.openFile('test.md')
cy.get('#editor-container', { timeout: 4000 }).should('be.visible')
cy.get('#editor-container').should('be.visible')
cy.get('#editor .ProseMirror').should('contain', 'Hello world')
cy.get('#editor .ProseMirror h2').should('contain', 'Hello world')
})