-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3355 from bolt/working-on-cypress-tests
Working on cypress tests
- Loading branch information
Showing
16 changed files
with
261 additions
and
243 deletions.
There are no files selected for viewing
87 changes: 0 additions & 87 deletions
87
tests/cypress/integration-temporary-disabled/contenttype_permissions.spec.bak
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
tests/cypress/integration-temporary-disabled/contenttype_permissions.spec_1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Edit content as chief editor and editor without being the owner', () => { | ||
it('checks that the chief editor and editor can edit someone else\'s content', () => { | ||
cy.login('jane_chief', 'jane%1'); | ||
|
||
cy.visit('/bolt/content/pages'); | ||
|
||
cy.get('.listing__row.is-normal').eq(0).children('.listing__row--item.is-actions.edit-actions').children('div').children('a[href="/bolt/edit/2"]').click(); | ||
cy.url().should('contain', '/bolt/edit/2'); | ||
|
||
cy.get('#field-heading').invoke('val').should('contain', 'This is a page'); | ||
cy.get('#field-heading').clear(); | ||
cy.get('#field-heading').type('This is an edited page'); | ||
|
||
cy.get('button[name="save"]').eq(1).scrollIntoView(); | ||
cy.get('button[name="save"]').eq(1).click(); | ||
|
||
cy.get('#field-heading').invoke('val').should('contain', 'This is an edited page'); | ||
cy.visit('bolt/logout'); | ||
|
||
cy.login('john_editor', 'john%1'); | ||
|
||
cy.visit('/bolt/content/pages'); | ||
|
||
cy.get('.listing__row.is-normal').eq(0).children('.listing__row--item.is-actions.edit-actions').children('div').children('a[href="/bolt/edit/2"]').click(); | ||
cy.url().should('contain', '/bolt/edit/2'); | ||
|
||
cy.get('#field-heading').invoke('val').should('contain', 'This is an edited page'); | ||
cy.get('#field-heading').clear(); | ||
cy.get('#field-heading').type('This is a page'); | ||
|
||
cy.get('button[name="save"]').eq(1).scrollIntoView(); | ||
cy.get('button[name="save"]').eq(1).click(); | ||
|
||
cy.get('#field-heading').invoke('val').should('contain', 'This is a page'); | ||
cy.visit('bolt/logout'); | ||
}) | ||
}); |
31 changes: 31 additions & 0 deletions
31
tests/cypress/integration-temporary-disabled/contenttype_permissions.spec_2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Create content as editor and delete it as chief editor', () => { | ||
it('checks that editors can create content and chief editors can delete it', () => { | ||
cy.login('john_editor', 'john%1'); | ||
|
||
cy.visit('/bolt/content/pages'); | ||
|
||
cy.get('.card.mb-3').children('.card-body').children('p').children('a').click(); | ||
cy.url().should('contain', '/bolt/new/pages'); | ||
|
||
cy.get('#field-heading').type('Test heading'); | ||
|
||
cy.get('button[name="save"]').eq(1).scrollIntoView(); | ||
cy.get('button[name="save"]').eq(1).should('be.visible').click({force:true}); | ||
|
||
cy.visit('/bolt/logout'); | ||
|
||
cy.login('jane_chief', 'jane%1'); | ||
|
||
cy.visit('/bolt/content/pages?page=3'); | ||
|
||
cy.get('.listing__row.is-normal').eq(2).children('.listing__row--item.is-details').children('a').should('contain', 'Test heading -'); | ||
cy.get('button[data-bs-toggle="dropdown"]').eq(3).click(); | ||
cy.get('.edit-actions__dropdown.dropdown-menu.dropdown-menu-right').eq(2).children('a').eq(4).click(); | ||
cy.get('button[data-bs-dismiss="modal"]').click({ multiple: true }); | ||
|
||
cy.visit('/bolt/content/pages?page=3'); | ||
cy.get('.listing--container').its('length').should('eq', 3); | ||
}) | ||
}); |
52 changes: 52 additions & 0 deletions
52
tests/cypress/integration-temporary-disabled/edit_record_1_field.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('As an Admin I want to be able to make use of the embed, infobox and image fields', () => { | ||
it('checks if an admin can use the embed field', () => { | ||
cy.login(); | ||
cy.visit('/bolt/edit/44'); | ||
cy.get('a[id="media-tab"]').click(); | ||
|
||
cy.get('input[name="fields[embed][url]"]').clear(); | ||
cy.get('input[name="fields[embed][url]"').type('https://www.youtube.com/watch?v=x4IDM3ltTYo'); | ||
cy.wait(2000); | ||
cy.get('button[class="btn btn-tertiary refresh"]').should('be.enabled'); | ||
|
||
cy.get('input[name="fields[embed][title]"]').should('have.value', 'Silversun Pickups - Nightlight (Official Video)'); | ||
cy.get('input[name="fields[embed][authorname]"]').should('have.value', 'Silversun Pickups'); | ||
cy.get('input[name="fields[embed][width]"]').should('have.value', '200'); | ||
cy.get('input[name="fields[embed][height]"]').should('have.value', '113'); | ||
|
||
cy.get('.editor__embed .remove').click(); | ||
cy.get('input[name="fields[embed][title]"]').should('have.value', ''); | ||
cy.get('input[name="fields[embed][authorname]"]').should('have.value', ''); | ||
cy.get('input[name="fields[embed][width]"]').should('have.value', ''); | ||
cy.get('input[name="fields[embed][height]"]').should('have.value', ''); | ||
}) | ||
|
||
it('checks if an admin can see the infobox field', () => { | ||
cy.login(); | ||
cy.visit('/bolt/edit/38'); | ||
|
||
cy.get("label[for='field-email']").should('exist'); | ||
cy.get("label[for='field-email']").find('i').its('length').should('eq', 1); | ||
|
||
cy.get('label[for="field-email"]').scrollIntoView(); | ||
cy.get("label[for='field-email'] > i").trigger('mouseover'); | ||
cy.get('.popover-header').should('contain', 'Email').should('be.visible'); | ||
cy.get('.popover-body').should('contain', 'This is an info box shown as a popover next to the field label.').should('be.visible'); | ||
}) | ||
|
||
it('checks if an admin can reset an image field', () => { | ||
cy.login(); | ||
cy.visit('/bolt/edit/40'); | ||
cy.get('a[id="media-tab"]').click(); | ||
|
||
cy.get('label[for=field-image]').should('contain', 'Image'); | ||
cy.get('.form-control').eq(10).should('not.equal', ''); | ||
cy.get('.form-control').eq(11).should('not.equal', ''); | ||
|
||
cy.get('button[class="btn btn-sm btn-hidden-danger"]').should('contain', 'Remove').eq(0).click(); | ||
cy.get('input[name="fields[image][filename]"]').should('be.empty'); | ||
cy.get('input[name="fields[image][alt]"]').should('be.empty'); | ||
}) | ||
}); |
File renamed without changes.
51 changes: 0 additions & 51 deletions
51
...ary-disabled/edit_record_1_field.spec.bak → ...rary-disabled/edit_record_2_field.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
105 changes: 0 additions & 105 deletions
105
tests/cypress/integration-temporary-disabled/record_listing.spec.bak
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
tests/cypress/integration-temporary-disabled/record_listing.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('As an Admin I want to use record listing', () => { | ||
it('checks that an admin can navigate over the record listing', () => { | ||
cy.login(); | ||
cy.get('a[rel=next]').scrollIntoView(); | ||
cy.get('a[rel=next]').click(); | ||
cy.get('#listing .listing__row .is-details a').should('exist'); | ||
}) | ||
}); |
Oops, something went wrong.