Skip to content

Commit

Permalink
Merge branch 'master' into kris-search-block
Browse files Browse the repository at this point in the history
* master: (34 commits)
  Back to development
  Release 14.0.0-alpha.0
  Prepare for release
  Remove compatibility with older configuration way based on imports (#2516)
  Locking support (#2594)
  Back to development
  Release 13.15.0
  Prepare for release
  feat: add placeholder to wysiwyg widget (#2653)
  chore(i18n): update ita translations (#2652)
  Show loading indicator in listing view when content is loading (#2644)
  Validate touched-only `required` fields in Forms (#2642)
  Get SchemaWidget field factories from backend (#2651)
  Change the batch size of folder content (#2654)
  Show item title and item type when hovering over item title and item type icon in folder content view (#2649)
  Back to development
  Release 13.14.0
  Prepare for release
  cypress: user/groups controlpanel tests (#2650)
  Reimplement the architecture of user/groups controlpanel (#2064)
  ...
  • Loading branch information
sneridagh committed Sep 10, 2021
2 parents d28f43a + ec386e1 commit 24ed239
Show file tree
Hide file tree
Showing 95 changed files with 3,994 additions and 1,623 deletions.
62 changes: 59 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

## 13.12.1 (unreleased)
## 14.0.0 (unreleased)

### Breaking

Expand All @@ -14,6 +14,64 @@

### Internal

## 14.0.0-alpha.0 (2021-09-08)

### Breaking

- Remove compatibility for old configuration (based on imports) system. Migrate your configuration to the new configuration system for your project before upgrading to Volto 14. See https://docs.voltocms.com/upgrade-guide/#volto-configuration-registry @sneridagh
- Content locking is not a breaking change, but it's worth noting that Volto 14 comes with locking support enabled by default. Latest `plone.restapi` versions is required. See https://docs.voltocms.com/upgrade-guide/ for more information

### Feature

- Content locking support for Plone (plone.locking) @avoinea

## 13.15.0 (2021-09-07)

### Feature

- Show item title and item type when hovering over item title and item type icon in folder content view @iFlameing
- Change the batch size of folder content @iFlameing
- Show loading indicator for listing view @iFlameing

### Bugfix

- Validate `required` touched-only fields in Form everywhere @nileshgulia1

### Internal

- Add placeholder to WysiwygWidget @nzambello
- Update italian translations @nzambello
- Get SchemaWidget field factories from backend @avoinea

## 13.14.0 (2021-09-02)

### Feature

- Refactor users and groups controlpanel @nileshgulia1

## 13.13.0 (2021-09-01)

### Feature

- Show version in history view @iFlameing
- Contents shows also array indexes @nzambello

### Bugfix

- Fix SearchWidget required `pathname` @avoinea #2645
- Fix for Contents tag modal @nzambello
- Cut/Copy blocks: fixed cut/copy unselected blocks. @giuliaghisini
- Properly style QueryWidget when used standalone, outside of QuerystringWidget @kreafox
- Add location.search as criteria in `ScrollToTop` component @kreafox
- Scroll to top only if the location pathname changes @kreafox

### Internal

- Disabled all the other configuration options when user did not choose any criteria in listing block @iFlameing
- Updated Brazilian Portuguese translations @ericof
- Footer: Point to plone.org instead of plone.com @ericof
- Array and token widget available as named widget @nzambello

## 13.12.0 (2021-08-20)

### Feature
Expand Down Expand Up @@ -44,8 +102,6 @@
- Upgrade `AsyncSelect` to a version compatible with `react-select` v4 @sneridagh
- Upgrade to latest `react-select` @sneridagh

### Internal

## 13.10.0 (2021-08-18)

### Feature
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ stop-backend-docker-guillotina:

.PHONY: test-acceptance-server
test-acceptance-server:
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.3.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.9.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING

.PHONY: test-acceptance-server-multilingual
test-acceptance-server-multilingual:
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.3.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:multilingual -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.9.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:multilingual -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING

.PHONY: test-acceptance-server-workingcopy
test-acceptance-server-workingcopy:
#docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.3.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.app.iterate:default -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi plone.app.iterate kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
#docker run -i --rm -e ZSERVER_HOST=0.0.0.0 -e ZSERVER_PORT=55001 -p 55001:55001 -e VERSIONS="plone.restapi=8.9.0" -e APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.app.iterate:default -e CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors -e ADDONS='plone.app.robotframework plone.app.contenttypes plone.restapi plone.app.iterate kitconcept.volto' plone ./bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING
ZSERVER_PORT=55001 CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,plone.app.iterate,kitconcept.volto,kitconcept.volto.cors APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,plone.app.iterate:default,kitconcept.volto:default-homepage ./api/bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING

.PHONY: test-acceptance-server-old
Expand Down
4 changes: 2 additions & 2 deletions api/buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ zcml-additional =
allow_methods="DELETE,GET,OPTIONS,PATCH,POST,PUT"
allow_credentials="true"
expose_headers="Content-Length,X-My-Header"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin,Lock-Token"
max_age="3600"
/>
</configure>
Expand Down Expand Up @@ -65,7 +65,7 @@ site-replace = True
[versions]
setuptools =
zc.buildout =
plone.restapi = 8.4.1
plone.restapi = 8.9.0

# p.a.iterate 4 adds support for working copy support
plone.app.iterate = 4.0.1
Expand Down
13 changes: 13 additions & 0 deletions cypress/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function getIfExists(
selector,
successAction = () => {},
failAction = () => {},
) {
cy.get('body').then((body) => {
if (body.find(selector).length > 0 && successAction) {
successAction();
} else if (failAction) {
failAction();
}
});
}
97 changes: 91 additions & 6 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import '@testing-library/cypress/add-commands';

import { getIfExists } from '../helpers';
// --- AUTOLOGIN -------------------------------------------------------------
Cypress.Commands.add('autologin', () => {
Cypress.Commands.add('autologin', (usr, pass) => {
let api_url, user, password;
if (Cypress.env('API') === 'guillotina') {
api_url = 'http://localhost:8081/db/web';
user = 'admin';
password = 'admin';
user = usr || 'admin';
password = pass || 'admin';
} else {
api_url = 'http://localhost:55001/plone';
user = 'admin';
password = 'secret';
user = usr || 'admin';
password = pass || 'secret';
}

return cy
Expand Down Expand Up @@ -164,6 +164,90 @@ Cypress.Commands.add('removeContent', ({ path = '' }) => {
});
});

// --- CREATE USER --------------------------------------------------------
Cypress.Commands.add(
'createUser',
({
username = 'editor',
fullname = 'editor',
email = 'editor@local.dev',
password = 'secret',
roles = ['Editor']
}) => {
let api_url, auth, path;
if (Cypress.env('API') === 'guillotina') {
api_url = 'http://localhost:8081/db/web';
auth = {
user: 'root',
pass: 'root',
};
path = 'users';
} else {
api_url = 'http://localhost:55001/plone';
auth = {
user: 'admin',
pass: 'secret',
};
path = '@users';
}

return cy
.request({
method: 'POST',
url: `${api_url}/${path}`,
headers: {
Accept: 'application/json',
},
auth: auth,
body: {
"@type": "User",
username: username,
fullname: fullname,
email: email,
password: password,
roles: roles
},
})
.then(() => console.log(`User ${username} created`));
},
);

// Remove user
Cypress.Commands.add(
'removeUser',
(
username = 'editor',
) => {
let api_url, auth, path;
if (Cypress.env('API') === 'guillotina') {
api_url = 'http://localhost:8081/db/web';
auth = {
user: 'root',
pass: 'root',
};
path = 'users';
} else {
api_url = 'http://localhost:55001/plone';
auth = {
user: 'admin',
pass: 'secret',
};
path = '@users';
}

return cy
.request({
method: 'DELETE',
url: `${api_url}/${path}/${username}`,
headers: {
Accept: 'application/json',
},
auth: auth,
})
.then(() => console.log(`User ${username} removed`));
},
);

// --- SET WORKFLOW ----------------------------------------------------------
Cypress.Commands.add(
'setWorkflow',
Expand Down Expand Up @@ -362,3 +446,4 @@ Cypress.Commands.add('store', () => {
Cypress.Commands.add('settings', (key, value) => {
return cy.window().its('settings');
});
Cypress.Commands.add('getIfExists', getIfExists);
21 changes: 17 additions & 4 deletions cypress/tests/core/blocks-listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ describe('Listing Block Tests', () => {
cy.get('.blocks-chooser .title').contains('Common').click();
cy.get('.blocks-chooser .common').contains('Listing').click();

//verify before save
cy.get(`.block.listing .listing-body:first-of-type`).contains('Page One');
//******** add Type criteria filter
cy.get('.querystring-widget .fields').contains('Add criteria').click();
cy.get(
'.querystring-widget .fields:first-of-type .field:first-of-type .react-select__menu .react-select__option',
)
.contains('Type')
.click();

//insert Page
cy.get('.querystring-widget .fields:first-of-type > .field').click();
cy.get(
'.querystring-widget .fields:first-of-type > .field .react-select__menu .react-select__option',
)
.contains('Page')
.click();

// set effective date (reverse order)
cy.get('#select-listingblock-sort-on')
Expand All @@ -136,11 +149,11 @@ describe('Listing Block Tests', () => {
cy.get('#toolbar-save').click();

//test after save
cy.get('#page-document .listing-body:first-of-type').contains('Page One');
cy.get('#page-document .listing-body:first-of-type').contains('Page Two');
cy.get('#page-document .listing-item:first-of-type a').should(
'have.attr',
'href',
'/my-page/page-one',
'/my-page/page-two',
);
});

Expand Down
85 changes: 85 additions & 0 deletions cypress/tests/core/groups-controlpanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
describe('Groups Control Panel Test', () => {
beforeEach(() => {
// given a logged in editor
// and a folder that contains a document
// and the folder contents view
cy.visit('/');
cy.autologin();
});
it('Should add a new group to controlPanel', () => {
cy.visit('/controlpanel/groups');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('@groups');
// when I added a group from controlPanel
cy.get('Button[id="toolbar-add"]').click();
cy.get('input[id="field-title"]').clear().type('demo-title');
cy.get('input[id="field-description"]').clear().type('Demo group');
cy.get('input[id ="field-groupname"]').clear().type('uniquename');
cy.get('input[id="field-email"]').clear().type('test@gmail.com');
cy.get('button[title="Save"]').click(-50, -50, { force: true });

// then the group section must contains a groupname when I searched the
// same with the same groupname
cy.get('input[id="group-search-input"]').clear().type('uni');
cy.get('.icon.button:first').click();
cy.get('tr td').first().should('have.text', 'uniquename');
});

it('Should show error from backend when add Group fails', () => {
cy.intercept('POST', '**groups', {
statusCode: 400,
body: {
message: 'Error from backend.',
},
}).as('saveGroup');
cy.visit('/controlpanel/groups');
// when I added a group from controlPanel
cy.get('Button[id="toolbar-add"]').click();
cy.get('input[id="field-title"]').clear().type('demo-title');
cy.get('input[id="field-description"]').clear().type('Demo group');
cy.get('input[id ="field-groupname"]').clear().type('uniquename');
cy.get('input[id="field-email"]').clear().type('test@gmail.com');
cy.get('button[title="Save"]').click(-50, -50, { force: true });
cy.wait('@saveGroup').then((intercepted) => {
cy.contains(intercepted.response.body.message);
});
});

it('Should delete a group from controlPanel', () => {
cy.visit('/controlpanel/groups');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('@groups');

// select first group with name, delete it and search if its exists or not!
cy.get('div[role="listbox"]').first().click();
cy.get('div[role="option"]').first().click();
cy.contains('Delete Group');
cy.get('button.ui.primary.button').should('have.text', 'OK').click();
cy.get('input[id="group-search-input"]').clear().type('Administrators');
cy.get('.icon.button:first').click();
cy.getIfExists('.groupname').should('not.have.text', 'Administrators');
});

it('Should update group roles', () => {
cy.visit('/controlpanel/groups');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');

cy.get('[data-group="groups"] input[type="checkbox"')
.first()
.check({ force: true });
cy.get('Button[id="toolbar-save"]').click();
cy.reload();
cy.get('[data-group="groups"] div.checkbox')
.first()
.should('have.class', 'checked');
});
});
Loading

0 comments on commit 24ed239

Please sign in to comment.