Skip to content

Commit

Permalink
Support async translation publishing
Browse files Browse the repository at this point in the history
ENG-12759
  • Loading branch information
hadomskyi committed Apr 21, 2024
1 parent 0722392 commit d03972b
Show file tree
Hide file tree
Showing 42 changed files with 887 additions and 108 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ jobs:
"cypress/e2e/jobs/copy-source-text-flow/filters.cy.js",
"cypress/e2e/jobs/copy-source-text-flow/success-path-multiple.cy.js",
"cypress/e2e/jobs/copy-source-text-flow/success-path-single.cy.js",
"cypress/e2e/jobs/copy-source-text-flow/success-path-multiple-async-publishing.cy.js"
"cypress/e2e/jobs/copy-source-text-flow/success-path-single-async-publishing.cy.js"
"cypress/e2e/jobs/instant/success-path-multiple.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug-and-enable-after-publish.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-enable-after-publish.cy.js",
"cypress/e2e/jobs/instant/success-path-single.cy.js",
"cypress/e2e/jobs/instant/success-path-multiple-async-publish.cy.js",
"cypress/e2e/jobs/instant/success-path-single-async-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug-and-enable-after-publish.cy.js",
Expand All @@ -30,7 +35,9 @@ jobs:
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-copy-slug-and-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-enable-after-publish.cy.js",
"cypress/e2e/jobs/verified/success-path-single.cy.js",
"cypress/e2e/jobs/instant/success-path-single.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-bulk-async-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-multiple-single-async-publishing.cy.js",
"cypress/e2e/jobs/verified/success-path-single-async-publishing.cy.js"
]
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 6 additions & 0 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ export default defineConfig({
// implement node event listeners here
},
},
retries: {
// Configure retry attempts for `cypress run`
runMode: 2,
// Configure retry attempts for `cypress open`
openMode: 0
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Copy Source Text] Success path for job with multiple target languages',
() => {
const entryLabel = 'The Future of Augmented Reality';

it('with copy slug disabled & enable after publish disabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: false,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
})
});

it('with copy slug disabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: false,
enableAfterPublish: true,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
})
});

it('with copy slug enabled & enable after publish disabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: true,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
})
});

it('with copy slug enabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: true,
enableAfterPublish: true,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
})
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Copy Source Text] Success path for job with one target language',
() => {
const entryLabel = 'The Future of Augmented Reality';

it('with copy slug disabled & enable after publish disabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: false,
enableAfterPublish: false,
languages: ["de"],
publishTranslationsAsync: true
})
});

it('with copy slug disabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: false,
enableAfterPublish: true,
languages: ["de"],
publishTranslationsAsync: true
})
});

it('with copy slug enabled & enable after publish disabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: true,
enableAfterPublish: false,
languages: ["de"],
publishTranslationsAsync: true
})
});

it('with copy slug enabled & enable after publish enabled', () => {
const {jobTitle, slug} = generateJobData();

cy.copySourceTextFlow({
slug,
entryLabel,
jobTitle,
copySlug: true,
enableAfterPublish: true,
languages: ["de"],
publishTranslationsAsync: true
})
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Instant] Success path for job with multiple target languages',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('async publishing', () => {
const {jobTitle, slug} = generateJobData();

cy.instantFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
});
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Instant] Success path for job with single target language',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('async publishing', () => {
const {jobTitle, slug} = generateJobData();

cy.instantFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: false,
languages: ["de"],
publishTranslationsAsync: true
})
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Verified] Success path for job with multiple target languages with bulk publishing',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('async publishing', () => {
const {jobTitle, slug} = generateJobData();

cy.verifiedFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: true,
publishTranslationsAsync: true
});
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Verified] Success path for job with multiple target languages with single publishing',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('async publishing', () => {
const {jobTitle, slug} = generateJobData();

cy.verifiedFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: false,
languages: ['de', 'es', 'uk'],
batchPublishing: false,
publishTranslationsAsync: true
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const {generateJobData} = require('../../../support/job/generator.js');

