From b5b6c3ef51959202325457a34bceec623d5e1521 Mon Sep 17 00:00:00 2001 From: Matt Rider Date: Mon, 3 Jun 2019 20:10:49 -0300 Subject: [PATCH] Fix cypress test --- cypress/integration/common/profile.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/cypress/integration/common/profile.js b/cypress/integration/common/profile.js index cb5689f63..6f522573d 100644 --- a/cypress/integration/common/profile.js +++ b/cypress/integration/common/profile.js @@ -1,10 +1,10 @@ -import { When, Then } from 'cypress-cucumber-preprocessor/steps' +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' @@ -12,23 +12,25 @@ Then('I should be able to change my profile picture', () => { 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') + { subjectType: 'drag-n-drop' } + ); + }); + cy.get('.profile-avatar img') + .should('have.attr', 'src') .and('contains', 'onourjourney') - cy.contains('.iziToast-message', 'Upload successful') - .should('have.length', 1) -}) + 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') -}) \ No newline at end of file +});