From dc72e5855e40ed3050b92e2445748b235140b4a5 Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 2 Sep 2024 11:39:50 +0200 Subject: [PATCH 1/4] Fix urls --- pages/sitemap.xml.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pages/sitemap.xml.tsx b/pages/sitemap.xml.tsx index 8ee79cea..91798580 100644 --- a/pages/sitemap.xml.tsx +++ b/pages/sitemap.xml.tsx @@ -10,10 +10,10 @@ async function generateSiteMap({ locales }: any) { https://bloom.chayn.co - https://bloom.chayn.co/therapy/about-our-courses + https://bloom.chayn.co/about-our-courses - https://bloom.chayn.co/therapy/meet-the-team + https://bloom.chayn.co/meet-the-team https://bloom.chayn.co/therapy/book-session @@ -22,10 +22,11 @@ async function generateSiteMap({ locales }: any) { https://bloom.chayn.co/therapy/confirmed-session ${courses - .map((course: any) => { + .map((course: { locale: string; params: { slug: string; sessionSlug: string } }) => { + const locale = course.locale !== 'en' ? `/${course.locale}` : ''; return ` - ${`https://bloom.chayn.co/courses/${course.params.slug}/${course.params.sessionSlug}`} + ${`https://bloom.chayn.co${locale}/courses/${course.params.slug}/${course.params.sessionSlug}`} `; }) From 0d18d4c79c936c06be50deabb3a6bdf543678f6f Mon Sep 17 00:00:00 2001 From: Boodland Date: Mon, 2 Sep 2024 11:40:09 +0200 Subject: [PATCH 2/4] Create sitemap e2e tests --- cypress/integration/tests/sitemap.cy.tsx | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cypress/integration/tests/sitemap.cy.tsx diff --git a/cypress/integration/tests/sitemap.cy.tsx b/cypress/integration/tests/sitemap.cy.tsx new file mode 100644 index 00000000..8abc238c --- /dev/null +++ b/cypress/integration/tests/sitemap.cy.tsx @@ -0,0 +1,39 @@ +describe('Sitemap should have', () => { + const SITEMAP_URL = '/sitemap.xml'; + const BLOOM_URL = 'https://bloom.chayn.co'; + before(() => { + cy.cleanUpTestState(); + }); + + it('bloom url', () => { + cy.request(SITEMAP_URL).its('body').should('include', BLOOM_URL); + }); + it('about our courses url', () => { + cy.request(SITEMAP_URL) + .its('body') + .should('include', BLOOM_URL + '/about-our-courses'); + }); + it('meet the team url', () => { + cy.request(SITEMAP_URL) + .its('body') + .should('include', BLOOM_URL + '/meet-the-team'); + }); + it('therapy urls', () => { + const THERAPY_SEGMENT = '/therapy'; + cy.request(SITEMAP_URL) + .its('body') + .should('include', BLOOM_URL + THERAPY_SEGMENT + '/book-session') + .should('include', BLOOM_URL + THERAPY_SEGMENT + '/confirmed-session'); + }); + it('courses urls', () => { + const COURSES_SEGMENT = '/courses'; + const localeSegments = ['', '/es', '/hi', '/fr', '/pt', '/de']; + + localeSegments.forEach((localeSegment) => { + cy.request(SITEMAP_URL) + .its('body') + .should('include', BLOOM_URL + localeSegment + COURSES_SEGMENT) + .should('have.length.greaterThan', 0); + }); + }); +}); From 3636d7d7fcd55c26a39c4aeb912812abf3da8f31 Mon Sep 17 00:00:00 2001 From: Boodland Date: Tue, 10 Sep 2024 17:13:41 +0200 Subject: [PATCH 3/4] Simplify tests cases after review feedback --- cypress/integration/tests/sitemap.cy.tsx | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/cypress/integration/tests/sitemap.cy.tsx b/cypress/integration/tests/sitemap.cy.tsx index 8abc238c..d2cce748 100644 --- a/cypress/integration/tests/sitemap.cy.tsx +++ b/cypress/integration/tests/sitemap.cy.tsx @@ -8,32 +8,9 @@ describe('Sitemap should have', () => { it('bloom url', () => { cy.request(SITEMAP_URL).its('body').should('include', BLOOM_URL); }); - it('about our courses url', () => { - cy.request(SITEMAP_URL) - .its('body') - .should('include', BLOOM_URL + '/about-our-courses'); - }); it('meet the team url', () => { cy.request(SITEMAP_URL) .its('body') .should('include', BLOOM_URL + '/meet-the-team'); }); - it('therapy urls', () => { - const THERAPY_SEGMENT = '/therapy'; - cy.request(SITEMAP_URL) - .its('body') - .should('include', BLOOM_URL + THERAPY_SEGMENT + '/book-session') - .should('include', BLOOM_URL + THERAPY_SEGMENT + '/confirmed-session'); - }); - it('courses urls', () => { - const COURSES_SEGMENT = '/courses'; - const localeSegments = ['', '/es', '/hi', '/fr', '/pt', '/de']; - - localeSegments.forEach((localeSegment) => { - cy.request(SITEMAP_URL) - .its('body') - .should('include', BLOOM_URL + localeSegment + COURSES_SEGMENT) - .should('have.length.greaterThan', 0); - }); - }); }); From 88b0d2ba2b85fa5b1aae74c65c91a305c3b6046d Mon Sep 17 00:00:00 2001 From: Boodland Date: Tue, 10 Sep 2024 17:14:01 +0200 Subject: [PATCH 4/4] Remove about our courses url after review feedback --- pages/sitemap.xml.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/pages/sitemap.xml.tsx b/pages/sitemap.xml.tsx index 91798580..b1a51193 100644 --- a/pages/sitemap.xml.tsx +++ b/pages/sitemap.xml.tsx @@ -9,9 +9,6 @@ async function generateSiteMap({ locales }: any) { https://bloom.chayn.co - - https://bloom.chayn.co/about-our-courses - https://bloom.chayn.co/meet-the-team