diff --git a/.env b/.env new file mode 100644 index 00000000..910cfcc6 --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +AEM_TLS_CERT=env/server.crt +AEM_TLS_KEY=env/server.key +AEM_OPEN=/ +AEM_PORT=443 diff --git a/.eslintignore b/.eslintignore index 2a9dad20..498833ee 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ scripts/libs/** +test/e2e/ diff --git a/.eslintrc.js b/.eslintrc.js index 9df78d8e..fc274ae1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,8 @@ module.exports = { 'no-use-before-define': 'off', 'no-return-await': 'off', 'no-restricted-syntax': 'off', - 'max-len': ['warn', { code: 140 }], + 'no-else-return': 'off', 'import/prefer-default-export': 'off', + 'max-len': ['warn', { code: 140 }], }, }; diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..b0ff8112 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +README.md merge=ours diff --git a/.github/workflows/playwright.yml.disabled b/.github/workflows/playwright.yml.disabled new file mode 100644 index 00000000..261e663d --- /dev/null +++ b/.github/workflows/playwright.yml.disabled @@ -0,0 +1,39 @@ +# Does not work, because Adobe flags the source IP as untrusted, and requires confirming a code sent by email. + +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + working-directory: test/e2e/ + - name: Install Playwright Browsers + run: npx playwright install --with-deps + working-directory: test/e2e/ + - name: Run Playwright tests + run: | + mkdir -p .auth; + echo "{}" > .auth/user.json; + npx playwright test + working-directory: test/e2e/ + env: + TEST_USERNAME: ${{ secrets.TEST_USERNAME }} + TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} + SHELL_SOURCE: stage + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: test/e2e/playwright-report/ + retention-days: 30 diff --git a/.gitignore b/.gitignore index 54e196a1..0c8e22b9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ helix-importer-ui /env/ .env server.crt -server.key \ No newline at end of file +server.key +/test/e2e/test-results diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..ec60d123 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +registry=https://artifactory.corp.adobe.com:443/artifactory/api/npm/npm-adobe-release/ +//artifactory.corp.adobe.com:443/artifactory/api/npm/npm-adobe-release/:always-auth=false diff --git a/404.html b/404.html index 44f1f6d6..e435cb7c 100644 --- a/404.html +++ b/404.html @@ -14,10 +14,14 @@ diff --git a/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.css b/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.css index 1f8c69c1..a71fc53e 100644 --- a/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.css +++ b/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.css @@ -10,7 +10,6 @@ flex-direction: column; row-gap: 31px; width: 100%; - height: 100%; } .adp-add-to-collection-modal-container .dialog-header { diff --git a/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js b/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js index a3d88cd4..d02ace0c 100644 --- a/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js +++ b/blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js @@ -2,12 +2,10 @@ import { decorateIcons } from '../../scripts/lib-franklin.js'; import { searchListCollection, createCollection, patchCollection, getCollection, } from '../../scripts/collections.js'; -import { getSelectedAssetsFromInfiniteResultsBlock, populateAssetViewLeftDialog } from '../../scripts/scripts.js'; +import { populateAssetViewLeftDialog } from '../../scripts/scripts.js'; +import { getSelectedAssetsFromInfiniteResultsBlock } from '../../scripts/shared.js'; import createMultiSelectedAssetsTable from '../../scripts/multi-selected-assets-table.js'; - -function closeDialog(dialog) { - dialog.close(); -} +import { addDialogEventListeners } from '../../scripts/dialog-html-builder.js'; // Function to create the new collection input function createNewCollectionInput(newCollectionRadioInputContainer) { @@ -145,12 +143,11 @@ export async function openModal(items) { } // Close the dialog - closeDialog(dialog); + dialog.close(); }); dialog.querySelector('.action-cancel').addEventListener('click', () => { - resetDialogState(); - closeDialog(dialog); + dialog.close(); }); dialog.showModal(); @@ -240,8 +237,10 @@ async function populateMultiAssetView(dialog) { } export default async function decorate(block) { - block.innerHTML = ``; decorateIcons(block); - + const dialog = block.querySelector('dialog'); block.querySelector('#asset-details-close').addEventListener('click', () => { - closeModal(block); + dialog.close(); }); - - document.addEventListener('keydown', (event) => { - if (event.key === 'Escape' && block.querySelector('.modal-container').open) { - closeModal(block); - } + addDialogEventListeners(dialog, { + closeModalOnEscape: true, + closeModalOnOutsideClick: true, + onClose: () => { + closeAssetDetailsModal(block); + }, }); // eslint-disable-next-line func-names diff --git a/blocks/adp-asset-details-panel/adp-asset-details-panel.css b/blocks/adp-asset-details-panel/adp-asset-details-panel.css index 00bf7a7d..f79526b2 100644 --- a/blocks/adp-asset-details-panel/adp-asset-details-panel.css +++ b/blocks/adp-asset-details-panel/adp-asset-details-panel.css @@ -3,13 +3,17 @@ max-height: calc(100vh - 155px); min-height: calc(100vh - 235px); position: sticky; - top: 151px; + top: calc(var(--nav-height) + var(--main-container-padding-top)); box-shadow: 0 0 7px rgb(0 0 0 / 10%); border-radius: 10px; scrollbar-width: none; overflow: auto; } +.contenthub .adp-asset-details-panel-wrapper { + top: calc(var(--nav-height) + var(--main-container-padding-top) + 46px); +} + .adp-asset-details-panel-wrapper::-webkit-scrollbar { width: 0; } diff --git a/blocks/adp-asset-details-panel/adp-asset-details-panel.js b/blocks/adp-asset-details-panel/adp-asset-details-panel.js index 45b693fd..2b0c2634 100644 --- a/blocks/adp-asset-details-panel/adp-asset-details-panel.js +++ b/blocks/adp-asset-details-panel/adp-asset-details-panel.js @@ -129,7 +129,7 @@ export async function openAssetDetailsPanel(assetId, resultsManagerObj) { } export default async function decorate(block) { - block.innerHTML = ` + block.innerHTML = `