Skip to content

Commit

Permalink
Update CHEATSHEET.md
Browse files Browse the repository at this point in the history
  • Loading branch information
thejimbirch authored Oct 13, 2023
1 parent 2dcb6c9 commit 671fd63
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions CHEATSHEET.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,56 @@
## Administration

### Log into Drupal
[Link to login.js](login.js)
[login.js](login.js)

`cy.login('User', 'pass')`

### Logout
[Link to logout](logout.js)
### Logout of Drupal
[logout.js](logout.js)

`cy.logout()`

### Use Drush
[drush.js](drush.js)

`cy.drush('cr')`

### Go to a page
`cy.visit('/path')`

## Creating a Node
### Go to a node add form
`cy.visit('/node/add'); // Replace with the actual URL of your content`


### Fill out a text field
`cy.get('#id-selector').type(enter-string);`

### Choose a select list option
`cy.get('#id-selector').select('option');`

### Choose a radio or checkbox
### In Cypress, you can interact with radio buttons and checkboxes on a Drupal site using the .check() and .click()
In Cypress, you can interact with radio buttons and checkboxes on a Drupal site using the .check() and .click()
`cy.get('#id-selector').click();`

### Choose an autocomplete
### Use Cypress autocomplete command will select first option that appears for autocomplete
[Link to autocomplete](autocomplete.js)
Use Cypress autocomplete command will select first option that appears for autocomplete
[autocomplete.js](autocomplete.js)

`cy.autocomplete('[data-drupal-selector="edit-field-sample-0-target-id"]', 'item');`

### Fill out a rich text editor field
### Use ckeditorType command
[Link to ckeditortype](ckeditorType.js)
[ckeditorType.js](ckeditorType.js)

`cy.ckeditorType('#edit-body-0-value', 'string of text')`

### Validate content in a rich text editor field
[ckeditorGet.js](ckeditorType.js)

```
const example_content = 'some text';
cy.ckeditorGet('#edit-body-wrapper').should('contain', example_content)
```

### Create a Paragraph
```
cy.visit('/node/123/edit');
Expand Down Expand Up @@ -104,15 +119,15 @@ cy.get('#edit-menu-parent').select('Main Menu');
cy.get('#edit-submit').click();
```

### Include/Exclude a node from a Sitemap
### Include/Exclude a node from an XML Sitemap
```
// Need to test and validate this example code
cy.visit('/node/123/edit');
// Click on xml sitemap tab dropdown
cy.get('.sitemap-settings-details summary').click();
//click on dropdown tabs for sitemap
// Click on dropdown tabs for sitemap
cy.get('#edit-xmlsitemap-include').click();
// Select dropdown tab option
Expand All @@ -123,15 +138,18 @@ cy.get('#edit-submit').click();
```

### Uploading a file
[Link to uploadFile](uploadFile.js)
[uploadFile.js](uploadFile.js)

`cy.uploadFile('#file-field-wrapper', 'example.png')`

### Choosing a file from a media library
[Link to mediaLibrarySelect](mediaLibrarySelect.js)
[mediaLibrarySelect.js](mediaLibrarySelect.js)

`cy.mediaLibrarySelect('#field_media_assets-media-library-wrapper', 'sample.png', 'image')`

### Add file from media library
[Link to mediaLibraryAdd](mediaLibraryAdd.js)
[mediaLibraryAdd.js](mediaLibraryAdd.js)

`cy.mediaLibraryAdd('#field_media_assets-media-library-wrapper', 'sample.mp3', 'audio')`

### Change Revision state
Expand Down Expand Up @@ -181,6 +199,3 @@ cy.get('#edit-revision-log-0-value').type('This is a revision log message.');
cy.get('#edit-submit').click();
cy.get('#revision-log-message').should('contain', 'This is a revision log message');
```



0 comments on commit 671fd63

Please sign in to comment.