feat(tests): replace cypress-file-upload with .selectFile() (#1460)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1460 Co-authored-by: konrad <k@knt.li> Co-committed-by: konrad <k@knt.li>
This commit is contained in:
parent
d913fa1745
commit
81cf8f2f29
4 changed files with 6 additions and 11 deletions
|
@ -8,12 +8,14 @@ describe('User Settings', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Changes the user avatar', () => {
|
it('Changes the user avatar', () => {
|
||||||
|
cy.intercept(`${Cypress.env('API_URL')}/user/settings/avatar/upload`).as('uploadAvatar')
|
||||||
|
|
||||||
cy.visit('/user/settings/avatar')
|
cy.visit('/user/settings/avatar')
|
||||||
|
|
||||||
cy.get('input[name=avatarProvider][value=upload]')
|
cy.get('input[name=avatarProvider][value=upload]')
|
||||||
.click()
|
.click()
|
||||||
cy.get('input[type=file]', { timeout: 1000 })
|
cy.get('input[type=file]', {timeout: 1000})
|
||||||
.attachFile('image.jpg')
|
.selectFile('cypress/fixtures/image.jpg', {force: true}) // The input is not visible, but on purpose
|
||||||
cy.get('.vue-handler-wrapper.vue-handler-wrapper--south .vue-simple-handler.vue-simple-handler--south')
|
cy.get('.vue-handler-wrapper.vue-handler-wrapper--south .vue-simple-handler.vue-simple-handler--south')
|
||||||
.trigger('mousedown', {which: 1})
|
.trigger('mousedown', {which: 1})
|
||||||
.trigger('mousemove', {clientY: 100})
|
.trigger('mousemove', {clientY: 100})
|
||||||
|
@ -22,7 +24,7 @@ describe('User Settings', () => {
|
||||||
.contains('Upload Avatar')
|
.contains('Upload Avatar')
|
||||||
.click()
|
.click()
|
||||||
|
|
||||||
cy.wait(3000) // Wait for the request to finish
|
cy.wait('@uploadAvatar')
|
||||||
cy.get('.global-notification')
|
cy.get('.global-notification')
|
||||||
.should('contain', 'Success')
|
.should('contain', 'Success')
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
import './commands'
|
import './commands'
|
||||||
import 'cypress-file-upload'
|
|
||||||
import '@4tw/cypress-drag-drop'
|
import '@4tw/cypress-drag-drop'
|
||||||
|
|
||||||
// see https://github.com/cypress-io/cypress/issues/702#issuecomment-587127275
|
// see https://github.com/cypress-io/cypress/issues/702#issuecomment-587127275
|
||||||
|
|
|
@ -72,13 +72,12 @@
|
||||||
"browserslist": "4.19.1",
|
"browserslist": "4.19.1",
|
||||||
"caniuse-lite": "1.0.30001304",
|
"caniuse-lite": "1.0.30001304",
|
||||||
"cypress": "9.3.1",
|
"cypress": "9.3.1",
|
||||||
"cypress-file-upload": "5.0.8",
|
|
||||||
"esbuild": "0.14.14",
|
"esbuild": "0.14.14",
|
||||||
"eslint": "8.8.0",
|
"eslint": "8.8.0",
|
||||||
"eslint-plugin-vue": "8.4.0",
|
"eslint-plugin-vue": "8.4.0",
|
||||||
"express": "4.17.2",
|
"express": "4.17.2",
|
||||||
"netlify-cli": "8.13.0",
|
|
||||||
"happy-dom": "2.30.1",
|
"happy-dom": "2.30.1",
|
||||||
|
"netlify-cli": "8.13.0",
|
||||||
"postcss": "8.4.5",
|
"postcss": "8.4.5",
|
||||||
"postcss-preset-env": "7.2.3",
|
"postcss-preset-env": "7.2.3",
|
||||||
"rollup": "2.66.1",
|
"rollup": "2.66.1",
|
||||||
|
|
|
@ -5215,11 +5215,6 @@ cyclist@^1.0.1:
|
||||||
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
||||||
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
||||||
|
|
||||||
cypress-file-upload@5.0.8:
|
|
||||||
version "5.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz#d8824cbeaab798e44be8009769f9a6c9daa1b4a1"
|
|
||||||
integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g==
|
|
||||||
|
|
||||||
cypress@9.3.1:
|
cypress@9.3.1:
|
||||||
version "9.3.1"
|
version "9.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.3.1.tgz#8116f52d49d6daf90a91e88f3eafd940234d2958"
|
resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.3.1.tgz#8116f52d49d6daf90a91e88f3eafd940234d2958"
|
||||||
|
|
Loading…
Reference in a new issue