From 057aa2cc32d63516fab9b5db81515fcea1773ac2 Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Thu, 16 Nov 2023 13:48:04 -0500 Subject: [PATCH 1/8] Adding testing for community, match,video --- .../e2e/accessmatch/community-overview.cy.js | 25 ++++++++++++ .../e2e/accessmatch/match-overview.cy.js | 38 +++++++++++++++++++ .../accessmatch/video-learning-center.cy.js | 23 +++++++++++ 3 files changed, 86 insertions(+) create mode 100644 tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js create mode 100644 tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js create mode 100644 tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js diff --git a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js new file mode 100644 index 000000000..7751efd5e --- /dev/null +++ b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js @@ -0,0 +1,25 @@ +/* + This test is specifically focused on the Community Overview Page tested for an unauthenticated user. + This test checks for major functions like: + Page Title, + CTA Functionality + Popular Tags + */ + +describe("Unauthenticated user tests the Community Overview Page", () => { + it("Should test Community Overview Page for unauthenticated user", () => { + // login user with the "unauthenticated" role + cy.visit("/community/overview"); + + //Page Title + + //Call to action function + cy.verifyCallToActionBlock( + "/community/overview", + "Join the CSSN", + "https://localhost/user/login?destination=/cssn%23join-cssn" + ); + + //Popular Tags tested? + }); +}); diff --git a/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js new file mode 100644 index 000000000..ec82e6afa --- /dev/null +++ b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js @@ -0,0 +1,38 @@ +/* + This test is specifically focused on the Match Overview Page tested for an unauthenticated user. + This test checks for major functions like: + Page Title, + CTA Functionality + Match Enagagements section + */ + +describe("Unauthenticated user tests the Match Overview Page", () => { + it("Should test Match Overview Page for unauthenticated user", () => { + // login user with the "unauthenticated" role + cy.visit("/match/overview"); + + //Page Title + cy.contains("Match Services Overview"); + + //Call to action function + cy.verifyCallToActionBlock( + "/match/overview", + "Request an engagement", + "/node/add/match_engagement?type=plus" + ); + + //Match Engagements Header + cy.contains("MATCH Engagements"); + + //Match Engagements Btn + cy.get(".btn") + .should("exist") + .contains("All Engagements") + .should("have.attr", "href", "match/engagements"); + + //Individual Match Engagement + cy.contains("GPU-accelerated ice sheet flow modeling"); + cy.contains("University of North Dakota"); + cy.contains("Status: In Progress"); + }); +}); diff --git a/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js new file mode 100644 index 000000000..7c2c8a8ec --- /dev/null +++ b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js @@ -0,0 +1,23 @@ +/* + This test is specifically focused on the Video Learning Center Page tested for an unauthenticated user. + This test checks for major functions like: + Page Title, + CTA Functionality + */ + +describe("Unauthenticated user tests the Video Learning Center Page", () => { + it("Should test Video Learning Center Page for unauthenticated user", () => { + // login user with the "unauthenticated" role + cy.visit("/video-learning-center"); + + //Page Title + cy.contains("ACCESS Support Video Learning Center"); + + //Call to action function + cy.verifyCallToActionBlock( + "/video-learning-center", + "ACCESS CI YouTube Channel", + "https://www.youtube.com/c/ACCESSforCIs" + ); + }); +}); From 13f60ab8bbe4137ab3080f44e0e5a7515e63fa4d Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Fri, 17 Nov 2023 11:37:42 -0500 Subject: [PATCH 2/8] Fixing Match Overview --- tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js index ec82e6afa..aa1f917b4 100644 --- a/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js @@ -28,7 +28,7 @@ describe("Unauthenticated user tests the Match Overview Page", () => { cy.get(".btn") .should("exist") .contains("All Engagements") - .should("have.attr", "href", "match/engagements"); + .should("have.attr", "href", "/match/engagements"); //Individual Match Engagement cy.contains("GPU-accelerated ice sheet flow modeling"); From aac08393d2992827e5706f3a141c95ea07b6d994 Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Fri, 17 Nov 2023 12:44:13 -0500 Subject: [PATCH 3/8] Fixing Video learning --- .../cypress/cypress/e2e/accessmatch/video-learning-center.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js index 7c2c8a8ec..e7b7c90af 100644 --- a/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js @@ -17,7 +17,7 @@ describe("Unauthenticated user tests the Video Learning Center Page", () => { cy.verifyCallToActionBlock( "/video-learning-center", "ACCESS CI YouTube Channel", - "https://www.youtube.com/c/ACCESSforCIs" + "https://www.youtube.com/c/ACCESSforCI" ); }); }); From 16895c0d0e2e8fceb10d2e6f62501c1baa901ed2 Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Fri, 17 Nov 2023 13:03:34 -0500 Subject: [PATCH 4/8] Fixing Community Overview --- tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js index 7751efd5e..ed44b819f 100644 --- a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js @@ -17,7 +17,7 @@ describe("Unauthenticated user tests the Community Overview Page", () => { cy.verifyCallToActionBlock( "/community/overview", "Join the CSSN", - "https://localhost/user/login?destination=/cssn%23join-cssn" + "https://***-local.cnctci.lndo.site/user/login?destination=/cssn%23join-cssn" ); //Popular Tags tested? From 43113c5cfc744681f7ab34dd940b9211775b4929 Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Fri, 17 Nov 2023 13:43:58 -0500 Subject: [PATCH 5/8] Fixing CTA function and cleaning href --- .../e2e/accessmatch/community-overview.cy.js | 2 +- tests/cypress/cypress/support/commands.js | 146 +++++++++--------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js index ed44b819f..1639e10d4 100644 --- a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js @@ -17,7 +17,7 @@ describe("Unauthenticated user tests the Community Overview Page", () => { cy.verifyCallToActionBlock( "/community/overview", "Join the CSSN", - "https://***-local.cnctci.lndo.site/user/login?destination=/cssn%23join-cssn" + "/user/login?destination=/cssn%23join-cssn" ); //Popular Tags tested? diff --git a/tests/cypress/cypress/support/commands.js b/tests/cypress/cypress/support/commands.js index 5e1fa4d25..ae4a62548 100644 --- a/tests/cypress/cypress/support/commands.js +++ b/tests/cypress/cypress/support/commands.js @@ -1,8 +1,8 @@ /** * Verify all images load. */ -Cypress.Commands.add('verifyImages', () => { - cy.get('img').each(($img) => cy.wrap($img).verifyImage()); +Cypress.Commands.add("verifyImages", () => { + cy.get("img").each(($img) => cy.wrap($img).verifyImage()); }); /** @@ -14,8 +14,8 @@ Cypress.Commands.add('verifyImages', () => { * .get('img') * .verifyImage(); */ -Cypress.Commands.add('verifyImage', { prevSubject: true }, ($img) => { - const url = ($img[0]?.src || $img[0]?.srcset); +Cypress.Commands.add("verifyImage", { prevSubject: true }, ($img) => { + const url = $img[0]?.src || $img[0]?.srcset; if (url) { cy.request(url).then((response) => { // verify the image response is 200, and has a non-zero length body @@ -49,28 +49,25 @@ Cypress.Commands.add('verifyImage', { prevSubject: true }, ($img) => { * crumbs are present and have the expected hrefs. * */ -Cypress.Commands.add('checkBreadcrumbs', (crumbs) => { +Cypress.Commands.add("checkBreadcrumbs", (crumbs) => { var crumb, href; for ([crumb, href] of crumbs) { if (href) { - cy.get('.breadcrumb') + cy.get(".breadcrumb") .contains(crumb) - .should('have.attr', 'href') - .and('contain', href); + .should("have.attr", "href") + .and("contain", href); } else { - cy.get('.breadcrumb') - .contains(crumb) - .should('not.have.attr', 'href'); + cy.get(".breadcrumb").contains(crumb).should("not.have.attr", "href"); } - } }); /** * Logs out the user. */ -Cypress.Commands.add('drupalLogout', () => { - cy.visit('/user/logout'); +Cypress.Commands.add("drupalLogout", () => { + cy.visit("/user/logout"); }); /** @@ -81,31 +78,30 @@ Cypress.Commands.add('drupalLogout', () => { * @param {string} password * The password for the user's account. */ -Cypress.Commands.add('loginAs', (username, password) => { +Cypress.Commands.add("loginAs", (username, password) => { cy.drupalLogout(); - cy.visit('/f64816be-34ca-4d5b-975a-687cb374ddf7'); - cy.get('#edit-name') - .type(username); - cy.get('#edit-pass').type(password, { + cy.visit("/f64816be-34ca-4d5b-975a-687cb374ddf7"); + cy.get("#edit-name").type(username); + cy.get("#edit-pass").type(password, { log: false, }); - cy.get('.form-submit').contains('Log in').click(); + cy.get(".form-submit").contains("Log in").click(); }); /** -* Logs a user in by their uid via drush uli. -*/ -Cypress.Commands.add('loginUserByUid', (uid) => { - cy.drush('user-login', [], { uid, uri: Cypress.env('baseUrl') }) - .its('stdout') + * Logs a user in by their uid via drush uli. + */ +Cypress.Commands.add("loginUserByUid", (uid) => { + cy.drush("user-login", [], { uid, uri: Cypress.env("baseUrl") }) + .its("stdout") .then(function (url) { cy.visit(url); }); }); /** -* Custom command to verify the existence of a button within the "region-cta" block -*/ + * Custom command to verify the existence of a button within the "region-cta" block + */ Cypress.Commands.add("verifyCallToActionBlock", (url, text, href) => { // Visit the specified URL cy.visit(url); @@ -115,35 +111,37 @@ Cypress.Commands.add("verifyCallToActionBlock", (url, text, href) => { cy.get("#cta") .should("exist") .contains(text) - .should("have.attr", "href", href); + .should("have.attr", "href") + .and("contain", href); }); /** -* Deletes last node created. -*/ -Cypress.Commands.add('deleteLastNode', () => { - cy.visit('/admin/content'); - cy.get('tbody > :nth-child(1) > .views-field-title > a').click(); - cy.get('#block-dingo-local-tasks > ul > :nth-child(3) > a').click({ force: true }); + * Deletes last node created. + */ +Cypress.Commands.add("deleteLastNode", () => { + cy.visit("/admin/content"); + cy.get("tbody > :nth-child(1) > .views-field-title > a").click(); + cy.get("#block-dingo-local-tasks > ul > :nth-child(3) > a").click({ + force: true, + }); cy.get('[value="Delete"]').click(); }); /** -* Logs a user in by their uid via drush uli. -*/ -Cypress.Commands.add('drushUli', () => { - cy.task('log', 'in drushUli'); - - cy.drush('uli', ['--uri=' + Cypress.config('baseUrl')], {}) - .then((result) => { - cy.task('log', 'result = ' + JSON.stringify(result)); - if (result.code !== 0) { - throw new Error(result.stderr); - } else { - cy.task('log', 'drushUli trying to visit "' + result.stdout + '"'); - cy.visit(result.stdout); - } - }); + * Logs a user in by their uid via drush uli. + */ +Cypress.Commands.add("drushUli", () => { + cy.task("log", "in drushUli"); + + cy.drush("uli", ["--uri=" + Cypress.config("baseUrl")], {}).then((result) => { + cy.task("log", "result = " + JSON.stringify(result)); + if (result.code !== 0) { + throw new Error(result.stderr); + } else { + cy.task("log", 'drushUli trying to visit "' + result.stdout + '"'); + cy.visit(result.stdout); + } + }); }); /** @@ -157,10 +155,12 @@ Cypress.Commands.add('drushUli', () => { * our Cypress tests don't crash if the drush command returns an error (e.g. * if we try to delete a user account that does not exist.) */ -Cypress.Commands.add('drush', (command, args = [], options = {}) => { - cy.task('log', 'in drush, command = "' + command + '"'); - const ee = `drush ${command} ${stringifyArguments(args)} ${stringifyOptions(options)} -y`; - cy.task("log", 'in drush, about to exec this: ' + ee); +Cypress.Commands.add("drush", (command, args = [], options = {}) => { + cy.task("log", 'in drush, command = "' + command + '"'); + const ee = `drush ${command} ${stringifyArguments(args)} ${stringifyOptions( + options + )} -y`; + cy.task("log", "in drush, about to exec this: " + ee); return cy.exec(ee, { failOnNonZeroExit: false }); }); @@ -171,8 +171,8 @@ Cypress.Commands.add('drush', (command, args = [], options = {}) => { * @returns */ function stringifyArguments(args) { - return args.join(' '); -}; + return args.join(" "); +} /** * Returns a string from an array of options. @@ -181,25 +181,25 @@ function stringifyArguments(args) { * @returns */ function stringifyOptions(options) { - return Object.keys(options).map(option => { - let output = `--${option}`; - - if (options[option] === true) { - return output; - } + return Object.keys(options) + .map((option) => { + let output = `--${option}`; - if (options[option] === false) { - return ''; - } - - if (typeof options[option] === 'string') { - output += `="${options[option]}"`; - } else { - output += `=${options[option]}` - } + if (options[option] === true) { + return output; + } - return output; - }).join(' ') -}; + if (options[option] === false) { + return ""; + } + if (typeof options[option] === "string") { + output += `="${options[option]}"`; + } else { + output += `=${options[option]}`; + } + return output; + }) + .join(" "); +} From 4dab4230412d118f296d6498693f81a440bcf2df Mon Sep 17 00:00:00 2001 From: Hannah L Cameron Date: Fri, 17 Nov 2023 14:11:03 -0500 Subject: [PATCH 6/8] Adding elements for page title and specific areas --- .../e2e/accessmatch/community-overview.cy.js | 1 + .../cypress/e2e/accessmatch/match-overview.cy.js | 16 +++++++++++----- .../e2e/accessmatch/video-learning-center.cy.js | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js index 1639e10d4..5918241b9 100644 --- a/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/community-overview.cy.js @@ -12,6 +12,7 @@ describe("Unauthenticated user tests the Community Overview Page", () => { cy.visit("/community/overview"); //Page Title + cy.get(".page-title").contains("Community"); //Call to action function cy.verifyCallToActionBlock( diff --git a/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js index aa1f917b4..b0462e4b6 100644 --- a/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/match-overview.cy.js @@ -12,7 +12,7 @@ describe("Unauthenticated user tests the Match Overview Page", () => { cy.visit("/match/overview"); //Page Title - cy.contains("Match Services Overview"); + cy.get(".page-title > .field").contains("Match Services Overview"); //Call to action function cy.verifyCallToActionBlock( @@ -22,7 +22,7 @@ describe("Unauthenticated user tests the Match Overview Page", () => { ); //Match Engagements Header - cy.contains("MATCH Engagements"); + cy.get(".m-0").contains("MATCH Engagements"); //Match Engagements Btn cy.get(".btn") @@ -31,8 +31,14 @@ describe("Unauthenticated user tests the Match Overview Page", () => { .should("have.attr", "href", "/match/engagements"); //Individual Match Engagement - cy.contains("GPU-accelerated ice sheet flow modeling"); - cy.contains("University of North Dakota"); - cy.contains("Status: In Progress"); + cy.get(":nth-child(2) > .card > .card-body").contains( + "GPU-accelerated ice sheet flow modeling" + ); + cy.get(":nth-child(2) > .card > .card-body").contains( + "University of North Dakota" + ); + cy.get(":nth-child(2) > .card > .card-body").contains( + "Status: In Progress" + ); }); }); diff --git a/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js index e7b7c90af..422b16f25 100644 --- a/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js +++ b/tests/cypress/cypress/e2e/accessmatch/video-learning-center.cy.js @@ -11,7 +11,7 @@ describe("Unauthenticated user tests the Video Learning Center Page", () => { cy.visit("/video-learning-center"); //Page Title - cy.contains("ACCESS Support Video Learning Center"); + cy.get(".page-title").contains("ACCESS Support Video Learning Center"); //Call to action function cy.verifyCallToActionBlock( From e4a831c216633c357db91078139d2a7b44c56819 Mon Sep 17 00:00:00 2001 From: protitude Date: Tue, 21 Nov 2023 17:18:45 +0000 Subject: [PATCH 7/8] config: views distinct --- .../default/views.view.match_engagements_submissions.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/sites/default/config/default/views.view.match_engagements_submissions.yml b/web/sites/default/config/default/views.view.match_engagements_submissions.yml index 3ee6877af..bbf934578 100644 --- a/web/sites/default/config/default/views.view.match_engagements_submissions.yml +++ b/web/sites/default/config/default/views.view.match_engagements_submissions.yml @@ -1100,11 +1100,12 @@ display: options: query_comment: '' disable_sql_rewrite: false - distinct: false + distinct: true replica: false query_tags: { } contextual_filters_or: false relationships: { } + group_by: false header: { } footer: { } display_extenders: { } From 76b9925b354772b129e32a44d39d3af0ff90208e Mon Sep 17 00:00:00 2001 From: protitude Date: Wed, 29 Nov 2023 18:58:06 +0000 Subject: [PATCH 8/8] Update access module and them --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index d8e3e1b37..f3aece152 100644 --- a/composer.lock +++ b/composer.lock @@ -295,7 +295,7 @@ "source": { "type": "git", "url": "https://github.com/necyberteam/access.git", - "reference": "2cf32a9ca7de66f46a4d5ddc28f5fcaf620e18d1" + "reference": "a04a8d4588935cdc4eb5ffd8798a1a8c4d7f4602" }, "default-branch": true, "type": "drupal-custom-module", @@ -313,7 +313,7 @@ "issues": "https://github.com/necyberteam/access/issues", "source": "https://github.com/necyberteam/access" }, - "time": "2023-11-12T18:26:11+00:00" + "time": "2023-11-29T18:52:45+00:00" }, { "name": "arthurkushman/query-path", @@ -11393,7 +11393,7 @@ "source": { "type": "git", "url": "https://github.com/necyberteam/aspTheme.git", - "reference": "9cd465bfce75f8d0e6e53278698ddbe87c4a5970" + "reference": "802ec5bd698e806581ba4efdd3121ad59a62fc69" }, "default-branch": true, "type": "drupal-theme", @@ -11411,7 +11411,7 @@ "issues": "https://github.com/necyberteam/aspTheme/issues", "source": "https://github.com/necyberteam/aspTheme" }, - "time": "2023-11-10T16:56:16+00:00" + "time": "2023-11-27T19:13:39+00:00" }, { "name": "necyberteam/campus-champions-theme",