Matt Rider cebd1046c7 Write cypress tests, show dropzone conditionally
- If it's the user's profile, show vueDropzone, if not show just the user's avatar
- apollo mutation is being called twice for drag and drop events
2019-05-24 01:26:37 -03:00

34 lines
936 B
JavaScript

import { When, Then } from 'cypress-cucumber-preprocessor/steps'
/* global cy */
When('I visit my profile page', () => {
cy.openPage('profile/peter-pan')
})
Then('I should be able to change my profile picture', () => {
const avatarUpload = 'onourjourney.png'
cy.fixture(avatarUpload, 'base64').then(fileContent => {
cy.get('#customdropzone').upload(
{ fileContent, fileName: avatarUpload, mimeType: 'image/png' },
{ subjectType: 'drag-n-drop' },
)
})
cy.get('#customdropzone')
.should('have.attr', 'style')
.and('contains', 'onourjourney')
cy.contains('.iziToast-message', 'Upload successful')
.should('have.length', 1)
})
When("I visit another user's profile page", () => {
cy.openPage('profile/peter-pan')
})
Then('I cannot upload a picture', () => {
cy.get('.ds-card-content')
.children()
.should('not.have.id', 'customdropzone')
.should('have.class', 'ds-avatar')
})