2019-09-03 21:56:20 +03:00
|
|
|
import '../../utils/dismiss-local-backup';
|
|
|
|
import {
|
|
|
|
login,
|
|
|
|
createPostAndExit,
|
|
|
|
updateExistingPostAndExit,
|
|
|
|
goToWorkflow,
|
|
|
|
deleteWorkflowEntry,
|
|
|
|
updateWorkflowStatus,
|
|
|
|
publishWorkflowEntry,
|
|
|
|
} from '../../utils/steps';
|
|
|
|
import { workflowStatus } from '../../utils/constants';
|
|
|
|
import { entry1, entry2 } from './entries';
|
2019-10-22 19:59:13 +03:00
|
|
|
import * as specUtils from './spec_utils';
|
2019-09-03 21:56:20 +03:00
|
|
|
|
|
|
|
export default function({ use_graphql }) {
|
|
|
|
let taskResult = { data: {} };
|
|
|
|
|
|
|
|
before(() => {
|
2019-10-22 19:59:13 +03:00
|
|
|
specUtils.before(taskResult, { use_graphql, open_authoring: true });
|
2019-09-03 21:56:20 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
after(() => {
|
2019-10-22 19:59:13 +03:00
|
|
|
specUtils.after(taskResult);
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
specUtils.beforeEach(taskResult);
|
2019-09-03 21:56:20 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
2019-10-22 19:59:13 +03:00
|
|
|
specUtils.afterEach(taskResult);
|
2019-09-03 21:56:20 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('successfully loads', () => {
|
|
|
|
login(taskResult.data.user);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can create an entry', () => {
|
|
|
|
login(taskResult.data.user);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can update an entry', () => {
|
|
|
|
login(taskResult.data.user);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
updateExistingPostAndExit(entry1, entry2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can publish an editorial workflow entry', () => {
|
|
|
|
login(taskResult.data.user);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
goToWorkflow();
|
|
|
|
updateWorkflowStatus(entry1, workflowStatus.draft, workflowStatus.ready);
|
|
|
|
publishWorkflowEntry(entry1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('successfully forks repository and loads', () => {
|
|
|
|
login(taskResult.data.forkUser);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can create an entry on fork', () => {
|
|
|
|
login(taskResult.data.forkUser);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can update a draft entry on fork', () => {
|
2019-12-20 19:33:43 +02:00
|
|
|
login(taskResult.data.forkUser);
|
2019-09-03 21:56:20 +03:00
|
|
|
createPostAndExit(entry1);
|
|
|
|
updateExistingPostAndExit(entry1, entry2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can change entry status from fork', () => {
|
|
|
|
login(taskResult.data.forkUser);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
goToWorkflow();
|
|
|
|
updateWorkflowStatus(entry1, workflowStatus.draft, workflowStatus.review);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can delete review entry from fork', () => {
|
|
|
|
login(taskResult.data.forkUser);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
goToWorkflow();
|
|
|
|
updateWorkflowStatus(entry1, workflowStatus.draft, workflowStatus.review);
|
|
|
|
deleteWorkflowEntry(entry1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can return entry to draft and delete it', () => {
|
|
|
|
login(taskResult.data.forkUser);
|
|
|
|
createPostAndExit(entry1);
|
|
|
|
goToWorkflow();
|
|
|
|
updateWorkflowStatus(entry1, workflowStatus.draft, workflowStatus.review);
|
|
|
|
|
|
|
|
updateWorkflowStatus(entry1, workflowStatus.review, workflowStatus.draft);
|
|
|
|
deleteWorkflowEntry(entry1);
|
|
|
|
});
|
|
|
|
}
|