describe(
'[Verified] Success path for job with single target language',
() => {
const entryLabel = 'The Future of Augmented Reality';
const entryId = 24;

it('async publishing', () => {
const {jobTitle, slug} = generateJobData();

cy.verifiedFlow({
slug,
entryLabel,
jobTitle,
entryId,
copySlug: false,
enableAfterPublish: false,
languages: ["de"],
publishTranslationsAsync: true
})
});
});
24 changes: 14 additions & 10 deletions e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,18 +575,22 @@ Cypress.Commands.add('assertEntryContent',
* @param {object} options
* @returns undefined
*/
Cypress.Commands.add('copySourceTextFlow', ({
slug,
entryLabel,
jobTitle,
copySlug = false,
enableAfterPublish = false,
languages = ['de'],
batchPublishing = false, //publish all translations at once with publish button
entryId = 24,
}) => {
Cypress.Commands.add(
'copySourceTextFlow',
({
slug,
entryLabel,
jobTitle,
copySlug = false,
enableAfterPublish = false,
languages = ['de'],
batchPublishing = false, //publish all translations at once with publish button
entryId = 24,
publishTranslationsAsync = true,
}) => {
cy.setConfigurationOption('enableEntries', enableAfterPublish);
cy.setConfigurationOption('copySlug', copySlug);
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);

if (copySlug) {
// update slug on entry and enable slug copy option
Expand Down
2 changes: 2 additions & 0 deletions e2e/cypress/support/flow/instant.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Cypress.Commands.add('instantFlow', ({
batchPublishing = false, //publish all translations at once with publish button
entryId = 24,
splitSend = true,
publishTranslationsAsync = false,
}) => {
const isMockserverEnabled = Cypress.env('MOCKSERVER_ENABLED');

Expand All @@ -27,6 +28,7 @@ Cypress.Commands.add('instantFlow', ({
cy.setConfigurationOption('enableEntries', enableAfterPublish);
cy.setConfigurationOption('copySlug', copySlug);
cy.setConfigurationOption('splitSend', splitSend);
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);

if (copySlug) {
// update slug on entry and enable slug copy option
Expand Down
2 changes: 2 additions & 0 deletions e2e/cypress/support/flow/verified.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Cypress.Commands.add('verifiedFlow', ({
batchPublishing = false, //publish all translations at once with publish button
entryId = 24,
splitSend = true,
publishTranslationsAsync = true,
}) => {
const isMockserverEnabled = Cypress.env('MOCKSERVER_ENABLED');

Expand All @@ -28,6 +29,7 @@ Cypress.Commands.add('verifiedFlow', ({
cy.setConfigurationOption('enableEntries', enableAfterPublish);
cy.setConfigurationOption('copySlug', copySlug);
cy.setConfigurationOption('splitSend', splitSend);
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);

if (copySlug) {
// update slug on entry and enable slug copy option
Expand Down
2 changes: 2 additions & 0 deletions src/Craftliltplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use lilthq\craftliltplugin\services\handlers\CreateTranslationsHandler;
use lilthq\craftliltplugin\services\handlers\EditJobHandler;
use lilthq\craftliltplugin\services\handlers\LoadI18NHandler;
use lilthq\craftliltplugin\services\handlers\PublishDraftAsyncHandler;
use lilthq\craftliltplugin\services\handlers\PublishDraftHandler;
use lilthq\craftliltplugin\services\handlers\RefreshJobStatusHandler;
use lilthq\craftliltplugin\services\handlers\SendJobToLiltConnectorHandler;
Expand Down Expand Up @@ -90,6 +91,7 @@
* @property SendTranslationToLiltConnectorHandler $sendTranslationToLiltConnectorHandler
* @property SyncJobFromLiltConnectorHandler $syncJobFromLiltConnectorHandler
* @property PublishDraftHandler $publishDraftsHandler
* @property PublishDraftAsyncHandler $publishDraftsHandlerAsync
* @property Configuration $connectorConfiguration
* @property JobsApi $connectorJobsApi
* @property TranslationsApi $connectorTranslationsApi
Expand Down
1 change: 1 addition & 0 deletions src/assets/resources/entry-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CraftliltPlugin.EntryEditWarning = Garnish.Base.extend({
'statuses[1]': ['in-progress'],
'statuses[2]': ['ready-for-review'],
'statuses[3]': ['ready-to-publish'],
'statuses[4]': ['publishing'],
});

const container = jQuery('<div />').
Expand Down
Loading

0 comments on commit d03972b

Please sign in to comment.