Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test(cy): silence cy.window
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and juliusknorr committed Dec 21, 2023
commit e9f295793ff04e48cbbbc49cddd528584ef1f178
15 changes: 9 additions & 6 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ compareSnapshotCommand()

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

addCommands()

Expand All @@ -39,7 +40,7 @@ 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 }
Expand All @@ -50,9 +51,11 @@ Cypress.Commands.overwrite('login', (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')
})
})
})

Expand Down Expand Up @@ -328,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 @@ -479,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