Skip to content

Commit

Permalink
BACKLOG-20402: Increase integration test timeouts; Fix missing test m…
Browse files Browse the repository at this point in the history
…odule build (#912)

* BACKLOG-20402: Increase integration test timeouts on github workflows

* Remove version, and jcontent uninstall

* Adjust static analysis max warnings

* Fix test lint errors, cypress/unsafe-to-chain-command

* Enable build test module (specify tests_module_type=mvn by default)

* Revert rename

* Add internal repository
  • Loading branch information
gflores-jahia authored Aug 1, 2023
1 parent 47322e7 commit 32ab950
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
jahia_image: ["jahia/jahia-ee:8", "jahia/jahia-ee-dev:8-SNAPSHOT"]
timeout-minutes: 45
timeout-minutes: 120
steps:
- uses: jahia/jahia-modules-action/helper@v2
- uses: KengoTODA/actions-setup-docker-compose@main
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/on-code-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
with:
node_version: 14
auditci_level: critical
max_warning: 58

build:
name: Build Module
Expand All @@ -45,7 +46,6 @@ jobs:
nexus_username: ${{ secrets.NEXUS_USERNAME }}
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
module_id: jcontent
tests_module_type: "npm"

sonar-analysis:
name: Sonar Analysis
Expand Down Expand Up @@ -83,6 +83,7 @@ jobs:
should_use_build_artifacts: true
should_skip_testrail: true
github_artifact_name: jcontent-standalone-artifacts-${{ github.run_number }}
bastion_ssh_private_key: ${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
jahia_license: ${{ secrets.JAHIA_LICENSE_8X_FULL }}
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand All @@ -98,6 +99,7 @@ jobs:
incident_google_client_email: ${{ secrets.INCIDENT_GOOGLE_CLIENT_EMAIL }}
incident_google_api_key_base64: ${{ secrets.INCIDENT_GOOGLE_PRIVATE_KEY_BASE64 }}
zencrepes_secret: ${{ secrets.ZENCREPES_WEBHOOK_SECRET }}
timeout_minutes: 90
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ jobs:
nexus_username: ${{ secrets.NEXUS_USERNAME }}
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
module_id: jcontent
tests_module_type: "npm"


sbom:
name: SBOM processing
needs: build
runs-on: ubuntu-latest
container:
image: cyclonedx/cyclonedx-cli:0.24.2
image: cyclonedx/cyclonedx-cli:0.24.2
steps:
- uses: jahia/jahia-modules-action/sbom-processing@v2
with:
Expand All @@ -57,7 +56,7 @@ jobs:
name: Integration Tests (Standalone)
needs: build
runs-on: self-hosted
timeout-minutes: 60
timeout-minutes: 120
steps:
- uses: jahia/jahia-modules-action/helper@v2
- uses: KengoTODA/actions-setup-docker-compose@main
Expand Down Expand Up @@ -116,4 +115,3 @@ jobs:
with:
nexus_username: ${{ secrets.NEXUS_USERNAME }}
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
tests_module_type: "npm"
8 changes: 6 additions & 2 deletions tests/assets/provisioning.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- addMavenRepository: 'https://store.jahia.com/nexus/content/repositories/jahia-public-app-store@id=JahiaStore'
- addMavenRepository: 'https://devtools.jahia.com/nexus/content/groups/public/@snapshots@noreleases@id=JahiaPublicSnapshots'

- uninstallBundle: "org.jahia.modules/content-editor/4.6.0.SNAPSHOT"
- addMavenRepository: 'https://devtools.jahia.com/nexus/content/groups/internal@id=jahia-internal@snapshots'
username: ${env:NEXUS_USERNAME}
password: ${env:NEXUS_PASSWORD}

- installBundle:
- 'mvn:org.jahia.modules/press/3.1.0'
Expand Down Expand Up @@ -37,3 +38,6 @@
site: "digitall"

- executeScript: "script-01-create-categories.groovy"

- uninstallBundle:
- "org.jahia.modules/content-editor"
Original file line number Diff line number Diff line change
Expand Up @@ -41,65 +41,61 @@ describe('Add Mixin by using choice list initializers (Image Reference)', () =>
cy.get('#contenteditor-dialog-title')
.should('be.visible')
.and('contain', 'Create Image (from the Document Manager)');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="internal"]')
.click();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]')
.scrollIntoView()
.should('be.visible');

const selector = '[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]';
cy.get(selector).scrollIntoView();
contentEditor.getLanguageSwitcher().select('Français');
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]')
.as('fr_internal_link')
.scrollIntoView()
.should('be.visible');
cy.get(selector).as('fr_internal_link').scrollIntoView();
cy.get(selector).should('be.visible');

cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="external"]')
.click();
cy.get('@fr_internal_link').should('not.exist');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:url"]').scrollIntoView().should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]').should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:url"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:url"]').should('be.visible');
contentEditor.getLanguageSwitcher().select('Deutsch');
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').should('not.exist');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:linkTitle"]').should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:externalLink_j\\:url"]')
.as('de_external_link_url')
.scrollIntoView()
.should('be.visible');
.scrollIntoView();
cy.get('@de_external_link_url').should('be.visible');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="none"]')
.click();
cy.get('@de_external_link_url').should('not.exist');
contentEditor.getLanguageSwitcher().select('English');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').contains('No link');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="internal"]')
.click();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]')
.scrollIntoView()
.should('be.visible')
.click();
cy.get('.moonstone-loader').should('not.exist'); // Wait to load
cy.get('.moonstone-tab-item[data-cm-view-type="pages"]')
.should('be.visible')
.click()
.should('have.class', 'moonstone-selected');
cy.get('.moonstone-tab-item[data-cm-view-type="pages"]').should('be.visible').click();
cy.get('.moonstone-tab-item[data-cm-view-type="pages"]').should('have.class', 'moonstone-selected');
cy.get('.moonstone-loader').should('not.exist'); // Wait to load
cy.get('tr[data-cm-role="table-content-list-row"]').contains('Search Results').click();
cy.get('button[data-sel-picker-dialog-action="done"]').click();
cy.get('[data-sel-content-editor-field="jnt\\:imageReferenceLink_jcr\\:title"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jnt\\:imageReferenceLink_jcr\\:title"]')
.scrollIntoView()
.should('be.visible')
.type(cypressDocumentManagerImageReferenceLinkTest);
cy.get('[data-sel-content-editor-field="jnt\\:imageReferenceLink_j\\:node"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jnt\\:imageReferenceLink_j\\:node"]')
.scrollIntoView()
.should('be.visible')
.click();
cy.get('[data-sel-role-card="snowbearHome.jpeg"]').should('be.visible').contains('snowbearHome.jpeg').click();
Expand All @@ -119,26 +115,25 @@ describe('Add Mixin by using choice list initializers (Image Reference)', () =>
cy.get('#contenteditor-dialog-title')
.should('be.visible')
.and('contain', 'Cypress document manager image reference');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="none"]')
.click();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').should('not.exist');
contentEditor.getLanguageSwitcher().select('Français');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').contains('Pas de lien');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').click();
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType')
.click()
.find('li[role="option"][data-value="internal"]')
.click();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]')
.scrollIntoView()
.should('be.visible');
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').should('be.visible');
contentEditor.getLanguageSwitcher().select('English');
cy.get('#select-jnt\\:imageReferenceLink_j\\:linkType').contains('Internal');
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]')
.should('exist')
.scrollIntoView()
.should('be.visible');
.scrollIntoView();
cy.get('[data-sel-content-editor-field="jmix\\:internalLink_j\\:linknode"]').should('be.visible');
// ContentEditor.cancelAndDiscard()
contentEditor.cancel();
});
Expand Down
1 change: 0 additions & 1 deletion tests/cypress/e2e/contentEditor/contentEditorForm.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('Content editor form', () => {
}
}`
}).should(resp => {
// eslint-disable-next-line no-unused-expressions
expect(resp?.data?.jcr?.mutateNode.mutateProperty.setValue).to.be.true;
});
}
Expand Down
2 changes: 0 additions & 2 deletions tests/cypress/e2e/contentEditor/contentMultiLanguage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('Create multi language content and verify that it is different in all l
path: `/sites/${sitekey}/home`
}
}).then(response => {
// eslint-disable-next-line
expect(response?.data?.jcr?.mutateNode?.mutateProperty?.setValue).to.be.true;
});

Expand All @@ -78,7 +77,6 @@ describe('Create multi language content and verify that it is different in all l
path: `/sites/${sitekey}/home`
}
}).then(response => {
// eslint-disable-next-line
expect(response?.data?.jcr?.mutateNode?.mutateProperty?.setValue).to.be.true;
});

Expand Down
1 change: 1 addition & 0 deletions tests/cypress/e2e/contentEditor/createContentI18N.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ describe('Create content tests in I18N site', () => {
const jcontent = JContent.visit(sitekey, 'en', 'media/file');
const fileName = 'snowbearHome.jpeg';
const fieldName = 'jnt:file_jcr:title';
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get('div[data-cm-role="grid-content-list"]')
.children('div')
.selectFile(`cypress/fixtures/contentEditor/${fileName}`, {
Expand Down
10 changes: 4 additions & 6 deletions tests/cypress/e2e/contentEditor/editorUrl.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ describe('Editor url test', () => {
const baseUrl = '/jahia/jcontent/digitall/en/pages/home/about';
const ceParams = `(contentEditor:!((formKey:modal_0,isFullscreen:!t,lang:en,mode:edit,site:digitall,uilang:en,uuid:'${validUuid}')))`;
cy.visit(`${baseUrl}#${ceParams}`);
cy.get('[data-sel-role="tab-advanced-options"]')
.click()
.should('have.class', 'moonstone-selected');
cy.get('[data-sel-role="tab-advanced-options"]').click();
cy.get('[data-sel-role="tab-advanced-options"]').should('have.class', 'moonstone-selected');
cy.get('[data-sel-role="advanced-options-nav"] li')
.contains('Edit roles')
.click();
Expand Down Expand Up @@ -168,9 +167,8 @@ describe('Editor url test', () => {
const baseUrl = '/jahia/jcontent/digitall/en/pages/home/about';
const ceParams = `(contentEditor:!((formKey:modal_0,isFullscreen:!t,lang:en,mode:edit,site:digitall,uilang:en,uuid:'${validUuid}')))`;
cy.visit(`${baseUrl}#${ceParams}`);
cy.get('[data-sel-role="tab-advanced-options"]')
.click()
.should('have.class', 'moonstone-selected');
cy.get('[data-sel-role="tab-advanced-options"]').click();
cy.get('[data-sel-role="tab-advanced-options"]').should('have.class', 'moonstone-selected');
cy.get('[data-sel-role="advanced-options-nav"] li')
.contains('Edit roles')
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe('Picker - Editorial link', {testIsolation: false}, () => {
.should(elems => {
const texts = elems.get().map(e => e.textContent);
const allTypes = texts.sort().every(content => ['Content Folder', 'Person portrait', 'Article (title and introduction)'].includes(content));
// eslint-disable-next-line no-unused-expressions
expect(allTypes).to.be.true;
});
picker.cancel();
Expand Down
9 changes: 6 additions & 3 deletions tests/cypress/page-object/contentEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ export class ContentEditor extends BasePage {
}

addAnotherContent() {
cy.get('#createAnother').check().should('have.attr', 'aria-checked', 'true');
cy.get('#createAnother').check();
cy.get('#createAnother').should('have.attr', 'aria-checked', 'true');
}

removeAnotherContent() {
cy.get('#createAnother').uncheck().should('have.attr', 'aria-checked', 'false');
cy.get('#createAnother').uncheck();
cy.get('#createAnother').should('have.attr', 'aria-checked', 'false');
}

activateWorkInProgressMode(language?: string) {
Expand Down Expand Up @@ -145,7 +147,8 @@ export class ContentEditor extends BasePage {
}

toggleOption(optionType: string, optionFieldName: string) {
cy.get(`span[data-sel-role-dynamic-fieldset="${optionType}"]`).scrollIntoView({offset: {left: 0, top: -100}}).find('input').click({force: true});
cy.get(`span[data-sel-role-dynamic-fieldset="${optionType}"]`).scrollIntoView({offset: {left: 0, top: -100}});
cy.get(`span[data-sel-role-dynamic-fieldset="${optionType}"]`).find('input').click({force: true});
cy.contains(optionFieldName, {timeout: 90000}).should('be.visible');
}

Expand Down
1 change: 0 additions & 1 deletion tests/cypress/page-object/jcontent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
getElement,
Menu,
SecondaryNav,
Table,
TableRow
} from '@jahia/cypress';
import {BasicSearch} from './basicSearch';
Expand Down
27 changes: 18 additions & 9 deletions tests/cypress/page-object/pageComposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class PageComposer extends BasePage {
componentShouldBeVisible(selector: string) {
cy.iframe('#page-composer-frame', this.iFrameOptions).within(() => {
cy.iframe('.gwt-Frame', this.iFrameOptions).within(() => {
cy.get('.container').find(selector).should('exist').scrollIntoView().should('be.visible');
cy.get('.container').find(selector).should('exist').scrollIntoView();
cy.get('.container').find(selector).should('be.visible');
});
});
}
Expand All @@ -70,11 +71,13 @@ export class PageComposer extends BasePage {
cy.iframe('.gwt-Frame', this.iFrameOptions).within(() => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(5000);
cy.get('.container').find(selector).trigger('mouseover').rightclick({force: true});
cy.get('.container').find(selector).trigger('mouseover');
cy.get('.container').find(selector).rightclick({force: true});
});
});
cy.iframe('#page-composer-frame', this.iFrameOptions).within(() => {
cy.get('.editModeContextMenu').scrollIntoView().contains('Edit').click();
cy.get('.editModeContextMenu').scrollIntoView();
cy.get('.editModeContextMenu').contains('Edit').click();
});
return new ContentEditor();
}
Expand All @@ -84,11 +87,13 @@ export class PageComposer extends BasePage {
cy.iframe('.gwt-Frame', this.iFrameOptions).within(() => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(5000);
cy.get('.container').contains(text).trigger('mouseover').rightclick({force: true});
cy.get('.container').contains(text).trigger('mouseover');
cy.get('.container').contains(text).rightclick({force: true});
});
});
cy.iframe('#page-composer-frame', this.iFrameOptions).within(() => {
cy.get('.editModeContextMenu').scrollIntoView().contains('Edit').click();
cy.get('.editModeContextMenu').scrollIntoView();
cy.get('.editModeContextMenu').contains('Edit').click();
});
return new ContentEditor();
}
Expand Down Expand Up @@ -147,8 +152,10 @@ export class PageComposer extends BasePage {
cy.get('#nt\\:base_ce\\:systemName').should('be.visible').type(title, {force: true});
}

cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName').should('be.visible')
.click()
cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName')
.should('be.visible')
.click();
cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName')
.find('li[role="option"][data-value="home"]')
.click();

Expand All @@ -164,8 +171,10 @@ export class PageComposer extends BasePage {
});

cy.get('#jnt\\:page_jcr\\:title').should('be.visible').type(title, {force: true});
cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName').should('be.visible')
.click()
cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName')
.should('be.visible')
.click();
cy.get('#select-jmix\\:hasTemplateNode_j\\:templateName')
.find('li[role="option"][data-value="home"]')
.click();

Expand Down
8 changes: 6 additions & 2 deletions tests/cypress/page-object/pickerTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ export class PickerTable extends Table {
this.getRows().get()
.then(elems => {
expect(elems.length).gte(count);
const selectRow = elem =>
const selectRow = elem => {
cy.wrap(elem)
.find('[data-cm-role="table-content-list-cell-selection"] input')
.click();
cy.wrap(elem)
.find('[data-cm-role="table-content-list-cell-selection"] input')
.click()
.should('have.attr', 'aria-checked', 'true');
};

for (let i = 0; i < count; i++) {
selectRow(elems.eq(i));
}
Expand Down
Loading

0 comments on commit 32ab950

Please sign in to comment.