From aaed02c4f028a8298630031fd4c781d1f8a39bfc Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Wed, 4 Sep 2024 12:38:58 +0100 Subject: [PATCH 1/5] Fix: Removing false catchall from tests --- test/e2e/adapt-contrib-boxMenu.cy.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/e2e/adapt-contrib-boxMenu.cy.js b/test/e2e/adapt-contrib-boxMenu.cy.js index 381a957..d18ba52 100644 --- a/test/e2e/adapt-contrib-boxMenu.cy.js +++ b/test/e2e/adapt-contrib-boxMenu.cy.js @@ -2,8 +2,6 @@ describe('Menu Page', function () { beforeEach(function () { cy.getData().then((data) => { this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); - if (this.boxMenus.length) return; - this.boxMenus = this.data.filter(item => ['course', 'menu'].includes(item._type)); }); cy.visit('/'); From e814a4fa23dc3734013b5d67a85c2b4570ac1023 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Fri, 6 Sep 2024 10:50:37 +0100 Subject: [PATCH 2/5] Fix: Early escape from array setting if Menu is not included on the course --- test/e2e/adapt-contrib-boxMenu.cy.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/e2e/adapt-contrib-boxMenu.cy.js b/test/e2e/adapt-contrib-boxMenu.cy.js index d18ba52..2f2100f 100644 --- a/test/e2e/adapt-contrib-boxMenu.cy.js +++ b/test/e2e/adapt-contrib-boxMenu.cy.js @@ -1,8 +1,14 @@ describe('Menu Page', function () { beforeEach(function () { - cy.getData().then((data) => { - this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); - }); + cy.getConfig().then((config) => { + if (!config?.build?.includes?.includes('adapt-contrib-boxMenu')) return; + + cy.getData().then((data) => { + this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); + if (this.boxMenus.length) return; + this.boxMenus = this.data.filter(item => ['course', 'menu'].includes(item._type)); + }); + } cy.visit('/'); }); From f265c797eb8d4c501890b889e75870ffba1649b7 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Fri, 6 Sep 2024 10:53:38 +0100 Subject: [PATCH 3/5] Better test skipping process --- test/e2e/adapt-contrib-boxMenu.cy.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/e2e/adapt-contrib-boxMenu.cy.js b/test/e2e/adapt-contrib-boxMenu.cy.js index 2f2100f..8cefd19 100644 --- a/test/e2e/adapt-contrib-boxMenu.cy.js +++ b/test/e2e/adapt-contrib-boxMenu.cy.js @@ -1,13 +1,17 @@ describe('Menu Page', function () { - beforeEach(function () { + before(function() { cy.getConfig().then((config) => { - if (!config?.build?.includes?.includes('adapt-contrib-boxMenu')) return; + if (!config?.build?.includes?.includes('adapt-contrib-boxMenu')) { + this.skip(); + } + } + }); - cy.getData().then((data) => { - this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); - if (this.boxMenus.length) return; - this.boxMenus = this.data.filter(item => ['course', 'menu'].includes(item._type)); - }); + beforeEach(function () { + cy.getData().then((data) => { + this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); + if (this.boxMenus.length) return; + this.boxMenus = this.data.filter(item => ['course', 'menu'].includes(item._type)); } cy.visit('/'); From 61a75545f4683f3f76f745bc1eb60c73a40afdc0 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Fri, 6 Sep 2024 11:09:35 +0100 Subject: [PATCH 4/5] Corrected typo --- test/e2e/adapt-contrib-boxMenu.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/adapt-contrib-boxMenu.cy.js b/test/e2e/adapt-contrib-boxMenu.cy.js index 8cefd19..498e3a5 100644 --- a/test/e2e/adapt-contrib-boxMenu.cy.js +++ b/test/e2e/adapt-contrib-boxMenu.cy.js @@ -4,7 +4,7 @@ describe('Menu Page', function () { if (!config?.build?.includes?.includes('adapt-contrib-boxMenu')) { this.skip(); } - } + }); }); beforeEach(function () { From 01e9207543ef5e22c67b4ec98a1efaf50e0d8cc7 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Fri, 6 Sep 2024 11:33:28 +0100 Subject: [PATCH 5/5] Corrected typo --- test/e2e/adapt-contrib-boxMenu.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/adapt-contrib-boxMenu.cy.js b/test/e2e/adapt-contrib-boxMenu.cy.js index 498e3a5..d658664 100644 --- a/test/e2e/adapt-contrib-boxMenu.cy.js +++ b/test/e2e/adapt-contrib-boxMenu.cy.js @@ -12,7 +12,7 @@ describe('Menu Page', function () { this.boxMenus = this.data.filter(item => item._component === 'boxMenu' || item._view === 'boxMenu'); if (this.boxMenus.length) return; this.boxMenus = this.data.filter(item => ['course', 'menu'].includes(item._type)); - } + }); cy.visit('/'); });