feat: bundle assets with content (#2958)
* fix(media_folder_relative): use collection name in unpublished entry * refactor: pass arguments as object to AssetProxy ctor * feat: support media folders per collection * feat: resolve media files path based on entry path * fix: asset public path resolving * refactor: introduce typescript for AssetProxy * refactor: code cleanup * refactor(asset-proxy): add tests,switch to typescript,extract arguments * refactor: typescript for editorialWorkflow * refactor: add typescript for media library actions * refactor: fix type error on map set * refactor: move locale selector into reducer * refactor: add typescript for entries actions * refactor: remove duplication between asset store and media lib * feat: load assets from backend using API * refactor(github): add typescript, cache media files * fix: don't load media URL if already loaded * feat: add media folder config to collection * fix: load assets from API when not in UI state * feat: load entry media files when opening media library * fix: editorial workflow draft media files bug fixes * test(unit): fix unit tests * fix: editor control losing focus * style: add eslint object-shorthand rule * test(cypress): re-record mock data * fix: fix non github backends, large media * test: uncomment only in tests * fix(backend-test): add missing displayURL property * test(e2e): add media library tests * test(e2e): enable visual testing * test(e2e): add github backend media library tests * test(e2e): add git-gateway large media tests * chore: post rebase fixes * test: fix tests * test: fix tests * test(cypress): fix tests * docs: add media_folder docs * test(e2e): add media library delete test * test(e2e): try and fix image comparison on CI * ci: reduce test machines from 9 to 8 * test: add reducers and selectors unit tests * test(e2e): disable visual regression testing for now * test: add getAsset unit tests * refactor: use Asset class component instead of hooks * build: don't inline source maps * test: add more media path tests
This commit is contained in:
committed by
Shawn Erquhart
parent
7e4d4c1cc4
commit
2b41d8a838
@ -25,7 +25,12 @@ const retrieveRecordedExpectations = async () => {
|
||||
recorded = recorded.filter(({ httpRequest }) => {
|
||||
const { Host = [] } = httpRequest.headers;
|
||||
|
||||
return Host.includes('api.github.com');
|
||||
// Host is an array of strings
|
||||
return (
|
||||
Host.includes('api.github.com') ||
|
||||
Host.some(host => host.includes('netlify.com')) ||
|
||||
Host.some(host => host.includes('s3.amazonaws.com'))
|
||||
);
|
||||
});
|
||||
|
||||
return recorded;
|
||||
|
@ -8,8 +8,20 @@ function login(user) {
|
||||
// https://github.com/cypress-io/cypress/issues/1208
|
||||
window.indexedDB.deleteDatabase('localforage');
|
||||
window.localStorage.setItem('netlify-cms-user', JSON.stringify(user));
|
||||
if (user.netlifySiteURL) {
|
||||
window.localStorage.setItem('netlifySiteURL', user.netlifySiteURL);
|
||||
}
|
||||
},
|
||||
});
|
||||
if (user.netlifySiteURL && user.email && user.password) {
|
||||
cy.get('input[name="email"]')
|
||||
.clear()
|
||||
.type(user.email);
|
||||
cy.get('input[name="password"]')
|
||||
.clear()
|
||||
.type(user.password);
|
||||
cy.contains('button', 'Login').click();
|
||||
}
|
||||
} else {
|
||||
cy.visit('/');
|
||||
cy.contains('button', 'Login').click();
|
||||
@ -47,6 +59,18 @@ function goToCollections() {
|
||||
cy.contains('a', 'Content').click();
|
||||
}
|
||||
|
||||
function goToMediaLibrary() {
|
||||
cy.contains('button', 'Media').click();
|
||||
}
|
||||
|
||||
function goToEntry(entry) {
|
||||
goToCollections();
|
||||
cy.get('a h2')
|
||||
.first()
|
||||
.contains(entry.title)
|
||||
.click();
|
||||
}
|
||||
|
||||
function updateWorkflowStatus({ title }, fromColumnHeading, toColumnHeading) {
|
||||
cy.contains('h2', fromColumnHeading)
|
||||
.parent()
|
||||
@ -150,7 +174,7 @@ function publishEntryInEditor(publishType) {
|
||||
assertNotification(notifications.published);
|
||||
}
|
||||
|
||||
function selectDropdownItem(label, item){
|
||||
function selectDropdownItem(label, item) {
|
||||
cy.contains('[role="button"]', label).as('dropDownButton');
|
||||
cy.get('@dropDownButton')
|
||||
.parent()
|
||||
@ -194,8 +218,12 @@ function populateEntry(entry) {
|
||||
});
|
||||
}
|
||||
|
||||
function createPost(entry) {
|
||||
function newPost() {
|
||||
cy.contains('a', 'New Post').click();
|
||||
}
|
||||
|
||||
function createPost(entry) {
|
||||
newPost();
|
||||
populateEntry(entry);
|
||||
}
|
||||
|
||||
@ -233,7 +261,7 @@ function duplicateEntry(entry) {
|
||||
updateWorkflowStatusInEditor(editorStatus.ready);
|
||||
publishEntryInEditor(publishTypes.publishNow);
|
||||
exitEditor();
|
||||
cy.get('a h2').should(($h2s) => {
|
||||
cy.get('a h2').should($h2s => {
|
||||
expect($h2s.eq(0)).to.contain(entry.title);
|
||||
expect($h2s.eq(1)).to.contain(entry.title);
|
||||
});
|
||||
@ -317,6 +345,7 @@ module.exports = {
|
||||
exitEditor,
|
||||
goToWorkflow,
|
||||
goToCollections,
|
||||
goToMediaLibrary,
|
||||
updateWorkflowStatus,
|
||||
publishWorkflowEntry,
|
||||
deleteWorkflowEntry,
|
||||
@ -333,4 +362,7 @@ module.exports = {
|
||||
unpublishEntry,
|
||||
publishEntryInEditor,
|
||||
duplicateEntry,
|
||||
newPost,
|
||||
populateEntry,
|
||||
goToEntry,
|
||||
};
|
||||
|
Reference in New Issue
Block a user