feat: workflow unpublished entry (#2914)
* feat: workflow unpublished entry * fix: post rebase fix - load unpublished entry after unpublish * feat: change unpublish button to dropdown * test(cypress): add unpublish entry cypress test
This commit is contained in:
@ -18,6 +18,7 @@ import {
|
||||
validateObjectFieldsAndExit,
|
||||
validateNestedObjectFieldsAndExit,
|
||||
validateListFieldsAndExit,
|
||||
unpublishEntry,
|
||||
} from '../utils/steps';
|
||||
import { setting1, setting2, workflowStatus, editorStatus } from '../utils/constants';
|
||||
|
||||
@ -123,4 +124,15 @@ describe('Test Backend Editorial Workflow', () => {
|
||||
goToWorkflow();
|
||||
assertWorkflowStatus(entry1, workflowStatus.ready);
|
||||
});
|
||||
|
||||
it('can unpublish an existing entry', () => {
|
||||
// first publish an entry
|
||||
login();
|
||||
createPostAndExit(entry1);
|
||||
goToWorkflow();
|
||||
updateWorkflowStatus(entry1, workflowStatus.draft, workflowStatus.ready);
|
||||
publishWorkflowEntry(entry1);
|
||||
// then unpublish it
|
||||
unpublishEntry(entry1);
|
||||
});
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ const setting2 = { name: 'Andrew Wommack', description: 'A Gospel Teacher' };
|
||||
const notifications = {
|
||||
saved: 'Entry saved',
|
||||
published: 'Entry published',
|
||||
unpublished: 'Entry unpublished',
|
||||
updated: 'Entry status updated',
|
||||
deletedUnpublished: 'Unpublished changes deleted',
|
||||
error: {
|
||||
|
@ -212,6 +212,23 @@ function updateExistingPostAndExit(fromEntry, toEntry) {
|
||||
cy.contains('h2', toEntry.title);
|
||||
}
|
||||
|
||||
function unpublishEntry(entry) {
|
||||
goToCollections();
|
||||
cy.contains('h2', entry.title)
|
||||
.parent()
|
||||
.click({ force: true });
|
||||
cy.contains('[role="button"]', 'Published').as('publishedButton');
|
||||
cy.get('@publishedButton')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.get('@publishedButton').click();
|
||||
cy.contains('[role="menuitem"] span', 'Unpublish').click();
|
||||
});
|
||||
assertNotification(notifications.unpublished);
|
||||
goToWorkflow();
|
||||
assertWorkflowStatus(entry, workflowStatus.ready);
|
||||
}
|
||||
|
||||
function validateObjectFields({ limit, author }) {
|
||||
cy.get('a[href^="#/collections/settings"]').click();
|
||||
cy.get('a[href^="#/collections/settings/entries/general"]').click();
|
||||
@ -303,4 +320,5 @@ module.exports = {
|
||||
validateObjectFieldsAndExit,
|
||||
validateNestedObjectFieldsAndExit,
|
||||
validateListFieldsAndExit,
|
||||
unpublishEntry,
|
||||
};
|
||||
|
Reference in New Issue
Block a user