diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index f6221ddf5..8550befc8 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -31,6 +31,19 @@ jobs: LANDO_ENV: ${{ secrets.LANDO_ENV }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} REPO: "${{ github.server_url }}/${{ github.repository }}" + ccmnet: + name: Run cypress tests in 'ccmnet' directory + uses: necyberteam/reusable_actions/.github/workflows/cypress.yml@v3 + if: contains(github.event.inputs.sites, 'ccmnet') || github.event_name == 'pull_request' + secrets: + slack_token: ${{ secrets.SLACK_TOKEN }} + site: "ccmnet" + database: ${{ github.event.inputs.database }} + prnum: ${{ github.event.inputs.prnum }} + gh_token: ${{ secrets.GH_TOKEN_REPO }} + LANDO_ENV: ${{ secrets.LANDO_ENV }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + REPO: "${{ github.server_url }}/${{ github.repository }}" # success: # name: Actions to run on success @@ -56,7 +69,7 @@ jobs: fail: name: Actions to run on fail - needs: [asp] + needs: [asp, ccmnet] if: ${{ failure() }} runs-on: ubuntu-latest steps: diff --git a/tests/cypress/cypress/e2e/ccmnet/home.cy.js b/tests/cypress/cypress/e2e/ccmnet/home.cy.js new file mode 100644 index 000000000..8e69dbd59 --- /dev/null +++ b/tests/cypress/cypress/e2e/ccmnet/home.cy.js @@ -0,0 +1,15 @@ +/* + CCMnet Homepage for an unauthenticated user. +*/ +describe("Unauthenticated user tests the CCMNet Homepage", () => { + it("Should test the CCMNet Homepage for unauthenticated user", () => { + cy.visit("/"); + + // Site heading + cy.get(".site-heading").contains( + "A peer-to-peer program for CI professionals to make connections and exchange knowledge" + ); + + }); + }); + \ No newline at end of file diff --git a/tests/cypress/cypress/e2e/ccmnet/mentorships/add-mentorship.cy.js b/tests/cypress/cypress/e2e/ccmnet/mentorships/add-mentorship.cy.js new file mode 100644 index 000000000..2b32733b8 --- /dev/null +++ b/tests/cypress/cypress/e2e/ccmnet/mentorships/add-mentorship.cy.js @@ -0,0 +1,36 @@ +/* + Authenticated user creates a new Mentorship Engagement. +*/ +describe("Authenticated user creates a Mentorship Engagement", () => { + it("Authenticated user creates a Mentorship Engagement", () => { + cy.loginWith("pecan@pie.org", "Pecan") + cy.visit("/node/add/mentorship_engagement") + + // check the box for "I am looking for a mentor" + cy.get("#edit-field-me-looking-for-mentor").check() + + cy.get("#edit-title-0-value").type("Mentorship Title") + + cy.get("#edit-body-0-summary").type("Mentorship Summary") + + cy.get('.form-item-body-0-value .ck-content').then(el => { + const editor = el[0].ckeditorInstance + editor.setData('Mentoring supports the growth of a vibrant HPC community by connecting students with experienced mentors. Matches are based on multiple factors, including research interests, career goals, long-term plans, and general interests. Providing valuable professional advice and resources that will benefit mentees which might include: sharing expertise in your specific research domain/discipline, sharing personal experiences and advice that might benefit your student mentee, encouraging students to stay abreast of scholarly literature and cutting-edge ideas in their field, Encouraging the open exchange of ideas, Facilitating networking opportunities with other faculty or professionals on campus or within the broader research community as appropriate.') + }) + + // get tag suggestions + // cy.get("#field-tags-replace input[type='submit']").click() + + cy.get("details.tags summary").click() + cy.get("#tag-ai").click() + + cy.get('.form-item-field-me-preferred-attributes-0-value .ck-content').then(el => { + const editor = el[0].ckeditorInstance + editor.setData('Be nice.') + }) + + cy.get('#edit-field-me-state').select('Recruiting') + + cy.get(".node-mentorship-engagement-form #edit-submit").click() + }); +}); \ No newline at end of file diff --git a/tests/cypress/cypress/support/commands.js b/tests/cypress/cypress/support/commands.js index a946c783f..b0a690941 100644 --- a/tests/cypress/cypress/support/commands.js +++ b/tests/cypress/cypress/support/commands.js @@ -88,6 +88,26 @@ Cypress.Commands.add("loginAs", (username, password) => { cy.get(".form-submit").contains("Log in").click(); }); +/** + * User login command for default /user/login route. + * + * Requires valid username and password. + * + * @param {string} username + * The username with which to log in. + * @param {string} password + * The password for the user's account. + */ +Cypress.Commands.add("loginWith", (username, password) => { + cy.drupalLogout(); + cy.visit("/user/login"); + cy.get("#edit-name").type(username); + cy.get("#edit-pass").type(password, { + log: false, + }); + cy.get(".form-submit").contains("Log in").click(); +}); + /** * Logs a user in by their uid via drush uli. */