Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support async translation publishing #149

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/craft-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,8 @@ jobs:
echo "PHP_VERSION=7.2" >> $GITHUB_ENV
echo "CRAFT_VERSION=${{ matrix.craft_version }}" >> $GITHUB_ENV
- name: Test craft versions ${{ matrix.craft_version }}
run: make test-craft-versions
uses: nick-fields/retry@v3
with:
max_attempts: 5
timeout_minutes: 20
command: make test-craft-versions
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: 5,
// 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
})
});
});
27 changes: 17 additions & 10 deletions e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Cypress.Commands.add('setConfigurationOption', (option, enabled) => {
splitSend: {
id: 'queueEachTranslationFileSeparately',
},
publishTranslationsAsync: {
id: 'publishTranslationsAsync',
},
};

if (!options[option]) {
Expand Down Expand Up @@ -575,18 +578,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 = false,
}) => {
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
Loading
Loading