2020-12-10 14:52:35 +01:00
|
|
|
import {UserFactory} from '../../factories/user'
|
|
|
|
|
|
|
|
import '../../support/authenticateUser'
|
|
|
|
|
|
|
|
describe('User Settings', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
UserFactory.create(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Changes the user avatar', () => {
|
|
|
|
cy.visit('/user/settings')
|
|
|
|
|
|
|
|
cy.get('input[name=avatarProvider][value=upload]')
|
|
|
|
.click()
|
2021-10-02 22:47:13 +02:00
|
|
|
cy.get('input[type=file]', { timeout: 1000 })
|
2020-12-10 14:52:35 +01:00
|
|
|
.attachFile('image.jpg')
|
|
|
|
cy.get('.vue-handler-wrapper.vue-handler-wrapper--south .vue-simple-handler.vue-simple-handler--south')
|
|
|
|
.trigger('mousedown', {which: 1})
|
|
|
|
.trigger('mousemove', {clientY: 100})
|
|
|
|
.trigger('mouseup')
|
|
|
|
cy.get('a.button.is-primary')
|
|
|
|
.contains('Upload Avatar')
|
|
|
|
.click()
|
|
|
|
|
2020-12-18 23:52:15 +01:00
|
|
|
cy.wait(3000) // Wait for the request to finish
|
2020-12-10 14:52:35 +01:00
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Updates the name', () => {
|
|
|
|
cy.visit('/user/settings')
|
|
|
|
|
|
|
|
cy.get('input#newName')
|
|
|
|
.type('Lorem Ipsum')
|
2021-01-17 18:57:57 +01:00
|
|
|
cy.get('.card.general-settings .button.is-primary')
|
2020-12-10 14:52:35 +01:00
|
|
|
.contains('Save')
|
|
|
|
.click()
|
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.get('.navbar .user .username')
|
|
|
|
.should('contain', 'Lorem Ipsum')
|
|
|
|
})
|
|
|
|
})
|