Skip to content

Commit 3f920ad

Browse files
committed
Support async translation publishing
ENG-12759
1 parent 0722392 commit 3f920ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+887
-108
lines changed

.github/workflows/e2e.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ jobs:
1414
matrix:
1515
os: [ ubuntu-20.04 ]
1616
scenario: [
17+
# Copy source text
1718
"cypress/e2e/jobs/copy-source-text-flow/filters.cy.js",
1819
"cypress/e2e/jobs/copy-source-text-flow/success-path-multiple.cy.js",
1920
"cypress/e2e/jobs/copy-source-text-flow/success-path-single.cy.js",
21+
"cypress/e2e/jobs/copy-source-text-flow/success-path-multiple-async-publishing.cy.js"
22+
"cypress/e2e/jobs/copy-source-text-flow/success-path-single-async-publishing.cy.js"
23+
24+
# Instant
2025
"cypress/e2e/jobs/instant/success-path-multiple.cy.js",
2126
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug.cy.js",
2227
"cypress/e2e/jobs/instant/success-path-multiple-copy-slug-and-enable-after-publish.cy.js",
2328
"cypress/e2e/jobs/instant/success-path-multiple-enable-after-publish.cy.js",
29+
"cypress/e2e/jobs/instant/success-path-single.cy.js",
30+
"cypress/e2e/jobs/instant/success-path-multiple-async-publish.cy.js",
31+
"cypress/e2e/jobs/instant/success-path-single-async-publishing.cy.js",
32+
33+
# Verified
2434
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing.cy.js",
2535
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug.cy.js",
2636
"cypress/e2e/jobs/verified/success-path-multiple-bulk-publishing-copy-slug-and-enable-after-publish.cy.js",
@@ -30,7 +40,9 @@ jobs:
3040
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-copy-slug-and-enable-after-publish.cy.js",
3141
"cypress/e2e/jobs/verified/success-path-multiple-single-publishing-enable-after-publish.cy.js",
3242
"cypress/e2e/jobs/verified/success-path-single.cy.js",
33-
"cypress/e2e/jobs/instant/success-path-single.cy.js",
43+
"cypress/e2e/jobs/verified/success-path-multiple-bulk-async-publishing.cy.js",
44+
"cypress/e2e/jobs/verified/success-path-multiple-single-async-publishing.cy.js",
45+
"cypress/e2e/jobs/verified/success-path-single-async-publishing.cy.js",
3446
]
3547
runs-on: ubuntu-latest
3648
steps:
@@ -46,6 +58,7 @@ jobs:
4658
echo ${DB_DATABASE}
4759
make up
4860
make e2e-github
61+
max-attempts: 5
4962
- name: Copy artifacts
5063
if: ${{ failure() }}
5164
working-directory: ./e2e
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Copy Source Text] Success path for job with multiple target languages',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
8+
it('with copy slug disabled & enable after publish disabled', () => {
9+
const {jobTitle, slug} = generateJobData();
10+
11+
cy.copySourceTextFlow({
12+
slug,
13+
entryLabel,
14+
jobTitle,
15+
copySlug: false,
16+
enableAfterPublish: false,
17+
languages: ['de', 'es', 'uk'],
18+
batchPublishing: true,
19+
publishTranslationsAsync: true
20+
})
21+
});
22+
23+
it('with copy slug disabled & enable after publish enabled', () => {
24+
const {jobTitle, slug} = generateJobData();
25+
26+
cy.copySourceTextFlow({
27+
slug,
28+
entryLabel,
29+
jobTitle,
30+
copySlug: false,
31+
enableAfterPublish: true,
32+
languages: ['de', 'es', 'uk'],
33+
batchPublishing: true,
34+
publishTranslationsAsync: true
35+
})
36+
});
37+
38+
it('with copy slug enabled & enable after publish disabled', () => {
39+
const {jobTitle, slug} = generateJobData();
40+
41+
cy.copySourceTextFlow({
42+
slug,
43+
entryLabel,
44+
jobTitle,
45+
copySlug: true,
46+
enableAfterPublish: false,
47+
languages: ['de', 'es', 'uk'],
48+
batchPublishing: true,
49+
publishTranslationsAsync: true
50+
})
51+
});
52+
53+
it('with copy slug enabled & enable after publish enabled', () => {
54+
const {jobTitle, slug} = generateJobData();
55+
56+
cy.copySourceTextFlow({
57+
slug,
58+
entryLabel,
59+
jobTitle,
60+
copySlug: true,
61+
enableAfterPublish: true,
62+
languages: ['de', 'es', 'uk'],
63+
batchPublishing: true,
64+
publishTranslationsAsync: true
65+
})
66+
});
67+
});
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Copy Source Text] Success path for job with one target language',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
8+
it('with copy slug disabled & enable after publish disabled', () => {
9+
const {jobTitle, slug} = generateJobData();
10+
11+
cy.copySourceTextFlow({
12+
slug,
13+
entryLabel,
14+
jobTitle,
15+
copySlug: false,
16+
enableAfterPublish: false,
17+
languages: ["de"],
18+
publishTranslationsAsync: true
19+
})
20+
});
21+
22+
it('with copy slug disabled & enable after publish enabled', () => {
23+
const {jobTitle, slug} = generateJobData();
24+
25+
cy.copySourceTextFlow({
26+
slug,
27+
entryLabel,
28+
jobTitle,
29+
copySlug: false,
30+
enableAfterPublish: true,
31+
languages: ["de"],
32+
publishTranslationsAsync: true
33+
})
34+
});
35+
36+
it('with copy slug enabled & enable after publish disabled', () => {
37+
const {jobTitle, slug} = generateJobData();
38+
39+
cy.copySourceTextFlow({
40+
slug,
41+
entryLabel,
42+
jobTitle,
43+
copySlug: true,
44+
enableAfterPublish: false,
45+
languages: ["de"],
46+
publishTranslationsAsync: true
47+
})
48+
});
49+
50+
it('with copy slug enabled & enable after publish enabled', () => {
51+
const {jobTitle, slug} = generateJobData();
52+
53+
cy.copySourceTextFlow({
54+
slug,
55+
entryLabel,
56+
jobTitle,
57+
copySlug: true,
58+
enableAfterPublish: true,
59+
languages: ["de"],
60+
publishTranslationsAsync: true
61+
})
62+
});
63+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Instant] Success path for job with multiple target languages',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
const entryId = 24;
8+
9+
it('async publishing', () => {
10+
const {jobTitle, slug} = generateJobData();
11+
12+
cy.instantFlow({
13+
slug,
14+
entryLabel,
15+
jobTitle,
16+
entryId,
17+
copySlug: false,
18+
enableAfterPublish: false,
19+
languages: ['de', 'es', 'uk'],
20+
batchPublishing: true,
21+
publishTranslationsAsync: true
22+
});
23+
});
24+
25+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Instant] Success path for job with single target language',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
const entryId = 24;
8+
9+
it('async publishing', () => {
10+
const {jobTitle, slug} = generateJobData();
11+
12+
cy.instantFlow({
13+
slug,
14+
entryLabel,
15+
jobTitle,
16+
entryId,
17+
copySlug: false,
18+
enableAfterPublish: false,
19+
languages: ["de"],
20+
publishTranslationsAsync: true
21+
})
22+
});
23+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Verified] Success path for job with multiple target languages with bulk publishing',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
const entryId = 24;
8+
9+
it('async publishing', () => {
10+
const {jobTitle, slug} = generateJobData();
11+
12+
cy.verifiedFlow({
13+
slug,
14+
entryLabel,
15+
jobTitle,
16+
entryId,
17+
copySlug: false,
18+
enableAfterPublish: false,
19+
languages: ['de', 'es', 'uk'],
20+
batchPublishing: true,
21+
publishTranslationsAsync: true
22+
});
23+
});
24+
25+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Verified] Success path for job with multiple target languages with single publishing',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
const entryId = 24;
8+
9+
it('async publishing', () => {
10+
const {jobTitle, slug} = generateJobData();
11+
12+
cy.verifiedFlow({
13+
slug,
14+
entryLabel,
15+
jobTitle,
16+
entryId,
17+
copySlug: false,
18+
enableAfterPublish: false,
19+
languages: ['de', 'es', 'uk'],
20+
batchPublishing: false,
21+
publishTranslationsAsync: true
22+
});
23+
});
24+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const {generateJobData} = require('../../../support/job/generator.js');
2+
3+
describe(
4+
'[Verified] Success path for job with single target language',
5+
() => {
6+
const entryLabel = 'The Future of Augmented Reality';
7+
const entryId = 24;
8+
9+
it('async publishing', () => {
10+
const {jobTitle, slug} = generateJobData();
11+
12+
cy.verifiedFlow({
13+
slug,
14+
entryLabel,
15+
jobTitle,
16+
entryId,
17+
copySlug: false,
18+
enableAfterPublish: false,
19+
languages: ["de"],
20+
publishTranslationsAsync: true
21+
})
22+
});
23+
});

