Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/cypress/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module.exports = defineConfig({
video: false,
viewportWidth: 1025,
viewportHeight: 600,
retries: {
runMode: 1,
openMode: 0,
},
e2e: {
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
Expand Down
54 changes: 53 additions & 1 deletion tests/cypress/cypress/e2e/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ When('user selects test site section', () => {
.find('td.views-field.views-field-entity-browser-select input').check();
cy.getIframeBody('iframe.entity-browser-modal-iframe')
.find("input[id='edit-submit'][value='Select Site Section']").click();
cy.get('[id*="edit-field-site-section-current-items"]').eq(0).should('include.text','Test')
});

And('user fills out the following fields', (dataTable) => {
Expand Down Expand Up @@ -141,4 +142,55 @@ And('user enters {string} into app config text field', (value) => {

And('{string} user password is changed to {string}', (username, password) => {
cy.exec(`drush user:password ${username} '${password}'`)
});
});

And('user selects {string} from style dropdown', (option) => {
cy.get('select[name="field_page_style"]').select(option);
});

And('browser waits', () => {
cy.wait(2000);
});

And('user selects {string} from content dropdown', (dropDown) => {
cy.get(`input[value="${dropDown}"]`).click({ force: true });
})

And('user selects {string} theme for {int} block', (option, index) => {
cy.get('select[name*="theme"]').eq(index-1).select(option)
});
And('user selects {string} image position for {int} block', (option, index) => {
cy.get('select[name*="image_position"]').eq(index - 1).select(option)
});

And('user clicks on {string} in {string} section', (featItemLink, section) => {
cy.get(`summary[aria-expanded="false"]:contains("${featItemLink}")`).click();
});

And('user clicks on {string} button item', (selectContent) => {
cy.get(`input[value="${selectContent}"]`).trigger("click")
})

And('user selects {string} item from the list', (title) => {
cy.getIframeBody('iframe#entity_browser_iframe_cgov_content_browser').find(`td:contains(${title})`).parent().find('input').click({ force: true });
});

And('user clicks on {string} button to select item', (selectContent) => {
cy.getIframeBody('iframe#entity_browser_iframe_cgov_content_browser').find(`input[id='edit-submit'][value='${selectContent}']`).click({ force: true });
});

And('only {int} promo block with link {string} is displayed',(count,href)=>{
cy.get('.nci-promo-block').should('be.visible').and("have.length", count);
cy.get('.nci-promo-block').find('a').should('have.attr','href',href)

})

And('message that {string} has been created appears',(txt)=>{
cy.get("div[role='contentinfo']").should('include.text',txt)
})

And('user logs out',()=>{
cy.get('#toolbar-item-user').click()
cy.get('a[href*="/user/logout"]').eq(1).click()

})
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Feature: Create Article

Scenario: Verify unpublished featured content is not displayed on FE
When user logs in with a role "simple_blocks"
Given user navigates to "/admin/content"
Then user clicks on "Content" tab
And user clicks on "Add content" action button
And user clicks on "Article" content type
Then page title is "Create Article"
When user selects test site section
And user fills out the following fields
| fieldLabel | value | field_name |
| Pretty URL | article-1 | field_pretty_url |
| Page Title | Article-1 | title[0][value] |
| Browser Title | Article-1 | field_browser_title |
| Meta Description | Article-1 - Meta Description | field_page_description |
And user selects "Published" from "Save as" dropdown
Then user saves the content page
And message that "Article Article-1" has been created appears
Given user navigates to "/admin/content"
Then user clicks on "Content" tab
And user clicks on "Add content" action button
And user clicks on "Article" content type
Then page title is "Create Article"
When user selects test site section
And user fills out the following fields
| fieldLabel | value | field_name |
| Pretty URL | article-2 | field_pretty_url |
| Page Title | Article-2 | title[0][value] |
| Browser Title | Article-2 | field_browser_title |
| Meta Description | Article-2 - Meta Description | field_page_description |
Then user saves the content page
And message that "Article Article-2" has been created appears
Given user navigates to "/admin/content"
Then user clicks on "Content" tab
And user clicks on "Add content" action button
And user clicks on "Home and Landing" content type
Then page title is "Create Home and Landing"
When user selects test site section
And user fills out the following fields
| fieldLabel | value | field_name |
| Pretty URL | home-landing-promo-blocks | field_pretty_url |
| Page Title | Home and Landing Unpublished Promo Blocks | title |
| Browser Title | Home and Landing Unpublished Promo Blocks | field_browser_title |
| Meta Description | Home and Landing - Meta Description | field_page_description |
And user selects "NCIDS without Title" from style dropdown
And user selects "Add NCIDS Promo Block Internal" from content dropdown
And browser waits
And user selects "Light" theme for 1 block
And user selects "Image Right" image position for 1 block
And user clicks on "Featured Item" in "NCIDS Promo Block Internal" section
And user clicks on "Select content" button item
And user selects "Article-1" item from the list
And user clicks on "Select content" button to select item
And browser waits
And user fills out the following fields
| fieldLabel | value | field_name |
| Button Text | Button Text | field_landing_contents[0][subform][field_button_text][0][value] |
And user selects "Add NCIDS Promo Block Internal" from content dropdown
And browser waits
And user selects "Light" theme for 2 block
And user selects "Image Right" image position for 2 block
And user clicks on "Featured Item" in "NCIDS Promo Block Internal" section
And user clicks on "Select content" button item
And user selects "Article-2" item from the list
And user clicks on "Select content" button to select item
And browser waits
And user fills out the following fields
| fieldLabel | value | field_name |
| Button Text | Button Text | field_landing_contents[1][subform][field_button_text][0][value] |
And user selects "Published" from "Save as" dropdown
Then user saves the content page
And message that "Home and Landing Home and Landing Unpublished Promo Blocks" has been created appears
And user logs out
When user navigates to "test-site-section/home-landing-promo-blocks"
Then only 1 promo block with link "/test-site-section/article-1" is displayed