@eeacms/volto-tableau 6.0.5 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/Jenkinsfile +6 -1
- package/Makefile +2 -4
- package/cypress/e2e/block-tableau.cy.js +45 -0
- package/cypress/support/commands.js +40 -2
- package/cypress/support/e2e.js +4 -4
- package/package.json +1 -1
- package/src/Blocks/EmbedTableauVisualization/View.jsx +32 -27
- package/src/Blocks/EmbedTableauVisualization/View.test.jsx +3 -2
- package/src/Blocks/EmbedTableauVisualization/__snapshots__/View.test.jsx.snap +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [6.0.6](https://github.com/eea/volto-tableau/compare/6.0.5...6.0.6) - 17 November 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: clean up [Miu Razvan - [`73ff5c0`](https://github.com/eea/volto-tableau/commit/73ff5c0f61c947067006cecf3bd3ad003249d78c)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- tests: add cypress for tableau [nileshgulia1 - [`6eca683`](https://github.com/eea/volto-tableau/commit/6eca6834b85cdab4ed82367fee32fdbbb35b0f5e)]
|
|
16
|
+
- tests: update unit tests [nileshgulia1 - [`96cae09`](https://github.com/eea/volto-tableau/commit/96cae09eab2e737f032c97eb401a3efa88e68ec6)]
|
|
17
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`c7e81cb`](https://github.com/eea/volto-tableau/commit/c7e81cb0768f755dd4107a4998253d9bccc33809)]
|
|
18
|
+
- comment test [Miu Razvan - [`a459525`](https://github.com/eea/volto-tableau/commit/a459525fdccf8ee61651d4cb2e04eb253e841c61)]
|
|
7
19
|
### [6.0.5](https://github.com/eea/volto-tableau/compare/6.0.4...6.0.5) - 15 November 2023
|
|
8
20
|
|
|
9
21
|
#### :rocket: New Features
|
package/Jenkinsfile
CHANGED
|
@@ -159,7 +159,8 @@ pipeline {
|
|
|
159
159
|
script {
|
|
160
160
|
try {
|
|
161
161
|
sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend'''
|
|
162
|
-
sh '''
|
|
162
|
+
sh '''docker run -d --shm-size=3g --link $IMAGE_NAME-plone:plone --name="$IMAGE_NAME-cypress" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend start-ci'''
|
|
163
|
+
sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress make cypress-ci'''
|
|
163
164
|
} finally {
|
|
164
165
|
try {
|
|
165
166
|
sh '''rm -rf cypress-videos cypress-results cypress-coverage cypress-screenshots'''
|
|
@@ -189,6 +190,10 @@ pipeline {
|
|
|
189
190
|
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
190
191
|
junit testResults: 'cypress-results/**/*.xml', allowEmptyResults: true
|
|
191
192
|
}
|
|
193
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
194
|
+
sh '''docker logs $IMAGE_NAME-cypress'''
|
|
195
|
+
}
|
|
196
|
+
sh script: "docker stop $IMAGE_NAME-cypress", returnStatus: true
|
|
192
197
|
sh script: "docker stop $IMAGE_NAME-plone", returnStatus: true
|
|
193
198
|
sh script: "docker rm -v $IMAGE_NAME-plone", returnStatus: true
|
|
194
199
|
sh script: "docker rm -v $IMAGE_NAME-cypress", returnStatus: true
|
package/Makefile
CHANGED
|
@@ -151,14 +151,12 @@ test-ci:
|
|
|
151
151
|
|
|
152
152
|
.PHONY: start-ci
|
|
153
153
|
start-ci:
|
|
154
|
+
cp .coverage.babel.config.js /app/babel.config.js
|
|
154
155
|
cd ../..
|
|
155
|
-
yarn start
|
|
156
|
+
yarn start
|
|
156
157
|
|
|
157
158
|
.PHONY: cypress-ci
|
|
158
159
|
cypress-ci:
|
|
159
|
-
cp .coverage.babel.config.js /app/babel.config.js
|
|
160
|
-
make start-ci
|
|
161
160
|
$(NODE_MODULES)/.bin/wait-on -t 240000 http://localhost:3000
|
|
162
161
|
NODE_ENV=development make cypress-run
|
|
163
162
|
|
|
164
|
-
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { slateAfterEach } from '../support/e2e';
|
|
2
|
+
|
|
3
|
+
describe('Blocks Tests', () => {
|
|
4
|
+
beforeEach((contentType = 'Document') => {
|
|
5
|
+
cy.intercept('GET', `/**/*?expand*`).as('content');
|
|
6
|
+
cy.intercept('GET', '/**/Document').as('schema');
|
|
7
|
+
cy.autologin();
|
|
8
|
+
cy.createContent({
|
|
9
|
+
contentType: 'Document',
|
|
10
|
+
contentId: 'cypress',
|
|
11
|
+
contentTitle: 'Cypress',
|
|
12
|
+
});
|
|
13
|
+
cy.createContent({
|
|
14
|
+
contentType: contentType,
|
|
15
|
+
contentId: 'my-page',
|
|
16
|
+
contentTitle: 'My Page',
|
|
17
|
+
path: 'cypress',
|
|
18
|
+
});
|
|
19
|
+
cy.visit('/cypress/my-page');
|
|
20
|
+
// cy.waitForResourceToLoad('@navigation');
|
|
21
|
+
// cy.waitForResourceToLoad('@breadcrumbs');
|
|
22
|
+
// cy.waitForResourceToLoad('@actions');
|
|
23
|
+
// cy.waitForResourceToLoad('@types');
|
|
24
|
+
cy.waitForResourceToLoad('my-page');
|
|
25
|
+
cy.navigate('/cypress/my-page/edit');
|
|
26
|
+
});
|
|
27
|
+
afterEach(slateAfterEach);
|
|
28
|
+
|
|
29
|
+
it('Add Tableau block', () => {
|
|
30
|
+
// when I add a maps block
|
|
31
|
+
cy.addNewBlock('tableau');
|
|
32
|
+
|
|
33
|
+
cy.get(`.sidebar-container .field-wrapper-url #field-url`).type(
|
|
34
|
+
'https://tableau-public.discomap.eea.europa.eu/views/GHGProjections/Dashboard1&:jsdebug=n',
|
|
35
|
+
);
|
|
36
|
+
cy.get('#toolbar-save').click();
|
|
37
|
+
cy.wait('@content');
|
|
38
|
+
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
|
|
39
|
+
|
|
40
|
+
// then the page view should contain the maps block
|
|
41
|
+
cy.get('#page-document iframe')
|
|
42
|
+
.should('have.attr', 'src')
|
|
43
|
+
.and('match', /\/\/tableau-public.discomap.eea.europa.eu\//);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -71,8 +71,7 @@ Cypress.Commands.add(
|
|
|
71
71
|
id: contentId,
|
|
72
72
|
title: contentTitle,
|
|
73
73
|
image: {
|
|
74
|
-
data:
|
|
75
|
-
'iVBORw0KGgoAAAANSUhEUgAAANcAAAA4CAMAAABZsZ3QAAAAM1BMVEX29fK42OU+oMvn7u9drtIPisHI4OhstdWZyt4fkcXX5+sAg74umMhNp86p0eJ7vNiKw9v/UV4wAAAAAXRSTlMAQObYZgAABBxJREFUeF7tmuty4yAMhZG4X2zn/Z92J5tsBJwWXG/i3XR6frW2Y/SBLIRAfaQUDNt8E5tLUt9BycfcKfq3R6Mlfyimtx4rzp+K3dtibXkor99zsEqLYZltblTecciogoh+TXfY1Ve4dn07rCDGG9dHSEEOg/GmXl0U1XDxTKxNK5De7BxsyyBr6gGm2/vPxKJ8F6f7BXKfRMp1xIWK9A+5ks25alSb353dWnDJN1k35EL5f8dVGifTf/4tjUuuFq7u4srmXC60yAmldLXIWbg65RKU87lcGxJCFqUPv0IacW0PmSivOZFLE908inPToMmii/roG+MRV/O8FU88i8tFsxV3a06MFUw0Qu7RmAtdV5/HVVaOVMTWNOWSwMljLhzhcB6XIS7OK5V6AvRDNN7t5VJWQs1J40UmalbK56usBG/CuC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n788BDvQuG4TDtdtUPvzjSlXAB8DvaDOhhrmhwbywylXAm8CvaouikJTL93gs3y7Yy4VYbIxOHrcMizPqWOjqO9l3Uz52kibQy4xxOgqhJvD+w5rvokOcAlGvNCfeqCv1ste1stzLm0f71Iq3ZfTrPfuE5nhPtF+LvQE2lffQC7pYtQy3tdzdrKvd5TLVVzDetScS3nEKmmwDyt1Cev1kX3YfbvzNK4fzrlw+cB6vm+uiUgf2zdXI62241LawCb7Pi5FXFPF8KpzDoF/Sw2lg+GrHNbno1mhPu+VCF/vfMnw06PnUl6j48dVHD3jHNHPua+fc3o/5yp/zsGi0vYtzi3Pz5mHd4T6BWMIlewacd63AAAAAElFTkSuQmCC',
|
|
76
75
|
encoding: 'base64',
|
|
77
76
|
filename: 'image.png',
|
|
78
77
|
'content-type': 'image/png',
|
|
@@ -535,3 +534,42 @@ Cypress.Commands.add(
|
|
|
535
534
|
});
|
|
536
535
|
},
|
|
537
536
|
);
|
|
537
|
+
|
|
538
|
+
Cypress.Commands.add('addNewBlock', (blockName, createNewSlate = false) => {
|
|
539
|
+
let block;
|
|
540
|
+
block = cy.getSlate(createNewSlate).type(`/${blockName}{enter}`);
|
|
541
|
+
return block;
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
Cypress.Commands.add('getSlate', (createNewSlate = false) => {
|
|
545
|
+
let slate;
|
|
546
|
+
if (createNewSlate) {
|
|
547
|
+
cy.get('.block.inner').last().type('{moveToEnd}{enter}');
|
|
548
|
+
}
|
|
549
|
+
cy.getIfExists(
|
|
550
|
+
SLATE_SELECTOR,
|
|
551
|
+
() => {
|
|
552
|
+
slate = cy.get(SLATE_SELECTOR).last();
|
|
553
|
+
},
|
|
554
|
+
() => {
|
|
555
|
+
slate = cy.get(SLATE_SELECTOR, { timeout: 10000 }).last();
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
return slate;
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
function getIfExists(
|
|
562
|
+
selector,
|
|
563
|
+
successAction = () => {},
|
|
564
|
+
failAction = () => {},
|
|
565
|
+
) {
|
|
566
|
+
cy.get('body').then((body) => {
|
|
567
|
+
if (body.find(selector).length > 0 && successAction) {
|
|
568
|
+
successAction();
|
|
569
|
+
} else if (failAction) {
|
|
570
|
+
failAction();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
Cypress.Commands.add('getIfExists', getIfExists);
|
package/cypress/support/e2e.js
CHANGED
|
@@ -35,10 +35,10 @@ export const slateBeforeEach = (contentType = 'Document') => {
|
|
|
35
35
|
path: 'cypress',
|
|
36
36
|
});
|
|
37
37
|
cy.visit('/cypress/my-page');
|
|
38
|
-
cy.waitForResourceToLoad('@navigation');
|
|
39
|
-
cy.waitForResourceToLoad('@breadcrumbs');
|
|
40
|
-
cy.waitForResourceToLoad('@actions');
|
|
41
|
-
cy.waitForResourceToLoad('@types');
|
|
38
|
+
// cy.waitForResourceToLoad('@navigation');
|
|
39
|
+
// cy.waitForResourceToLoad('@breadcrumbs');
|
|
40
|
+
// cy.waitForResourceToLoad('@actions');
|
|
41
|
+
// cy.waitForResourceToLoad('@types');
|
|
42
42
|
cy.waitForResourceToLoad('my-page');
|
|
43
43
|
cy.navigate('/cypress/my-page/edit');
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
3
|
import { compose } from 'redux';
|
|
4
|
+
import { Message } from 'semantic-ui-react';
|
|
4
5
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
5
6
|
import { getContent } from '@plone/volto/actions';
|
|
6
7
|
import { PrivacyProtection } from '@eeacms/volto-embed';
|
|
@@ -29,39 +30,43 @@ const View = (props) => {
|
|
|
29
30
|
// eslint-disable-next-line
|
|
30
31
|
}, [tableau_vis_url]);
|
|
31
32
|
|
|
33
|
+
if (props.mode === 'edit' && !tableau_vis_url) {
|
|
34
|
+
return (
|
|
35
|
+
<Message>
|
|
36
|
+
Please select a tableau visualization from block editor.
|
|
37
|
+
</Message>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (props.mode === 'edit' && !tableau_visualization?.url) {
|
|
42
|
+
return <Message>Url is not set in the visualization</Message>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!tableau_visualization?.url) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
32
49
|
return (
|
|
33
50
|
<div className="embed-tableau">
|
|
34
51
|
<PrivacyProtection
|
|
35
52
|
{...props}
|
|
36
53
|
data={{ ...data, url: tableau_visualization?.url }}
|
|
37
54
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
with_download,
|
|
54
|
-
with_share,
|
|
55
|
-
with_enlarge,
|
|
56
|
-
tableau_height,
|
|
57
|
-
tableau_vis_url,
|
|
58
|
-
}}
|
|
59
|
-
figure_note={figure_note}
|
|
60
|
-
sources={data_provenance.data || []}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
</>
|
|
64
|
-
)}
|
|
55
|
+
<Tableau
|
|
56
|
+
data={{
|
|
57
|
+
...tableau_visualization,
|
|
58
|
+
with_notes,
|
|
59
|
+
with_sources,
|
|
60
|
+
with_more_info,
|
|
61
|
+
with_download,
|
|
62
|
+
with_share,
|
|
63
|
+
with_enlarge,
|
|
64
|
+
tableau_height,
|
|
65
|
+
tableau_vis_url,
|
|
66
|
+
}}
|
|
67
|
+
figure_note={figure_note}
|
|
68
|
+
sources={data_provenance.data || []}
|
|
69
|
+
/>
|
|
65
70
|
</PrivacyProtection>
|
|
66
71
|
</div>
|
|
67
72
|
);
|
|
@@ -34,11 +34,12 @@ describe('View', () => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
it('should render the component', () => {
|
|
37
|
-
const {
|
|
37
|
+
const { asFragment } = render(
|
|
38
38
|
<Provider store={store}>
|
|
39
39
|
<View data={data} />
|
|
40
40
|
</Provider>,
|
|
41
41
|
);
|
|
42
|
-
expect(
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
43
|
+
//expect(container.querySelector('.embed-tableau')).toBeInTheDocument();
|
|
43
44
|
});
|
|
44
45
|
});
|