From 76e7fe5d45e0f410bcb909f61d3168e75d7919b4 Mon Sep 17 00:00:00 2001 From: Travis Tonsbeek <44540148+beekerr@users.noreply.github.com> Date: Thu, 9 May 2024 05:25:32 -0700 Subject: [PATCH 01/28] Update helix-sitemap.yaml Removed unnecessary region and languages --- helix-sitemap.yaml | 215 --------------------------------------------- 1 file changed, 215 deletions(-) diff --git a/helix-sitemap.yaml b/helix-sitemap.yaml index 288d57c..659c964 100644 --- a/helix-sitemap.yaml +++ b/helix-sitemap.yaml @@ -11,26 +11,6 @@ sitemaps: alternate: /{path}.html destination: /sitemap.xml hreflang: en-US - ae_ar: - source: /ae_ar/query-index.json - alternate: /ae_ar/{path}.html - destination: /ae_ar/sitemap.xml - hreflang: ar-AE - ae_en: - source: /ae_en/query-index.json - alternate: /ae_en/{path}.html - destination: /ae_en/sitemap.xml - hreflang: en-AE - africa: - source: /africa/query-index.json - alternate: /africa/{path}.html - destination: /africa/sitemap.xml - hreflang: - - en-BJ - - en-CM - - en-MA - - en-TG - - en-TN ar: source: /ar/query-index.json alternate: /ar/{path}.html @@ -46,11 +26,6 @@ sitemaps: alternate: /au/{path}.html destination: /au/sitemap.xml hreflang: en-AU - be_en: - source: /be_en/query-index.json - alternate: /be_en/{path}.html - destination: /be_en/sitemap.xml - hreflang: en-BE be_fr: source: /be_fr/query-index.json alternate: /be_fr/{path}.html @@ -61,26 +36,11 @@ sitemaps: alternate: /be_nl/{path}.html destination: /be_nl/sitemap.xml hreflang: nl-BE - bg: - source: /bg/query-index.json - alternate: /bg/{path}.html - destination: /bg/sitemap.xml - hreflang: bg-BG br: source: /br/query-index.json alternate: /br/{path}.html destination: /br/sitemap.xml hreflang: pt-BR - ca: - source: /ca/query-index.json - alternate: /ca/{path}.html - destination: /ca/sitemap.xml - hreflang: en-CA - ca_fr: - source: /ca_fr/query-index.json - alternate: /ca_fr/{path}.html - destination: /ca_fr/sitemap.xml - hreflang: fr-CA ch_de: source: /ch_de/query-index.json alternate: /ch_de/{path}.html @@ -111,71 +71,26 @@ sitemaps: alternate: /co/{path}.html destination: /co/sitemap.xml hreflang: es-CO - cz: - source: /cz/query-index.json - alternate: /cz/{path}.html - destination: /cz/sitemap.xml - hreflang: cs-CZ de: source: /de/query-index.json alternate: /de/{path}.html destination: /de/sitemap.xml hreflang: de-DE - dk: - source: /dk/query-index.json - alternate: /dk/{path}.html - destination: /dk/sitemap.xml - hreflang: da-DK - ee: - source: /ee/query-index.json - alternate: /ee/{path}.html - destination: /ee/sitemap.xml - hreflang: et-EE es: source: /es/query-index.json alternate: /es/{path}.html destination: /es/sitemap.xml hreflang: es-ES - fi: - source: /fi/query-index.json - alternate: /fi/{path}.html - destination: /fi/sitemap.xml - hreflang: fi-FI fr: source: /fr/query-index.json alternate: /fr/{path}.html destination: /fr/sitemap.xml hreflang: fr-FR - gr_en: - source: /gr_en/query-index.json - alternate: /gr_en/{path}.html - destination: /gr_en/sitemap.xml - hreflang: en-GR - hk_en: - source: /hk_en/query-index.json - alternate: /hk_en/{path}.html - destination: /hk_en/sitemap.xml - hreflang: en-HK hk_zh: source: /hk_zh/query-index.json alternate: /hk_zh/{path}.html destination: /hk_zh/sitemap.xml hreflang: zh-HK - hu: - source: /hu/query-index.json - alternate: /hu/{path}.html - destination: /hu/sitemap.xml - hreflang: hu-HU - id_en: - source: /id_en/query-index.json - alternate: /id_en/{path}.html - destination: /id_en/sitemap.xml - hreflang: en-ID - id_id: - source: /id_id/query-index.json - alternate: /id_id/{path}.html - destination: /id_id/sitemap.xml - hreflang: id-ID ie: source: /ie/query-index.json alternate: /ie/{path}.html @@ -186,11 +101,6 @@ sitemaps: alternate: /il_en/{path}.html destination: /il_en/sitemap.xml hreflang: en-IL - il_he: - source: /il_he/query-index.json - alternate: /il_he/{path}.html - destination: /il_he/sitemap.xml - hreflang: he in: source: /in/query-index.json alternate: /in/{path}.html @@ -216,81 +126,26 @@ sitemaps: alternate: /kr/{path}.html destination: /kr/sitemap.xml hreflang: ko-KR - la: - source: /la/query-index.json - alternate: /la/{path}.html - destination: /la/sitemap.xml - hreflang: - - es-PA - - es-SV - - es-VE - lt: - source: /lt/query-index.json - alternate: /lt/{path}.html - destination: /lt/sitemap.xml - hreflang: lt-LT lu_de: source: /lu_de/query-index.json alternate: /lu_de/{path}.html destination: /lu_de/sitemap.xml hreflang: de-LU - lu_en: - source: /lu_en/query-index.json - alternate: /lu_en/{path}.html - destination: /lu_en/sitemap.xml - hreflang: en-LU lu_fr: source: /lu_fr/query-index.json alternate: /lu_fr/{path}.html destination: /lu_fr/sitemap.xml hreflang: fr-LU - lv: - source: /lv/query-index.json - alternate: /lv/{path}.html - destination: /lv/sitemap.xml - hreflang: lv-LV - mena_ar: - source: /mena_ar/query-index.json - alternate: /mena_ar/{path}.html - destination: /mena_ar/sitemap.xml - hreflang: - - ar-IL - - ar-IQ - - ar-JO - - ar-LB - - ar-MA - - ar-OM - mena_en: - source: /mena_en/query-index.json - alternate: /mena_en/{path}.html - destination: /mena_en/sitemap.xml - hreflang: - - en-DZ mx: source: /mx/query-index.json alternate: /mx/{path}.html destination: /mx/sitemap.xml hreflang: es-MX - my_en: - source: /my_en/query-index.json - alternate: /my_en/{path}.html - destination: /my_en/sitemap.xml - hreflang: en-MY - my_ms: - source: /my_ms/query-index.json - alternate: /my_ms/{path}.html - destination: /my_ms/sitemap.xml - hreflang: ms-MY nl: source: /nl/query-index.json alternate: /nl/{path}.html destination: /nl/sitemap.xml hreflang: nl-NL - no: - source: /no/query-index.json - alternate: /no/{path}.html - destination: /no/sitemap.xml - hreflang: no-NO nz: source: /nz/query-index.json alternate: /nz/{path}.html @@ -301,46 +156,11 @@ sitemaps: alternate: /pe/{path}.html destination: /pe/sitemap.xml hreflang: es-PE - ph_en: - source: /ph_en/query-index.json - alternate: /ph_en/{path}.html - destination: /ph_en/sitemap.xml - hreflang: en-PH - ph_fil: - source: /ph_fil/query-index.json - alternate: /ph_fil/{path}.html - destination: /ph_fil/sitemap.xml - hreflang: fil-PH - pl: - source: /pl/query-index.json - alternate: /pl/{path}.html - destination: /pl/sitemap.xml - hreflang: pl-PL pt: source: /pt/query-index.json alternate: /pt/{path}.html destination: /pt/sitemap.xml hreflang: pt-PT - ro: - source: /ro/query-index.json - alternate: /ro/{path}.html - destination: /ro/sitemap.xml - hreflang: ro-RO - ru: - source: /ru/query-index.json - alternate: /ru/{path}.html - destination: /ru/sitemap.xml - hreflang: ru-RU - sa_ar: - source: /sa_ar/query-index.json - alternate: /sa_ar/{path}.html - destination: /sa_ar/sitemap.xml - hreflang: ar-SA - sa_en: - source: /sa_en/query-index.json - alternate: /sa_en/{path}.html - destination: /sa_en/sitemap.xml - hreflang: en-SA se: source: /se/query-index.json alternate: /se/{path}.html @@ -351,53 +171,18 @@ sitemaps: alternate: /sg/{path}.html destination: /sg/sitemap.xml hreflang: en-SG - si: - source: /si/query-index.json - alternate: /si/{path}.html - destination: /si/sitemap.xml - hreflang: sl-SI - sk: - source: /sk/query-index.json - alternate: /sk/{path}.html - destination: /sk/sitemap.xml - hreflang: sk-SK - th_en: - source: /th_en/query-index.json - alternate: /th_en/{path}.html - destination: /th_en/sitemap.xml - hreflang: en-TH th_th: source: /th_th/query-index.json alternate: /th_th/{path}.html destination: /th_th/sitemap.xml hreflang: th-TH - tr: - source: /tr/query-index.json - alternate: /tr/{path}.html - destination: /tr/sitemap.xml - hreflang: tr-TR tw: source: /tw/query-index.json alternate: /tw/{path}.html destination: /tw/sitemap.xml hreflang: zh-TW - ua: - source: /ua/query-index.json - alternate: /ua/{path}.html - destination: /ua/sitemap.xml - hreflang: uk-UA uk: source: /uk/query-index.json alternate: /uk/{path}.html destination: /uk/sitemap.xml hreflang: en-GB - vn_en: - source: /vn_en/query-index.json - alternate: /vn_en/{path}.html - destination: /vn_en/sitemap.xml - hreflang: en-VN - vn_vi: - source: /vn_vi/query-index.json - alternate: /vn_vi/{path}.html - destination: /vn_vi/sitemap.xml - hreflang: vi-VN From c6de0c3411d133629c5a2d0df01a1dfac2186594 Mon Sep 17 00:00:00 2001 From: Travis Tonsbeek <44540148+beekerr@users.noreply.github.com> Date: Thu, 9 May 2024 05:27:41 -0700 Subject: [PATCH 02/28] Delete sitemap-index.xml Remove unnecessary sitemap index --- sitemap-index.xml | 237 ---------------------------------------------- 1 file changed, 237 deletions(-) delete mode 100644 sitemap-index.xml diff --git a/sitemap-index.xml b/sitemap-index.xml deleted file mode 100644 index 4a9756a..0000000 --- a/sitemap-index.xml +++ /dev/null @@ -1,237 +0,0 @@ - - - - https://business.adobe.com/sitemap.xml - - - https://business.adobe.com/ae_ar/sitemap.xml - - - https://business.adobe.com/ae_en/sitemap.xml - - - https://business.adobe.com/africa/sitemap.xml - - - https://business.adobe.com/ar/sitemap.xml - - - https://business.adobe.com/at/sitemap.xml - - - https://business.adobe.com/au/sitemap.xml - - - https://business.adobe.com/be_en/sitemap.xml - - - https://business.adobe.com/be_fr/sitemap.xml - - - https://business.adobe.com/be_nl/sitemap.xml - - - https://business.adobe.com/bg/sitemap.xml - - - https://business.adobe.com/br/sitemap.xml - - - https://business.adobe.com/ca/sitemap.xml - - - https://business.adobe.com/ca_fr/sitemap.xml - - - https://business.adobe.com/ch_de/sitemap.xml - - - https://business.adobe.com/ch_fr/sitemap.xml - - - https://business.adobe.com/ch_it/sitemap.xml - - - https://business.adobe.com/cl/sitemap.xml - - - https://business.adobe.com/cn/sitemap.xml - - - https://business.adobe.com/co/sitemap.xml - - - https://business.adobe.com/cy_en/sitemap.xml - - - https://business.adobe.com/cz/sitemap.xml - - - https://business.adobe.com/de/sitemap.xml - - - https://business.adobe.com/dk/sitemap.xml - - - https://business.adobe.com/ee/sitemap.xml - - - https://business.adobe.com/es/sitemap.xml - - - https://business.adobe.com/fi/sitemap.xml - - - https://business.adobe.com/fr/sitemap.xml - - - https://business.adobe.com/gr_en/sitemap.xml - - - https://business.adobe.com/hk_en/sitemap.xml - - - https://business.adobe.com/hk_zh/sitemap.xml - - - https://business.adobe.com/hu/sitemap.xml - - - https://business.adobe.com/id_en/sitemap.xml - - - https://business.adobe.com/id_id/sitemap.xml - - - https://business.adobe.com/ie/sitemap.xml - - - https://business.adobe.com/il_en/sitemap.xml - - - https://business.adobe.com/il_he/sitemap.xml - - - https://business.adobe.com/in/sitemap.xml - - - https://business.adobe.com/in_hi/sitemap.xml - - - https://business.adobe.com/it/sitemap.xml - - - https://business.adobe.com/jp/sitemap.xml - - - https://business.adobe.com/kr/sitemap.xml - - - https://business.adobe.com/la/sitemap.xml - - - https://business.adobe.com/lt/sitemap.xml - - - https://business.adobe.com/lu_de/sitemap.xml - - - https://business.adobe.com/lu_en/sitemap.xml - - - https://business.adobe.com/lu_fr/sitemap.xml - - - https://business.adobe.com/lv/sitemap.xml - - - https://business.adobe.com/mena_ar/sitemap.xml - - - https://business.adobe.com/mena_en/sitemap.xml - - - https://business.adobe.com/mt/sitemap.xml - - - https://business.adobe.com/mx/sitemap.xml - - - https://business.adobe.com/my_en/sitemap.xml - - - https://business.adobe.com/my_ms/sitemap.xml - - - https://business.adobe.com/nl/sitemap.xml - - - https://business.adobe.com/no/sitemap.xml - - - https://business.adobe.com/nz/sitemap.xml - - - https://business.adobe.com/pe/sitemap.xml - - - https://business.adobe.com/ph_en/sitemap.xml - - - https://business.adobe.com/ph_fil/sitemap.xml - - - https://business.adobe.com/pl/sitemap.xml - - - https://business.adobe.com/pt/sitemap.xml - - - https://business.adobe.com/ro/sitemap.xml - - - https://business.adobe.com/ru/sitemap.xml - - - https://business.adobe.com/sa_ar/sitemap.xml - - - https://business.adobe.com/sa_en/sitemap.xml - - - https://business.adobe.com/se/sitemap.xml - - - https://business.adobe.com/sg/sitemap.xml - - - https://business.adobe.com/si/sitemap.xml - - - https://business.adobe.com/sk/sitemap.xml - - - https://business.adobe.com/th_en/sitemap.xml - - - https://business.adobe.com/th_th/sitemap.xml - - - https://business.adobe.com/tr/sitemap.xml - - - https://business.adobe.com/tw/sitemap.xml - - - https://business.adobe.com/ua/sitemap.xml - - - https://business.adobe.com/uk/sitemap.xml - - - https://business.adobe.com/vn_en/sitemap.xml - - - https://business.adobe.com/vn_vi/sitemap.xml - - From 4404a0b0581ba226f6935f588649ce201a369d61 Mon Sep 17 00:00:00 2001 From: Megan Thomas Date: Tue, 25 Jun 2024 17:23:25 -0700 Subject: [PATCH 03/28] MWPW-143579 Log 404s to lana --- scripts/scripts.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/scripts.js b/scripts/scripts.js index 86f384d..7896f67 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -199,4 +199,10 @@ const miloLibs = setLibs(LIBS); if (document.querySelector('.faas')) { loadStyle('/styles/faas.css'); } + const observer = new PerformanceObserver((list) => { + list.getEntries().forEach((entry) => { + if (entry.responseStatus === 404) window.lana?.log(`The resource ${entry.name} returned a 404 status.`, { tags: 'errorType=error,module=resource-404' }); + }); + }); + observer.observe({ type: 'resource', buffered: true }); }()); From c642703efae0310f07ea091e170c2c53ae6230ab Mon Sep 17 00:00:00 2001 From: Megan Thomas Date: Thu, 27 Jun 2024 15:31:26 -0700 Subject: [PATCH 04/28] MWPW-153603 Remove stage mapping (#218) --- scripts/scripts.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/scripts.js b/scripts/scripts.js index 86f384d..533c05d 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -120,15 +120,6 @@ const CONFIG = { geoRouting: 'on', productionDomain: 'business.adobe.com', prodDomains: ['business.adobe.com', 'www.adobe.com'], - stageDomainsMap: { - 'business.adobe.com': 'business.stage.adobe.com', - 'www.adobe.com': 'www.stage.adobe.com', - 'learning.adobe.com': 'learning.stage.adobe.com', - 'solutionpartners.adobe.com': 'solutionpartners.stage.adobe.com', - 'news.adobe.com': 'news.stage.adobe.com', - 'adobe.io': 'stage.adobe.io', - 'developer.adobe.com': 'developer-stage.adobe.com', - }, autoBlocks: [ { iframe: 'https://adobe-ideacloud.forgedx.com' }, { iframe: 'https://adobe.ideacloud.com' }, From 63be5fe9ccfff73ea73e951fcf15317051f4f963 Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Fri, 28 Jun 2024 12:39:13 -0700 Subject: [PATCH 05/28] MWPW-152082 Utils to Scripts --- blocks/comparison/comparison.js | 4 +- blocks/faas-decode/faas-decode.js | 4 +- .../redirects-formatter.js | 6 +-- blocks/stats/stats.js | 6 +-- blocks/tree-view/tree-view.js | 4 +- blocks/workfront-login/workfront-login.js | 6 +-- scripts/scripts.js | 19 +++++--- scripts/utils.js | 15 ------- templates/featured-story/featured-story.js | 4 +- test/blocks/comparison/comparison.test.js | 2 - test/blocks/faas-decode/faas-decode.test.js | 2 - .../redirects-formatter.test.js | 3 -- test/blocks/stats/stats.test.js | 3 -- test/blocks/tree-view/tree-view.test.js | 2 - test/blocks/workfront-login/workfront.test.js | 3 -- test/scripts/scripts.test.js | 36 +++++++++++++++ test/scripts/utils.test.js | 45 ------------------- 17 files changed, 65 insertions(+), 99 deletions(-) delete mode 100644 scripts/utils.js create mode 100644 test/scripts/scripts.test.js delete mode 100644 test/scripts/utils.test.js diff --git a/blocks/comparison/comparison.js b/blocks/comparison/comparison.js index 09ffa0b..78e220c 100644 --- a/blocks/comparison/comparison.js +++ b/blocks/comparison/comparison.js @@ -1,10 +1,10 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; /** * @param {Element} el */ const init = async (el) => { - const { createTag } = await import(`${getLibs()}/utils/utils.js`); + const { createTag } = await import(`${LIBS}/utils/utils.js`); const rows = Array.from(el.querySelectorAll(':scope > div')); const headers = Array.from(rows.shift().children); const headersRow = createTag('tr'); diff --git a/blocks/faas-decode/faas-decode.js b/blocks/faas-decode/faas-decode.js index f6976dc..0224600 100644 --- a/blocks/faas-decode/faas-decode.js +++ b/blocks/faas-decode/faas-decode.js @@ -1,7 +1,7 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; export default async function init(el) { - const { createTag, parseEncodedConfig } = await import(`${getLibs()}/utils/utils.js`); + const { createTag, parseEncodedConfig } = await import(`${LIBS}/utils/utils.js`); const url = el.querySelector('a')?.href; const resp = await fetch(url); diff --git a/blocks/redirects-formatter/redirects-formatter.js b/blocks/redirects-formatter/redirects-formatter.js index 700da63..f03288d 100644 --- a/blocks/redirects-formatter/redirects-formatter.js +++ b/blocks/redirects-formatter/redirects-formatter.js @@ -1,4 +1,4 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; export const SELECT_ALL_REGIONS = 'Select All Regions'; export const DESELECT_ALL_REGIONS = 'De-select All Regions'; @@ -12,7 +12,7 @@ const INSTRUCTIONS_TEXT = 'Select the locales you require by checking the checkb + ' press "Copy to clipboard" or select them with the cursor manually.'; async function createLocaleCheckboxes(prefixGroup) { - const { createTag } = await import(`${getLibs()}/utils/utils.js`); + const { createTag } = await import(`${LIBS}/utils/utils.js`); return Object.keys(prefixGroup).map((key) => { const { prefix } = prefixGroup[key]; @@ -87,7 +87,7 @@ export function stringifyListForExcel(urls) { } export default async function init(el) { - const { createTag } = await import(`${getLibs()}/utils/utils.js`); + const { createTag } = await import(`${LIBS}/utils/utils.js`); const xlPath = './locale-config.json'; const resp = await fetch(xlPath); if (!resp.ok) return; diff --git a/blocks/stats/stats.js b/blocks/stats/stats.js index 68055eb..84af4aa 100644 --- a/blocks/stats/stats.js +++ b/blocks/stats/stats.js @@ -1,4 +1,4 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; async function decorateRow(row, module) { const { decorateLinkAnalytics } = module; @@ -14,8 +14,8 @@ async function decorateRow(row, module) { } export default async function init(el) { - const { createTag } = await import(`${getLibs()}/utils/utils.js`); - const module = await import(`${getLibs()}/martech/attributes.js`); + const { createTag } = await import(`${LIBS}/utils/utils.js`); + const module = await import(`${LIBS}/martech/attributes.js`); module.decorateBlockAnalytics(el); const firstRow = el.querySelector(':scope > div'); diff --git a/blocks/tree-view/tree-view.js b/blocks/tree-view/tree-view.js index 771ac00..385cdb9 100644 --- a/blocks/tree-view/tree-view.js +++ b/blocks/tree-view/tree-view.js @@ -1,4 +1,4 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; const BACOM_HOSTS = ['localhost', '--bacom--adobecom.hlx.page', '--bacom--adobecom.hlx.live', 'business.adobe.com']; @@ -110,7 +110,7 @@ const init = async (el) => { if (!topList) return; - const { createTag } = await import(`${getLibs()}/utils/utils.js`); + const { createTag } = await import(`${LIBS}/utils/utils.js`); const subLists = topList.querySelectorAll('ul'); const isAccordion = subLists.length > 0; const links = el.querySelectorAll('a'); diff --git a/blocks/workfront-login/workfront-login.js b/blocks/workfront-login/workfront-login.js index 6c6d0c1..1b7ceda 100644 --- a/blocks/workfront-login/workfront-login.js +++ b/blocks/workfront-login/workfront-login.js @@ -1,4 +1,4 @@ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; export async function createProofForm(createTag, replaceKey, config) { const form = createTag('form', { action: 'https://app.proofhq.com/login', method: 'post' }); @@ -105,8 +105,8 @@ export async function createSubdomainForm(createTag, replaceKey, config) { /* c8 ignore next 14 */ export default async function init(el) { - const { createTag, getConfig } = await import(`${getLibs()}/utils/utils.js`); - const { replaceKey } = await import(`${getLibs()}/features/placeholders.js`); + const { createTag, getConfig } = await import(`${LIBS}/utils/utils.js`); + const { replaceKey } = await import(`${LIBS}/features/placeholders.js`); const config = getConfig(); const isProof = el.classList.contains('proof'); diff --git a/scripts/scripts.js b/scripts/scripts.js index 533c05d..9c9f1e0 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -1,6 +1,3 @@ -import { setLibs } from './utils.js'; - -const LIBS = '/libs'; const STYLES = ['/styles/styles.css']; const CONFIG = { imsClientId: 'bacom', @@ -157,10 +154,18 @@ const loadStyle = (path) => { eagerLoad(marquee.querySelector('img')); }()); -const miloLibs = setLibs(LIBS); +export function setLibs(location) { + const { hostname, search } = location; + if (!['.hlx.', '.stage.', 'local'].some((i) => hostname.includes(i))) return '/libs'; + const branch = new URLSearchParams(search).get('milolibs') || 'main'; + if (branch === 'local') return 'http://localhost:6456/libs'; + return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`; +} + +export const LIBS = setLibs(window.location); (function loadStyles() { - const paths = [`${miloLibs}/styles/styles.css`]; + const paths = [`${LIBS}/styles/styles.css`]; if (STYLES) { paths.push(...(Array.isArray(STYLES) ? STYLES : [STYLES])); } @@ -168,7 +173,7 @@ const miloLibs = setLibs(LIBS); }()); (async function loadPage() { - const { loadArea, loadLana, setConfig, createTag, getMetadata } = await import(`${miloLibs}/utils/utils.js`); + const { loadArea, loadLana, setConfig, createTag, getMetadata } = await import(`${LIBS}/utils/utils.js`); if (getMetadata('template') === '404') window.SAMPLE_PAGEVIEWS_AT_RATE = 'high'; const metaCta = document.querySelector('meta[name="chat-cta"]'); if (metaCta && !document.querySelector('.chat-cta')) { @@ -179,7 +184,7 @@ const miloLibs = setLibs(LIBS); if (lastSection) lastSection.insertAdjacentElement('beforeend', chatDiv); } } - setConfig({ ...CONFIG, miloLibs }); + setConfig({ ...CONFIG, miloLibs: LIBS }); loadLana({ clientId: 'bacom', tags: 'info' }); await loadArea(); diff --git a/scripts/utils.js b/scripts/utils.js deleted file mode 100644 index bd9f037..0000000 --- a/scripts/utils.js +++ /dev/null @@ -1,15 +0,0 @@ -export const [setLibs, getLibs] = (() => { - let libs; - return [ - (prodLibs, location) => { - libs = (() => { - const { hostname, search } = location || window.location; - if (!['.hlx.', '.stage.', 'local'].some((i) => hostname.includes(i))) return prodLibs; - const branch = new URLSearchParams(search).get('milolibs') || 'main'; - if (branch === 'local') return 'http://localhost:6456/libs'; - return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`; - })(); - return libs; - }, () => libs, - ]; -})(); diff --git a/templates/featured-story/featured-story.js b/templates/featured-story/featured-story.js index 5a6c596..6e463d0 100644 --- a/templates/featured-story/featured-story.js +++ b/templates/featured-story/featured-story.js @@ -2,9 +2,9 @@ Templates - featured story */ -import { getLibs } from '../../scripts/utils.js'; +import { LIBS } from '../../scripts/scripts.js'; -const { createTag } = await import(`${getLibs()}/utils/utils.js`); +const { createTag } = await import(`${LIBS}/utils/utils.js`); function init() { const i = 1; diff --git a/test/blocks/comparison/comparison.test.js b/test/blocks/comparison/comparison.test.js index a19a25f..40771e9 100644 --- a/test/blocks/comparison/comparison.test.js +++ b/test/blocks/comparison/comparison.test.js @@ -1,9 +1,7 @@ import { readFile } from '@web/test-runner-commands'; import { expect } from '@esm-bundle/chai'; import init from '../../../blocks/comparison/comparison.js'; -import { setLibs } from '../../../scripts/utils.js'; -setLibs('/libs'); document.body.innerHTML = await readFile({ path: './mocks/body.html' }); describe('Comparison Table', () => { it('Verify Comparison Table Exists', async () => { diff --git a/test/blocks/faas-decode/faas-decode.test.js b/test/blocks/faas-decode/faas-decode.test.js index e643aff..7d31a01 100644 --- a/test/blocks/faas-decode/faas-decode.test.js +++ b/test/blocks/faas-decode/faas-decode.test.js @@ -1,7 +1,6 @@ import { expect } from '@esm-bundle/chai'; import sinon from 'sinon'; import init from '../../../blocks/faas-decode/faas-decode.js'; -import { setLibs } from '../../../scripts/utils.js'; import waitForElement from '../../helpers/waitForElement.js'; window.lana = { log: () => {} }; @@ -9,7 +8,6 @@ window.lana = { log: () => {} }; describe('FaaS Decode', () => { before(() => { sinon.stub(window.lana, 'log'); - setLibs('/libs'); }); after(() => { diff --git a/test/blocks/redirects-formatter/redirects-formatter.test.js b/test/blocks/redirects-formatter/redirects-formatter.test.js index 9077128..ac9002a 100644 --- a/test/blocks/redirects-formatter/redirects-formatter.test.js +++ b/test/blocks/redirects-formatter/redirects-formatter.test.js @@ -1,7 +1,6 @@ import { readFile } from '@web/test-runner-commands'; import { expect } from '@esm-bundle/chai'; import sinon from 'sinon'; -import { setLibs } from '../../../scripts/utils.js'; const { default: init, @@ -14,8 +13,6 @@ const { } = await import('../../../blocks/redirects-formatter/redirects-formatter.js'); const { htmlIncluded, htmlExcluded, externalUrls, mixedSpaceTabUrls } = await import('./mocks/textAreaValues.js'); -setLibs('libs'); - describe('Redirects Formatter', () => { const ogFetch = window.fetch; diff --git a/test/blocks/stats/stats.test.js b/test/blocks/stats/stats.test.js index 0179ce3..9905012 100644 --- a/test/blocks/stats/stats.test.js +++ b/test/blocks/stats/stats.test.js @@ -1,10 +1,7 @@ import { expect } from '@esm-bundle/chai'; -import { setLibs } from '../../../scripts/utils.js'; const { default: init } = await import('../../../blocks/stats/stats.js'); -setLibs('libs'); - describe('Stats', () => { it('Allows intro', async () => { document.body.innerHTML = '
Intro
Stat 1
Stat 2
'; diff --git a/test/blocks/tree-view/tree-view.test.js b/test/blocks/tree-view/tree-view.test.js index 428284a..bd3abfe 100644 --- a/test/blocks/tree-view/tree-view.test.js +++ b/test/blocks/tree-view/tree-view.test.js @@ -1,12 +1,10 @@ import { readFile } from '@web/test-runner-commands'; import { expect } from '@esm-bundle/chai'; import sinon from 'sinon'; -import { setLibs } from '../../../scripts/utils.js'; const { default: init, isCurrentPage } = await import('../../../blocks/tree-view/tree-view.js'); window.lana = { log: () => {} }; -setLibs('libs'); describe('Tree View', () => { describe('simple', () => { diff --git a/test/blocks/workfront-login/workfront.test.js b/test/blocks/workfront-login/workfront.test.js index 25f5ef5..11511b5 100644 --- a/test/blocks/workfront-login/workfront.test.js +++ b/test/blocks/workfront-login/workfront.test.js @@ -1,12 +1,9 @@ import { expect } from '@esm-bundle/chai'; import sinon from 'sinon'; import waitForElement from '../../helpers/waitForElement.js'; -import { setLibs } from '../../../scripts/utils.js'; import { createTag, replaceKey, getConfig } from './mocks/workfront-utils.js'; import { createSubdomainForm, createProofForm, location } from '../../../blocks/workfront-login/workfront-login.js'; -setLibs('libs'); - const config = getConfig(); const delay = (timeOut, cb) => new Promise((resolve) => { diff --git a/test/scripts/scripts.test.js b/test/scripts/scripts.test.js new file mode 100644 index 0000000..3c75c51 --- /dev/null +++ b/test/scripts/scripts.test.js @@ -0,0 +1,36 @@ +import { expect } from '@esm-bundle/chai'; +import { setLibs, LIBS } from '../../scripts/scripts.js'; + +describe('Libs', () => { + const tests = [ + ['https://business.adobe.com', '/libs'], + ['https://business.adobe.com?milolibs=foo', '/libs'], + ['https://business.stage.adobe.com', 'https://main--milo--adobecom.hlx.live/libs'], + ['https://business.stage.adobe.com?milolibs=foo', 'https://foo--milo--adobecom.hlx.live/libs'], + ['https://business.stage.adobe.com?milolibs=awesome--milo--forkedowner', 'https://awesome--milo--forkedowner.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.page/', 'https://main--milo--adobecom.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.page/?milolibs=foo', 'https://foo--milo--adobecom.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.page/?milolibs=local', 'http://localhost:6456/libs'], + ['https://main--bacom--adobecom.hlx.page/?milolibs=awesome--milo--forkedowner', 'https://awesome--milo--forkedowner.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.live/', 'https://main--milo--adobecom.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.live/?milolibs=foo', 'https://foo--milo--adobecom.hlx.live/libs'], + ['https://main--bacom--adobecom.hlx.live/?milolibs=local', 'http://localhost:6456/libs'], + ['https://main--bacom--adobecom.hlx.live/?milolibs=awesome--milo--forkedowner', 'https://awesome--milo--forkedowner.hlx.live/libs'], + ['http://localhost:3000', 'https://main--milo--adobecom.hlx.live/libs'], + ['http://localhost:3000?milolibs=foo', 'https://foo--milo--adobecom.hlx.live/libs'], + ['http://localhost:3000?milolibs=local', 'http://localhost:6456/libs'], + ['http://localhost:3000?milolibs=awesome--milo--forkedowner', 'https://awesome--milo--forkedowner.hlx.live/libs'], + ]; + + tests.forEach(([url, expected]) => { + it(`Sets libs for ${url}`, () => { + const location = new URL(url); + const libs = setLibs(location); + expect(libs).to.equal(expected); + }); + }); + + it('Sets LIBS', () => { + expect(LIBS).to.equal('https://main--milo--adobecom.hlx.live/libs'); + }); +}); diff --git a/test/scripts/utils.test.js b/test/scripts/utils.test.js deleted file mode 100644 index eb6cd39..0000000 --- a/test/scripts/utils.test.js +++ /dev/null @@ -1,45 +0,0 @@ -import { expect } from '@esm-bundle/chai'; -import { setLibs } from '../../scripts/utils.js'; - -describe('Libs', () => { - it('Sets default Libs', () => { - const libs = setLibs('/libs'); - expect(libs).to.equal('https://main--milo--adobecom.hlx.live/libs'); - }); - - it('Does not support milolibs query param on prod', () => { - const location = { - hostname: 'business.adobe.com', - search: '?milolibs=foo', - }; - const libs = setLibs('/libs', location); - expect(libs).to.equal('/libs'); - }); - - it('Supports milolibs query param', () => { - const location = { - hostname: 'localhost', - search: '?milolibs=foo', - }; - const libs = setLibs('/libs', location); - expect(libs).to.equal('https://foo--milo--adobecom.hlx.live/libs'); - }); - - it('Supports local milolibs query param', () => { - const location = { - hostname: 'localhost', - search: '?milolibs=local', - }; - const libs = setLibs('/libs', location); - expect(libs).to.equal('http://localhost:6456/libs'); - }); - - it('Supports forked milolibs query param', () => { - const location = { - hostname: 'localhost', - search: '?milolibs=awesome--milo--forkedowner', - }; - const libs = setLibs('/libs', location); - expect(libs).to.equal('https://awesome--milo--forkedowner.hlx.live/libs'); - }); -}); From 67c8a4a16a767d488e838b21562ea807e69c5a85 Mon Sep 17 00:00:00 2001 From: Travis Tonsbeek <44540148+beekerr@users.noreply.github.com> Date: Tue, 9 Jul 2024 08:48:52 -0700 Subject: [PATCH 06/28] Update helix-sitemap.yaml to correct IN language code --- helix-sitemap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-sitemap.yaml b/helix-sitemap.yaml index 659c964..9e262bc 100644 --- a/helix-sitemap.yaml +++ b/helix-sitemap.yaml @@ -105,7 +105,7 @@ sitemaps: source: /in/query-index.json alternate: /in/{path}.html destination: /in/sitemap.xml - hreflang: en-GB + hreflang: en-IN in_hi: source: /in_hi/query-index.json alternate: /in_hi/{path}.html From 627cdeafc2721c651be5e72328a95d3fc05eed5e Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Thu, 18 Jul 2024 14:48:59 -0700 Subject: [PATCH 07/28] MWPW-154562 Fix resource form margins (#224) --- styles/styles.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/styles/styles.css b/styles/styles.css index 1dc4820..f8339b8 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -77,6 +77,11 @@ main .section.five-up { padding-right: var(--grid-margins-width); } +main .resource-form.section.two-up .marketo { + margin-left: calc(var(--grid-margins-width) * -1); + margin-right: calc(var(--grid-margins-width) * -1); +} + @media screen and (min-width: 1200px) { main .section.grid-width-10 { padding-left: var(--grid-margins-width-10); @@ -93,3 +98,10 @@ main .section.five-up { padding-right: var(--grid-margins-width-6); } } + +@media screen and (min-width: 600px) { + main .resource-form.section.two-up .marketo { + margin-left: 0; + margin-right: 0; + } +} From 98c536a39e5e300c62ca6ee85679163b2833d214 Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Thu, 11 Jul 2024 14:24:54 -0700 Subject: [PATCH 08/28] MWPW-154250 Update India lang code --- scripts/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/scripts.js b/scripts/scripts.js index 9c9f1e0..abfeebd 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -65,7 +65,7 @@ const CONFIG = { il_en: { ietf: 'en-IL', tk: 'hah7vzn.css' }, il_he: { ietf: 'he', tk: 'qxw8hzm.css', dir: 'rtl' }, in_hi: { ietf: 'hi', tk: 'qxw8hzm.css' }, - in: { ietf: 'en-GB', tk: 'hah7vzn.css' }, + in: { ietf: 'en-IN', tk: 'hah7vzn.css' }, it: { ietf: 'it-IT', tk: 'hah7vzn.css' }, jp: { ietf: 'ja-JP', tk: 'dvg6awq' }, kr: { ietf: 'ko-KR', tk: 'qjs5sfm' }, From 2d37374e9146e50ed6dfdd53094e9a4c0027429e Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Mon, 22 Jul 2024 09:45:51 -0700 Subject: [PATCH 09/28] Revert "MWPW-154562 Fix resource form margins (#224)" This reverts commit 627cdeafc2721c651be5e72328a95d3fc05eed5e. --- styles/styles.css | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/styles/styles.css b/styles/styles.css index f8339b8..1dc4820 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -77,11 +77,6 @@ main .section.five-up { padding-right: var(--grid-margins-width); } -main .resource-form.section.two-up .marketo { - margin-left: calc(var(--grid-margins-width) * -1); - margin-right: calc(var(--grid-margins-width) * -1); -} - @media screen and (min-width: 1200px) { main .section.grid-width-10 { padding-left: var(--grid-margins-width-10); @@ -98,10 +93,3 @@ main .resource-form.section.two-up .marketo { padding-right: var(--grid-margins-width-6); } } - -@media screen and (min-width: 600px) { - main .resource-form.section.two-up .marketo { - margin-left: 0; - margin-right: 0; - } -} From 40b8a33d42f89548b60d9ae36bcd09a232bc34c6 Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Fri, 26 Jul 2024 09:13:06 -0700 Subject: [PATCH 10/28] MWPW-145389 Push sync for floodgate and graybox (#228) --- .github/workflows/fg-sync-repos.yml | 27 +++++++++++++++-------- .github/workflows/graybox-sync-repos.yml | 28 ++++++++++++++++-------- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/.github/workflows/fg-sync-repos.yml b/.github/workflows/fg-sync-repos.yml index 0d0aa2b..2740183 100644 --- a/.github/workflows/fg-sync-repos.yml +++ b/.github/workflows/fg-sync-repos.yml @@ -1,6 +1,10 @@ name: Floodgate Repo Sync on: + push: + branches: + - stage + - main workflow_dispatch: inputs: syncBranch: @@ -28,7 +32,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v3 with: - ref: ${{ inputs.syncBranch }} + ref: ${{ inputs.syncBranch || github.ref_name }} - name: Clone Floodgate Repository and Checkout Selected Branch run: | @@ -41,7 +45,7 @@ jobs: echo "bacom branch" git branch env: - FG_SYNC_BRANCH: ${{ inputs.syncBranch }} + FG_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }} - name: Overwrite floodgate repo files with latest from source repo run: | @@ -54,14 +58,19 @@ jobs: git branch git config user.email "$FG_SYNC_BOT_EMAIL" git config user.name "$FG_SYNC_BOT_NAME" - git status - git remote set-url origin https://oauth2:$GITHUB_TOKEN@github.com/adobecom/bacom-pink.git - git remote -v - git add . - git commit -m "Syncing bacom to bacom-pink" - git push origin $FG_SYNC_BRANCH --force + git status + if [[ -n $(git status -s) ]]; then + git remote set-url origin https://oauth2:$GITHUB_TOKEN@github.com/adobecom/bacom-pink.git + git remote -v + git add . + git commit -m "Syncing bacom to bacom-pink" + git push origin $FG_SYNC_BRANCH --force + echo ":heavy_check_mark: Syncing branch $GB_SYNC_BRANCH on bacom to bacom-pink completed successfully." >> $GITHUB_STEP_SUMMARY + else + echo ":heavy_minus_sign: No changes detected on branch $GB_SYNC_BRANCH, nothing to sync." >> $GITHUB_STEP_SUMMARY + fi env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }} FG_SYNC_BOT_NAME: ${{ secrets.FG_SYNC_BOT_NAME }} - FG_SYNC_BRANCH: ${{ inputs.syncBranch }} + FG_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }} diff --git a/.github/workflows/graybox-sync-repos.yml b/.github/workflows/graybox-sync-repos.yml index 2717534..6df44fe 100644 --- a/.github/workflows/graybox-sync-repos.yml +++ b/.github/workflows/graybox-sync-repos.yml @@ -1,6 +1,10 @@ name: Graybox Repo Sync on: + push: + branches: + - stage + - main workflow_dispatch: inputs: syncBranch: @@ -10,6 +14,7 @@ on: type: choice options: - 'stage' + - 'main' jobs: build: @@ -28,7 +33,7 @@ jobs: uses: actions/checkout@v2 with: persist-credentials: false - ref: ${{ inputs.syncBranch }} + ref: ${{ inputs.syncBranch || github.ref_name }} - name: Clone Graybox Repository and Checkout Stage Branch run: | @@ -41,7 +46,7 @@ jobs: echo "bacom branch" git branch env: - GB_SYNC_BRANCH: ${{ inputs.syncBranch }} + GB_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }} - name: Overwrite graybox repo files with latest from source repo run: | @@ -54,13 +59,18 @@ jobs: git branch git config user.email "$FG_SYNC_BOT_EMAIL" git config user.name "milo-repo-sync[bot]" - git status - git remote set-url origin https://oauth2:$GITHUB_TOKEN@github.com/adobecom/bacom-graybox.git - git remote -v - git add . - git commit -m "Syncing bacom to bacom-graybox" - git push origin $GB_SYNC_BRANCH --force + git status + if [[ -n $(git status -s) ]]; then + git remote set-url origin https://oauth2:$GITHUB_TOKEN@github.com/adobecom/bacom-graybox.git + git remote -v + git add . + git commit -m "Syncing bacom to bacom-graybox" + git push origin $GB_SYNC_BRANCH --force + echo ":heavy_check_mark: Syncing branch $GB_SYNC_BRANCH on bacom to bacom-graybox completed successfully." >> $GITHUB_STEP_SUMMARY + else + echo ":heavy_minus_sign: No changes detected on branch $GB_SYNC_BRANCH, nothing to sync." >> $GITHUB_STEP_SUMMARY + fi env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} FG_SYNC_BOT_EMAIL: ${{ secrets.FG_SYNC_BOT_EMAIL }} - GB_SYNC_BRANCH: ${{ inputs.syncBranch }} + GB_SYNC_BRANCH: ${{ inputs.syncBranch || github.ref_name }} From a1656968421cf426f8ba3db807ecb03a96e75066 Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Tue, 30 Jul 2024 09:48:22 -0700 Subject: [PATCH 11/28] MWPW-145389 Push sync for floodgate and graybox (#230) --- .github/workflows/fg-sync-repos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fg-sync-repos.yml b/.github/workflows/fg-sync-repos.yml index 2740183..8b83b49 100644 --- a/.github/workflows/fg-sync-repos.yml +++ b/.github/workflows/fg-sync-repos.yml @@ -65,9 +65,9 @@ jobs: git add . git commit -m "Syncing bacom to bacom-pink" git push origin $FG_SYNC_BRANCH --force - echo ":heavy_check_mark: Syncing branch $GB_SYNC_BRANCH on bacom to bacom-pink completed successfully." >> $GITHUB_STEP_SUMMARY + echo ":heavy_check_mark: Syncing branch $FG_SYNC_BRANCH on bacom to bacom-pink completed successfully." >> $GITHUB_STEP_SUMMARY else - echo ":heavy_minus_sign: No changes detected on branch $GB_SYNC_BRANCH, nothing to sync." >> $GITHUB_STEP_SUMMARY + echo ":heavy_minus_sign: No changes detected on branch $FG_SYNC_BRANCH, nothing to sync." >> $GITHUB_STEP_SUMMARY fi env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} From 5398c4213bf2076ba2e07d6e88fe88d741f97d65 Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Mon, 5 Aug 2024 09:24:48 -0700 Subject: [PATCH 12/28] Adding daily e2e workflow. --- .github/workflows/run-e2e-daily.yaml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/run-e2e-daily.yaml diff --git a/.github/workflows/run-e2e-daily.yaml b/.github/workflows/run-e2e-daily.yaml new file mode 100644 index 0000000..2ab3637 --- /dev/null +++ b/.github/workflows/run-e2e-daily.yaml @@ -0,0 +1,33 @@ +name: Bacom E2E Daily Run + +on: + workflow_dispatch: + schedule: + - cron: '0 16 * * *' + +jobs: + platform_matrix: + strategy: + fail-fast: false + matrix: + os: [macos-latest] + name: Running tests on Browserstack + runs-on: ${{ matrix.os }} + env: + WORKFLOW_NAME: 'Bacom E2E Nala Daily Run' + DAILY_RUN: 'true' + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Run Nala ${{ matrix.os }} + run: bash runOnBrowserstack.sh bacom @e2e + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} From 218d0894feee107b04b2e52052f0fc622f01daa7 Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Mon, 5 Aug 2024 17:15:53 -0700 Subject: [PATCH 13/28] Added check out nala step --- .github/workflows/run-e2e-daily.yaml | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/run-e2e-daily.yaml diff --git a/.github/workflows/run-e2e-daily.yaml b/.github/workflows/run-e2e-daily.yaml new file mode 100644 index 0000000..633ae1b --- /dev/null +++ b/.github/workflows/run-e2e-daily.yaml @@ -0,0 +1,35 @@ +name: Bacom E2E Daily Run + +on: + workflow_dispatch: + schedule: + - cron: '0 16 * * *' + +jobs: + platform_matrix: + strategy: + fail-fast: false + matrix: + os: [macos-latest] + name: Running tests on Browserstack + runs-on: ${{ matrix.os }} + env: + WORKFLOW_NAME: 'Bacom E2E Nala Daily Run' + DAILY_RUN: 'true' + + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + repository: adobecom/nala@main + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Run Nala ${{ matrix.os }} + run: bash runOnBrowserstack.sh bacom @e2e + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} From 34f03e8cefb7f0fac15d76bddc1441668f36aa60 Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Tue, 6 Aug 2024 09:31:48 -0700 Subject: [PATCH 14/28] Fixed nala checkout. --- .github/workflows/run-e2e-daily.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-e2e-daily.yaml b/.github/workflows/run-e2e-daily.yaml index 633ae1b..fe4b98b 100644 --- a/.github/workflows/run-e2e-daily.yaml +++ b/.github/workflows/run-e2e-daily.yaml @@ -21,7 +21,8 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - repository: adobecom/nala@main + repository: adobecom/nala + ref: main - name: Set up Node.js uses: actions/setup-node@v3 From 27c30288bf92907e8c4816e2abe1391b6352e3af Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Tue, 6 Aug 2024 15:51:02 -0700 Subject: [PATCH 15/28] Updating the runner to ubuntu. --- .github/workflows/run-e2e-daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-e2e-daily.yaml b/.github/workflows/run-e2e-daily.yaml index fe4b98b..10251fa 100644 --- a/.github/workflows/run-e2e-daily.yaml +++ b/.github/workflows/run-e2e-daily.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest] + os: [ubuntu-latest] name: Running tests on Browserstack runs-on: ${{ matrix.os }} env: From 6a46c951bce275f7cdc3df6b053039d38fe2e493 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Mon, 26 Aug 2024 13:59:48 -0700 Subject: [PATCH 16/28] prefetch test --- head.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/head.html b/head.html index e1fb9ec..84fdf17 100644 --- a/head.html +++ b/head.html @@ -1,4 +1,16 @@ - + + + From 8c1629fee24df7c584b3f69899d050dbbe1cfdfc Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Mon, 26 Aug 2024 14:19:49 -0700 Subject: [PATCH 17/28] Added everything prefectch besides scripts/scripts, need to see how it does --- head.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/head.html b/head.html index 84fdf17..594e50b 100644 --- a/head.html +++ b/head.html @@ -1,5 +1,8 @@ - + + + + - + From dd0c6b554e57ed4a47019d8cfc3e09593b7a84d6 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Mon, 26 Aug 2024 14:23:31 -0700 Subject: [PATCH 18/28] test --- head.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/head.html b/head.html index 594e50b..7ee2e81 100644 --- a/head.html +++ b/head.html @@ -18,7 +18,8 @@ const miloUtils = document.querySelector('#milo-utils'); miloUtils.setAttribute('href', `${libs}/utils/utils.js`); const miloDecorate = document.querySelector('#milo-decorate'); - miloDecorate.setAttribute('href', `${libs}/utils/decorate.js`)'' + miloDecorate.setAttribute('href', `${libs}/utils/decorate.js`); + console.log(miloStyles, miloDecorate, miloUtils) From fbed148e35a2426d727115616c5a55884978d669 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Mon, 26 Aug 2024 14:27:38 -0700 Subject: [PATCH 19/28] Adding crossorigin --- head.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/head.html b/head.html index 7ee2e81..cda37e2 100644 --- a/head.html +++ b/head.html @@ -1,8 +1,8 @@ - - + + From 48fd42357fe6814a4ea461ef7115de209e86d687 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Wed, 4 Sep 2024 09:08:45 -0700 Subject: [PATCH 21/28] Testing postbody --- scripts/aa-university.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/aa-university.js b/scripts/aa-university.js index 85488df..da3f7a7 100644 --- a/scripts/aa-university.js +++ b/scripts/aa-university.js @@ -3,16 +3,21 @@ export default function registerAAUniversity() { const lastName = document.querySelector('input[name="LastName"]'); const email = document.querySelector('input[name="Email"]'); const country = document.querySelector('select[name="Country"]'); + const group = document.querySelector('meta[name="sandboxGroup"]'); + + const postBody = { + first_name: firstName?.value, + last_name: lastName?.value, + email: email?.value, + university: 'none', + country: country?.value, + }; + + if (group) postBody.group = group.content; fetch('https://us-central1-adobe---aa-university.cloudfunctions.net/register', { method: 'POST', - body: JSON.stringify({ - first_name: firstName?.value, - last_name: lastName?.value, - email: email?.value, - university: 'none', - country: country?.value, - }), + body: JSON.stringify(postBody), }) .catch((error) => window.lana.log(`Marketo AA University Error: ${error}`)); } From 4b4e70c2da41700191c1f3f50961ac96941c02fc Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Thu, 5 Sep 2024 09:13:28 -0700 Subject: [PATCH 22/28] Adding the ability to have a group param added to the sandbox POST request. There is a default, so we do not want to send anything if we do not find the metadata --- scripts/aa-university.js | 4 +++- test/scripts/aa-university.test.js | 16 ++++++++++++++++ test/scripts/mocks/with-group.html | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/scripts/mocks/with-group.html diff --git a/scripts/aa-university.js b/scripts/aa-university.js index da3f7a7..1706691 100644 --- a/scripts/aa-university.js +++ b/scripts/aa-university.js @@ -3,7 +3,7 @@ export default function registerAAUniversity() { const lastName = document.querySelector('input[name="LastName"]'); const email = document.querySelector('input[name="Email"]'); const country = document.querySelector('select[name="Country"]'); - const group = document.querySelector('meta[name="sandboxGroup"]'); + const group = document.querySelector('meta[name="sandboxgroup"]'); const postBody = { first_name: firstName?.value, @@ -20,4 +20,6 @@ export default function registerAAUniversity() { body: JSON.stringify(postBody), }) .catch((error) => window.lana.log(`Marketo AA University Error: ${error}`)); + + return postBody; } diff --git a/test/scripts/aa-university.test.js b/test/scripts/aa-university.test.js index 976ab04..272d82e 100644 --- a/test/scripts/aa-university.test.js +++ b/test/scripts/aa-university.test.js @@ -29,4 +29,20 @@ describe('AA University', async () => { window.fetch = ogFetch; window.lana = ogLana; }); + + it('Sends the group parameter with POST if found', () => { + const meta = document.createElement('meta'); + meta.setAttribute('name', 'sandboxgroup'); + meta.setAttribute('content', 'group'); + document.body.prepend(meta); + const body = registerAAUniversity(); + expect(body.group).to.equal('group'); + + document.querySelector('meta').remove(); + }); + + it('Does not send the group parameter with POST if not found', () => { + const body = registerAAUniversity(); + expect(body.group).to.be.undefined; + }); }); diff --git a/test/scripts/mocks/with-group.html b/test/scripts/mocks/with-group.html new file mode 100644 index 0000000..3ec0f17 --- /dev/null +++ b/test/scripts/mocks/with-group.html @@ -0,0 +1,8 @@ + +Jane +Doe +janedoe@email.com + From 014b4dd469b54bea1477e5542d19ef201b71db55 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Thu, 5 Sep 2024 09:20:28 -0700 Subject: [PATCH 23/28] Removing file not needed --- test/scripts/mocks/with-group.html | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 test/scripts/mocks/with-group.html diff --git a/test/scripts/mocks/with-group.html b/test/scripts/mocks/with-group.html deleted file mode 100644 index 3ec0f17..0000000 --- a/test/scripts/mocks/with-group.html +++ /dev/null @@ -1,8 +0,0 @@ - -Jane -Doe -janedoe@email.com - From 5aff88af7b82614cac631c5a96e5a909892b2ad3 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Fri, 6 Sep 2024 09:18:18 -0700 Subject: [PATCH 24/28] Testing for CR --- head.html | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/head.html b/head.html index 8b58588..cd83520 100644 --- a/head.html +++ b/head.html @@ -1,8 +1,8 @@ - - - - + + + From 60ce02927835732db86454a92dddb59a3bdd2ff6 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Fri, 6 Sep 2024 09:21:33 -0700 Subject: [PATCH 25/28] Testing --- head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/head.html b/head.html index cd83520..5545867 100644 --- a/head.html +++ b/head.html @@ -28,7 +28,7 @@ miloUtils.setAttribute('href', `${libs}/utils/utils.js`); miloDecorate.setAttribute('href', `${libs}/utils/decorate.js`); - document.querySelector('[href="/styles/styles.css"]').after(miloStyles, miloUtils, miloDecorate); + document.head.append(miloStyles, miloUtils, miloDecorate); // document.querySelector('#milo-stylesheet').setAttribute('href', `${libs}/styles/styles.css`); // document.querySelector('#milo-utils').setAttribute('href', `${libs}/utils/utils.js`); // document.querySelector('#milo-decorate').setAttribute('href', `${libs}/utils/decorate.js`); From a4fd40a3ff61380b217588091bd3171dcce815a4 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Fri, 6 Sep 2024 09:23:37 -0700 Subject: [PATCH 26/28] Again --- head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/head.html b/head.html index 5545867..27308b7 100644 --- a/head.html +++ b/head.html @@ -21,7 +21,7 @@ miloStyles.setAttribute('href', `${libs}/styles/styles.css`); [miloUtils, miloDecorate].forEach((tag) => { - tag.setAttribute('crossorigin'); + tag.setAttribute('crossorigin', 'true'); tag.setAttribute('as', 'script'); }) From 74c9a11eef2ee780bdb64b6eb62ba298fcde4382 Mon Sep 17 00:00:00 2001 From: Jason Slavin Date: Fri, 6 Sep 2024 09:25:58 -0700 Subject: [PATCH 27/28] working as expected --- head.html | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/head.html b/head.html index 27308b7..89f84b8 100644 --- a/head.html +++ b/head.html @@ -1,8 +1,5 @@ - - From 968cb7a590e4d6522eb98ddac26e6194ff492e00 Mon Sep 17 00:00:00 2001 From: Brandon Marshall Date: Mon, 16 Sep 2024 15:07:06 -0700 Subject: [PATCH 28/28] MWPW-158345 Index CaaS URLs (#246) --- helix-query.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/helix-query.yaml b/helix-query.yaml index 3db6545..5579faa 100644 --- a/helix-query.yaml +++ b/helix-query.yaml @@ -33,6 +33,14 @@ indices: select: head > meta[name="publishdate"] value: | attribute(el, 'content') + caas-url: + select: .columns div div a[href*="/tools/caas"], .text div div a[href*="/tools/caas"] + value: | + attribute(el, 'href') + marketo-url: + select: .marketo div div a[href*="/tools/marketo"] + value: | + attribute(el, 'href') sitemap-ae_ar: include: - '/ae_ar/' @@ -1742,6 +1750,6 @@ indices: properties: <<: *defaultProps faas-url: - select: .columns div div a, .text div div a + select: .columns div div a[href*="/tools/faas"], .text div div a[href*="/tools/faas"] value: | attribute(el, 'href')