Add Example Tests

Created on 1 December 2023, about 1 year ago

We have some tests that could be reused on multiple projects. We should have an examples section liked to from the cheatsheet.

πŸ“Œ Task
Status

Active

Component

Commands

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @thejimbirch
  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

    If I put an e2e_examples folder in shrubs, I it will be in the shrubs folder in the support folder.

    Is that weird? (maybe)

    Will that break anything? (I don't think so as support commands don't run unless they're called.)

  • πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

    Some examples I am thinking of are the tests I've created for our recipes and Sitewide Alerts:

    import {randNumber} from "@ngneat/falso";
    describe('Check Drupal sitewide alerts.', () => {
    
      it('Input a new sitewide alert test.', () => {
        cy.login()
        cy.visit('/admin/content/sitewide_alert/add')
    
        // Set the alert title (text field).
        const alertName = 'Alert Title ' + randNumber()
        cy.get('#edit-name-0-value').clear().type(alertName)
    
        // Set the Alert type (select field).
        const alertStyle = 'Critical'
        cy.get('#edit-style').select(alertStyle)
    
        // Set the Alert message (wysiwyg field).
        const alertBannerMessage = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
        cy.ckeditorType('#edit-field-alert-banner-message-wrapper', alertBannerMessage).wait(500)
    
        // Save the new alert node.
        cy.get('#edit-submit').click()
    
        // Validation.
    
        // Check landing page node
        cy.wait(1000) // wait for the UI to catch up.
    
        // Verify new Alert is in the admin UI list of Alerts and click to edit.
        cy.get('a').contains(alertName).click()
    
        // Verify alert title.
        cy.get('#edit-name-0-value').should('have.value', alertName)
    
        // Verify alert style.
        cy.get('#edit-style').find(':selected').contains(alertStyle)
    
        // @TODO Verify alert message.
        // cy.get('.form-item--field-alert-banner-message-0-value .ck-editor__editable_inline p').should('have.value', alertBannerMessage)
    
        // Verify the alert is Active.
        cy.get('#edit-status-value').should('be.checked')
      })
    })
    
Production build 0.71.5 2024