mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Follow @roschaefer PR review suggestions
- create mapping for expectedValues in post.js - check from image/jpeg and compress, if not just pass to backend as is
This commit is contained in:
parent
fa02a4dd33
commit
d8d1db389a
@ -5,7 +5,7 @@ import orderBy from 'lodash/orderBy'
|
|||||||
const languages = orderBy(locales, 'name')
|
const languages = orderBy(locales, 'name')
|
||||||
const narratorAvatar =
|
const narratorAvatar =
|
||||||
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";
|
"https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg";
|
||||||
|
let expectedValue = { title: 'new post', content: 'new post content', src: 'onourjourney' }
|
||||||
When("I type in a comment with {int} characters", size => {
|
When("I type in a comment with {int} characters", size => {
|
||||||
var c="";
|
var c="";
|
||||||
for (var i = 0; i < size; i++) {
|
for (var i = 0; i < size; i++) {
|
||||||
@ -119,13 +119,15 @@ Then("I add all required fields", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Then("the post was saved successfully with the {string} teaser image", condition => {
|
Then("the post was saved successfully with the {string} teaser image", condition => {
|
||||||
|
if (condition === 'change')
|
||||||
|
expectedValue = { title: 'to be updated', content: 'successfully updated', src: 'humanconnection' }
|
||||||
cy.get(".ds-card-content > .ds-heading")
|
cy.get(".ds-card-content > .ds-heading")
|
||||||
.should("contain", condition === 'new' ? 'new post' : 'to be updated')
|
.should("contain", expectedValue.title)
|
||||||
.get(".content")
|
.get(".content")
|
||||||
.should("contain", condition === 'new' ? 'new post content' : 'successfully updated')
|
.should("contain", expectedValue.content)
|
||||||
.get('.post-page img')
|
.get('.post-page img')
|
||||||
.should("have.attr", "src")
|
.should("have.attr", "src")
|
||||||
.and("contains", condition === 'new' ? "onourjourney" : "humanconnection")
|
.and("contains", expectedValue.src)
|
||||||
})
|
})
|
||||||
|
|
||||||
Then("the first image should be removed from the preview", () => {
|
Then("the first image should be removed from the preview", () => {
|
||||||
|
|||||||
@ -114,13 +114,13 @@ export default {
|
|||||||
},
|
},
|
||||||
cropImage() {
|
cropImage() {
|
||||||
this.showCropper = false
|
this.showCropper = false
|
||||||
if (this.file.type === 'image/png' || this.file.type === 'image/svg+xml') {
|
if (this.file.type === 'image/jpeg') {
|
||||||
this.uploadSvgOrPng()
|
|
||||||
} else {
|
|
||||||
this.uploadJpeg()
|
this.uploadJpeg()
|
||||||
|
} else {
|
||||||
|
this.uploadOtherImageType()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uploadSvgOrPng() {
|
uploadOtherImageType() {
|
||||||
this.imageAspectRatio = this.file.width / this.file.height || 1.0
|
this.imageAspectRatio = this.file.width / this.file.height || 1.0
|
||||||
this.image = new Image()
|
this.image = new Image()
|
||||||
this.image.src = this.file.dataURL
|
this.image.src = this.file.dataURL
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user