Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] test(cy): skip test failing due to server issue #5145

Merged
merged 6 commits into from
Dec 21, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:


- name: Upload test failure screenshots
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Upload screenshots
Expand All @@ -179,10 +179,10 @@ jobs:
retention-days: 5

- name: Upload nextcloud logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Upload nextcloud log
name: cypress-${{ matrix.containers }}.log
path: data/nextcloud.log
retention-days: 5

Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/attachments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ describe('Test all attachment insertion methods', () => {
})
})

it('test if attachment folder is deleted after having deleted a markdown file', () => {
// Skip as https://github.com/nextcloud/server/issues/42306 causes this to fail.
it.skip('test if attachment folder is deleted after having deleted a markdown file', () => {
const fileName = 'deleteSource.md'
cy.createMarkdown(fileName, '![git](.attachments.123/github.png)', false).then((fileId) => {
const attachmentsFolder = `.attachments.${fileId}`
Expand Down Expand Up @@ -401,14 +402,14 @@ describe('Test all attachment insertion methods', () => {
})

cy.login(recipient)
cy.showHiddenFiles()

cy.visit('/apps/files')
// check the file list
cy.getFile('testShared.md')
.should('exist')
cy.getFile('github.png')
.should('not.exist')
cy.showHiddenFiles()

// check the attachment folder is not there
cy.getFile('testShared.md')
Expand Down
46 changes: 19 additions & 27 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import axios from '@nextcloud/axios'
import { addCommands } from '@nextcloud/cypress'
import 'cypress-if'
import compareSnapshotCommand from 'cypress-visual-regression/dist/command.js'

// eslint-disable-next-line no-unused-vars,n/no-extraneous-import
Expand All @@ -32,6 +31,7 @@ compareSnapshotCommand()

const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
const silent = { log: false }

addCommands()

Expand All @@ -40,44 +40,36 @@ addCommands()
// and also to determine paths, urls and the like.
let auth
Cypress.Commands.overwrite('login', (login, user) => {
cy.window().then((win) => {
cy.window(silent).then((win) => {
win.location.href = 'about:blank'
})
auth = { user: user.userId, password: user.password }
cy.wrap(null).as('requesttoken')
login(user)
})

Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
// Make sure that each visit call that triggers a page load will update the stored requesttoken
return originalFn(url, options).then((result) => {
cy.window()
.then((win) => cy.wrap(win?.OC?.requestToken))
.as('requesttoken')
cy.window(silent)
.then((win) => {
cy.wrap(win?.OC?.requestToken)
.as('requesttoken')
})
})
})

Cypress.Commands.add('getRequestToken', () => {
cy.get('@requesttoken')
.if((token) => !token)
.then(() => {
cy.window()
.then((win) => cy.wrap(win?.OC?.requestToken))
.if((token) => !!token)
.then((token) => {
cy.log('Request token from window', token)
})
cy.then(function() {
if (this.requesttoken) {
return this.requesttoken
} else {
cy.log('Fetching request token')
return cy.request('/csrftoken')
.its('body.token')
.as('requesttoken')
.else()
.then((token) => {
cy.log('Request token fetching', token)
return cy.request('/csrftoken')
.then(({ body }) => {
return body.token
})
}).as('requesttoken')
})

return cy.get('@requesttoken')
}
})
})

Cypress.Commands.add('ocsRequest', (options) => {
Expand Down Expand Up @@ -339,7 +331,7 @@ Cypress.Commands.add('getFileContent', (path) => {
})

Cypress.Commands.add('propfindFolder', (path, depth = 0) => {
return cy.window()
return cy.window(silent)
.then(win => {
const files = win.OC.Files
const PROPERTY_WORKSPACE_FILE
Expand Down Expand Up @@ -490,7 +482,7 @@ Cypress.Commands.add('openWorkspace', () => {
})

Cypress.Commands.add('configureText', (key, value) => {
return cy.window().then(win => {
return cy.window(silent).then(win => {
return axios.post(
`${url}/index.php/apps/text/settings`,
{ key, value },
Expand Down
19 changes: 0 additions & 19 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
"@vue/vue2-jest": "^29.2.6",
"@vueuse/core": "^10.7.0",
"cypress": "^13.6.1",
"cypress-if": "^1.10.5",
"cypress-split": "^1.17.1",
"cypress-visual-regression": "^3.0.0",
"eslint-plugin-cypress": "^2.15.1",
Expand Down
Loading