e2e/cypress/support/commands.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -575,18 +575,22 @@ Cypress.Commands.add('assertEntryContent',
575575
* @param {object} options
576576
* @returns undefined
577577
*/
578-
Cypress.Commands.add('copySourceTextFlow', ({
579-
slug,
580-
entryLabel,
581-
jobTitle,
582-
copySlug = false,
583-
enableAfterPublish = false,
584-
languages = ['de'],
585-
batchPublishing = false, //publish all translations at once with publish button
586-
entryId = 24,
587-
}) => {
578+
Cypress.Commands.add(
579+
'copySourceTextFlow',
580+
({
581+
slug,
582+
entryLabel,
583+
jobTitle,
584+
copySlug = false,
585+
enableAfterPublish = false,
586+
languages = ['de'],
587+
batchPublishing = false, //publish all translations at once with publish button
588+
entryId = 24,
589+
publishTranslationsAsync = true,
590+
}) => {
588591
cy.setConfigurationOption('enableEntries', enableAfterPublish);
589592
cy.setConfigurationOption('copySlug', copySlug);
593+
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);
590594

591595
if (copySlug) {
592596
// update slug on entry and enable slug copy option

e2e/cypress/support/flow/instant.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Cypress.Commands.add('instantFlow', ({
1717
batchPublishing = false, //publish all translations at once with publish button
1818
entryId = 24,
1919
splitSend = true,
20+
publishTranslationsAsync = false,
2021
}) => {
2122
const isMockserverEnabled = Cypress.env('MOCKSERVER_ENABLED');
2223

@@ -27,6 +28,7 @@ Cypress.Commands.add('instantFlow', ({
2728
cy.setConfigurationOption('enableEntries', enableAfterPublish);
2829
cy.setConfigurationOption('copySlug', copySlug);
2930
cy.setConfigurationOption('splitSend', splitSend);
31+
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);
3032

3133
if (copySlug) {
3234
// update slug on entry and enable slug copy option

e2e/cypress/support/flow/verified.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Cypress.Commands.add('verifiedFlow', ({
1818
batchPublishing = false, //publish all translations at once with publish button
1919
entryId = 24,
2020
splitSend = true,
21+
publishTranslationsAsync = true,
2122
}) => {
2223
const isMockserverEnabled = Cypress.env('MOCKSERVER_ENABLED');
2324

@@ -28,6 +29,7 @@ Cypress.Commands.add('verifiedFlow', ({
2829
cy.setConfigurationOption('enableEntries', enableAfterPublish);
2930
cy.setConfigurationOption('copySlug', copySlug);
3031
cy.setConfigurationOption('splitSend', splitSend);
32+
cy.setConfigurationOption('publishTranslationsAsync', publishTranslationsAsync);
3133

3234
if (copySlug) {
3335
// update slug on entry and enable slug copy option

src/Craftliltplugin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use lilthq\craftliltplugin\services\handlers\CreateTranslationsHandler;
3535
use lilthq\craftliltplugin\services\handlers\EditJobHandler;
3636
use lilthq\craftliltplugin\services\handlers\LoadI18NHandler;
37+
use lilthq\craftliltplugin\services\handlers\PublishDraftAsyncHandler;
3738
use lilthq\craftliltplugin\services\handlers\PublishDraftHandler;
3839
use lilthq\craftliltplugin\services\handlers\RefreshJobStatusHandler;
3940
use lilthq\craftliltplugin\services\handlers\SendJobToLiltConnectorHandler;
@@ -90,6 +91,7 @@
9091
* @property SendTranslationToLiltConnectorHandler $sendTranslationToLiltConnectorHandler
9192
* @property SyncJobFromLiltConnectorHandler $syncJobFromLiltConnectorHandler
9293
* @property PublishDraftHandler $publishDraftsHandler
94+
* @property PublishDraftAsyncHandler $publishDraftsHandlerAsync
9395
* @property Configuration $connectorConfiguration
9496
* @property JobsApi $connectorJobsApi
9597
* @property TranslationsApi $connectorTranslationsApi

src/assets/resources/entry-edit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CraftliltPlugin.EntryEditWarning = Garnish.Base.extend({
1313
'statuses[1]': ['in-progress'],
1414
'statuses[2]': ['ready-for-review'],
1515
'statuses[3]': ['ready-to-publish'],
16+
'statuses[4]': ['publishing'],
1617
});
1718

1819
const container = jQuery('<div />').

0 commit comments

Comments
 (0)