mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-01-18 19:01:24 +00:00
Merge pull request #6528 from Ocelot-Social-Community/6375-refactor-cypress-migrate-from-cypress-file-upload-to-selectfile
refactor(other): cypress - migrate from cypress-file-upload to .selectFile()
This commit is contained in:
commit
e3b619709c
@ -13,7 +13,6 @@
|
||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
||||
|
||||
/* globals Cypress cy */
|
||||
import "cypress-file-upload";
|
||||
import { GraphQLClient, request } from 'graphql-request'
|
||||
import CONFIG from '../../backend/build/src/config'
|
||||
|
||||
|
||||
@ -1,28 +1,27 @@
|
||||
import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
||||
|
||||
Then("I should be able to {string} a teaser image", condition => {
|
||||
// cy.reload()
|
||||
let postTeaserImage = ""
|
||||
|
||||
switch(condition){
|
||||
case 'change':
|
||||
cy.get('.delete-image-button')
|
||||
case "change":
|
||||
postTeaserImage = "humanconnection.png"
|
||||
cy.get(".delete-image-button")
|
||||
.click()
|
||||
cy.fixture('humanconnection.png').as('postTeaserImage').then(function() {
|
||||
cy.get("#postdropzone").upload(
|
||||
{ fileContent: this.postTeaserImage, fileName: 'humanconnection.png', mimeType: "image/png" },
|
||||
{ subjectType: "drag-n-drop", force: true }
|
||||
).wait(750);
|
||||
})
|
||||
cy.get("#postdropzone").selectFile(
|
||||
{ contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: "image/png" },
|
||||
{ action: "drag-drop", force: true }
|
||||
).wait(750);
|
||||
break;
|
||||
case 'add':
|
||||
cy.fixture('onourjourney.png').as('postTeaserImage').then(function() {
|
||||
cy.get("#postdropzone").upload(
|
||||
{ fileContent: this.postTeaserImage, fileName: 'onourjourney.png', mimeType: "image/png" },
|
||||
{ subjectType: "drag-n-drop", force: true }
|
||||
).wait(750);
|
||||
})
|
||||
case "add":
|
||||
postTeaserImage = "onourjourney.png"
|
||||
cy.get("#postdropzone").selectFile(
|
||||
{ contents: `cypress/fixtures/${postTeaserImage}`, fileName: postTeaserImage, mimeType: "image/png" },
|
||||
{ action: "drag-drop", force: true }
|
||||
).wait(750);
|
||||
break;
|
||||
case 'remove':
|
||||
cy.get('.delete-image-button')
|
||||
case "remove":
|
||||
cy.get(".delete-image-button")
|
||||
.click()
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2,13 +2,11 @@ import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
||||
|
||||
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", force: true }
|
||||
);
|
||||
});
|
||||
|
||||
cy.get("#customdropzone").selectFile(
|
||||
{ contents: `cypress/fixtures/${avatarUpload}`, fileName: avatarUpload, mimeType: "image/png" },
|
||||
{ action: "drag-drop" }
|
||||
);
|
||||
cy.get(".profile-page-avatar img")
|
||||
.should("have.attr", "src")
|
||||
.and("contains", "onourjourney");
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
"scripts": {
|
||||
"db:seed": "cd backend && yarn run db:seed",
|
||||
"db:reset": "cd backend && yarn run db:reset",
|
||||
"cypress:run": "cypress run --browser electron --config-file ./cypress/cypress.config.js",
|
||||
"cypress:open": "cypress open --browser electron --config-file ./cypress/cypress.config.js",
|
||||
"cypress:run": "cypress run --e2e --browser electron --config-file ./cypress/cypress.config.js",
|
||||
"cypress:open": "cypress open --e2e --browser electron --config-file ./cypress/cypress.config.js",
|
||||
"cucumber:setup": "cd backend && yarn run dev",
|
||||
"cucumber": "wait-on tcp:4000 && cucumber-js --require-module @babel/register --exit",
|
||||
"release": "yarn version --no-git-tag-version --no-commit-hooks --no-commit && auto-changelog --latest-version $(node -p -e \"require('./package.json').version\") && cd backend && yarn version --no-git-tag-version --no-commit-hooks --no-commit --new-version $(node -p -e \"require('./../package.json').version\") && cd ../webapp && yarn version --no-git-tag-version --no-commit-hooks --no-commit --new-version $(node -p -e \"require('./../package.json').version\") && cd ../webapp/maintenance/source && yarn version --no-git-tag-version --no-commit-hooks --no-commit --new-version $(node -p -e \"require('./../../../package.json').version\")"
|
||||
@ -33,7 +33,6 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"cucumber": "^6.0.5",
|
||||
"cypress": "^12.17.0",
|
||||
"cypress-file-upload": "^3.5.3",
|
||||
"cypress-network-idle": "^1.14.2",
|
||||
"date-fns": "^2.25.0",
|
||||
"dotenv": "^8.2.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user