1+ /**
2+ * @file cypress/tests/integration/configuration.cy.js
3+ *
4+ * Copyright (c) 2022 OPTIMETA project
5+ * Copyright (c) 2022 Daniel Nüst
6+ * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
7+ *
8+ */
9+
10+ describe ( 'OPTIMETA Geo Plugin Submission with incomplete Metadata' , function ( ) {
11+
12+ beforeEach ( ( ) => {
13+ cy . login ( 'aauthor' ) ;
14+ cy . get ( 'a:contains("aauthor")' ) . click ( ) ;
15+ cy . get ( 'a:contains("Dashboard")' ) . click ( { force : true } ) ;
16+ } ) ;
17+
18+ it ( 'Has no information on time period if it is missing' , function ( ) {
19+ var submission = {
20+ title : 'Vancouver has no time' ,
21+ subtitle : 'No no no' ,
22+ abstract : 'The city of Vancouver is timeless.' ,
23+ issue : '1' ,
24+ timePeriod : null
25+ } ;
26+
27+ cy . createSubmissionAndPublish ( submission ) ;
28+
29+ // go to journal index and check there is no map
30+ cy . visit ( '/' ) ;
31+ cy . get ( 'nav[class="pkp_site_nav_menu"] a:contains("Current")' ) . click ( ) ;
32+ cy . get ( 'a:contains("Vancouver has no time")' ) . last ( ) . click ( ) ;
33+
34+ cy . get ( '#optimeta_article_temporal' ) . should ( 'not.be.visible' ) ;
35+ cy . get ( '#optimeta_article_spatial_download' ) . should ( 'be.visible' ) ;
36+ cy . get ( '#mapdiv' ) . should ( 'be.visible' ) ;
37+ cy . get ( '#optimeta_article_administrativeUnit' ) . should ( 'not.be.visible' ) ;
38+ } ) ;
39+
40+ it ( 'Has no information on location if it is missing' , function ( ) {
41+ var submission = {
42+ title : 'Vancouver has no place' ,
43+ subtitle : 'No no no' ,
44+ abstract : 'The city of Vancouver is lost.' ,
45+ issue : '1' ,
46+ timePeriod : '2000-02-20 - 2000-02-22' ,
47+ spatial : null
48+ } ;
49+
50+ cy . createSubmissionAndPublish ( submission ) ;
51+
52+ // go to journal index and check there is no map
53+ cy . visit ( '/' ) ;
54+ cy . get ( 'nav[class="pkp_site_nav_menu"] a:contains("Current")' ) . click ( ) ;
55+ cy . get ( 'a:contains("Vancouver has no place")' ) . last ( ) . click ( ) ;
56+
57+ cy . get ( '.pkp_structure_main' ) . should ( 'contain' , 'Time and location' ) ;
58+ cy . get ( '.pkp_structure_main' ) . should ( 'contain' , '2000-02-22' ) ;
59+ cy . get ( '#optimeta_article_spatial' ) . should ( 'not.be.visible' ) ;
60+ cy . get ( '#optimeta_article_spatial_download' ) . should ( 'not.be.visible' ) ;
61+ cy . get ( '#mapdiv' ) . should ( 'not.be.visible' ) ;
62+ cy . get ( '#optimeta_article_administrativeUnit' ) . should ( 'not.be.visible' ) ;
63+ } ) ;
64+
65+ it ( 'Has only administrative unit' , function ( ) {
66+ var submission = {
67+ title : 'Vancouver has a region' ,
68+ subtitle : 'No no no' ,
69+ abstract : 'The city of Vancouver is part of something.' ,
70+ issue : '1' ,
71+ timePeriod : null ,
72+ spatial : null ,
73+ adminUnit : 'Oh Canada{enter}'
74+ } ;
75+
76+ cy . createSubmissionAndPublish ( submission ) ;
77+
78+ // go to journal index and check there is no map
79+ cy . visit ( '/' ) ;
80+ cy . get ( 'nav[class="pkp_site_nav_menu"] a:contains("Current")' ) . click ( ) ;
81+ cy . get ( 'a:contains("Vancouver has a region")' ) . last ( ) . click ( ) ;
82+
83+ cy . get ( '.pkp_structure_main' ) . should ( 'contain' , 'Oh Canada' ) ;
84+ cy . get ( '#optimeta_article_temporal' ) . should ( 'not.be.visible' ) ;
85+ cy . get ( '#optimeta_article_spatial' ) . should ( 'not.be.visible' ) ;
86+ cy . get ( '#optimeta_article_spatial_download' ) . should ( 'not.be.visible' ) ;
87+ cy . get ( '#mapdiv' ) . should ( 'not.be.visible' ) ;
88+ } ) ;
89+
90+ it ( 'Has no Time and location and no geodata download if all geospatial metadata is missing' , function ( ) {
91+ var submission = {
92+ title : 'Vancouver has nothing' ,
93+ subtitle : 'No no no' ,
94+ abstract : 'The city of Vancouver is gone.' ,
95+ issue : '1' ,
96+ timePeriod : null ,
97+ spatial : null
98+ } ;
99+
100+ cy . createSubmissionAndPublish ( submission ) ;
101+
102+ // go to journal index and check there is no map
103+ cy . visit ( '/' ) ;
104+ cy . get ( 'nav[class="pkp_site_nav_menu"] a:contains("Current")' ) . click ( ) ;
105+ cy . get ( 'a:contains("Vancouver has nothing")' ) . last ( ) . click ( ) ;
106+
107+ cy . get ( '#optimeta_article_geospatialmetadata' ) . should ( 'not.be.visible' ) ;
108+ cy . get ( '#optimeta_article_temporal' ) . should ( 'not.be.visible' ) ;
109+ cy . get ( '#optimeta_article_spatial' ) . should ( 'not.be.visible' ) ;
110+ cy . get ( '#optimeta_article_spatial_download' ) . should ( 'not.be.visible' ) ;
111+ cy . get ( '#mapdiv' ) . should ( 'not.be.visible' ) ;
112+ cy . get ( '#optimeta_article_administrativeUnit' ) . should ( 'not.be.visible' ) ;
113+ } ) ;
114+
115+ } ) ;
0 commit comments