@@ -11,17 +11,11 @@ describe('ImportStudiesDialog', () => {
1111 } ) ;
1212
1313 it ( 'should load the page' , ( ) => {
14- cy . login ( 'mocked' )
15- . visit ( '/projects/abc123/curation' )
16- . wait ( '@projectFixture' )
17- . wait ( '@studysetFixture' ) ;
14+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
1815 } ) ;
1916
2017 it ( 'should open the import studies dialog' , ( ) => {
21- cy . login ( 'mocked' )
22- . visit ( '/projects/abc123/curation' )
23- . wait ( '@projectFixture' )
24- . wait ( '@studysetFixture' ) ;
18+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
2519 cy . contains ( 'button' , 'import studies' ) . click ( ) ;
2620 cy . get ( '.MuiFormControl-root' ) . should ( 'be.visible' ) ;
2721 cy . url ( ) . should ( 'include' , '/projects/abc123/curation/import' ) ;
@@ -49,32 +43,27 @@ describe('ImportStudiesDialog', () => {
4943 cy . contains (
5044 'button' ,
5145 `Import ${ baseStudiesResponse . response ?. body ?. results ?. length } studies from neurostore`
52- ) . click ( ) ;
46+ ) . should ( 'be.disabled' ) ;
5347 } ) ;
54- cy . contains ( 'button' , 'next' ) . should ( 'be.disabled' ) ;
5548 } ) ;
5649
5750 it ( 'should import studies' , ( ) => {
51+ cy . get ( 'input[type="text"]' ) . type ( 'neuron' ) ;
52+ cy . get ( 'button' ) . contains ( 'Search' ) . click ( ) ;
5853 cy . wait ( '@baseStudiesFixture' ) . then ( ( baseStudiesResponse ) => {
5954 cy . contains (
6055 'button' ,
6156 `Import ${ baseStudiesResponse . response ?. body ?. results ?. length } studies from neurostore`
6257 ) . click ( ) ;
6358 } ) ;
6459 cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
65- cy . contains ( 'button' , 'next' )
66- . click ( )
67- . url ( )
68- . should ( 'include' , '/projects/abc123/curation' ) ;
60+ cy . contains ( 'button' , 'next' ) . click ( ) . url ( ) . should ( 'include' , '/projects/abc123/curation' ) ;
6961 } ) ;
7062 } ) ;
7163
7264 describe ( 'Import via Pubmed IDs' , ( ) => {
7365 beforeEach ( ( ) => {
74- cy . login ( 'mocked' )
75- . visit ( '/projects/abc123/curation' )
76- . wait ( '@projectFixture' )
77- . wait ( '@studysetFixture' ) ;
66+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
7867 cy . intercept ( 'PUT' , '**/api/projects/abc123' ) . as ( 'updateProjectFixture' ) ;
7968 // not going to mock this for now as cypress does not seem to support XML fixtures
8069 // cy.intercept('POST', 'https://eutils.ncbi.nlm.nih.gov/**', {
@@ -86,9 +75,7 @@ describe('ImportStudiesDialog', () => {
8675 } ) ;
8776
8877 it ( 'should show the pmid input page' , ( ) => {
89- cy . get (
90- 'textarea[placeholder="Enter list of pubmed IDs separated by a newline"]'
91- ) . should ( 'be.visible' ) ;
78+ cy . get ( 'textarea[placeholder="Enter list of pubmed IDs separated by a newline"]' ) . should ( 'be.visible' ) ;
9279 } ) ;
9380
9481 it ( 'should be disabled initially' , ( ) => {
@@ -116,10 +103,7 @@ describe('ImportStudiesDialog', () => {
116103 . type ( '123{enter}456{enter}789' ) ;
117104 cy . contains ( 'button' , 'next' ) . click ( ) ;
118105 cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
119- cy . contains ( 'button' , 'next' )
120- . click ( )
121- . url ( )
122- . should ( 'include' , '/projects/abc123/curation' ) ;
106+ cy . contains ( 'button' , 'next' ) . click ( ) . url ( ) . should ( 'include' , '/projects/abc123/curation' ) ;
123107 } ) ;
124108
125109 it ( 'should import studies via a file' , ( ) => {
@@ -130,10 +114,7 @@ describe('ImportStudiesDialog', () => {
130114
131115 describe ( 'Manually create a new study' , ( ) => {
132116 beforeEach ( ( ) => {
133- cy . login ( 'mocked' )
134- . visit ( '/projects/abc123/curation' )
135- . wait ( '@projectFixture' )
136- . wait ( '@studysetFixture' ) ;
117+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
137118 cy . intercept ( 'PUT' , '**/api/projects/abc123' ) . as ( 'updateProjectFixture' ) ;
138119 cy . contains ( 'button' , 'import studies' ) . click ( ) ;
139120 cy . contains ( 'Manually create a new study' ) . click ( ) ;
@@ -170,19 +151,13 @@ describe('ImportStudiesDialog', () => {
170151 cy . contains ( 'li' , 'Neurostore' ) . click ( ) ;
171152 cy . contains ( 'button' , 'next' ) . click ( ) ;
172153 cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
173- cy . contains ( 'button' , 'next' )
174- . click ( )
175- . url ( )
176- . should ( 'include' , '/projects/abc123/curation' ) ;
154+ cy . contains ( 'button' , 'next' ) . click ( ) . url ( ) . should ( 'include' , '/projects/abc123/curation' ) ;
177155 } ) ;
178156 } ) ;
179157
180158 describe ( 'Import via File Format' , ( ) => {
181159 beforeEach ( ( ) => {
182- cy . login ( 'mocked' )
183- . visit ( '/projects/abc123/curation' )
184- . wait ( '@projectFixture' )
185- . wait ( '@studysetFixture' ) ;
160+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
186161 cy . intercept ( 'PUT' , '**/api/projects/abc123' ) . as ( 'updateProjectFixture' ) ;
187162 cy . contains ( 'button' , 'import studies' ) . click ( ) ;
188163 cy . contains ( 'Import via File Format' ) . click ( ) ;
@@ -222,9 +197,7 @@ describe('ImportStudiesDialog', () => {
222197 it ( 'should show an error message' , ( ) => {
223198 cy . get ( 'input[role="combobox"]' ) . click ( ) ;
224199 cy . contains ( 'li' , 'Scopus' ) . click ( ) ;
225- cy . get ( 'textarea[placeholder="paste in valid endnote, bibtex, or RIS syntax"]' ) . type (
226- 'INVALID FORMAT'
227- ) ;
200+ cy . get ( 'textarea[placeholder="paste in valid endnote, bibtex, or RIS syntax"]' ) . type ( 'INVALID FORMAT' ) ;
228201 cy . contains ( / F o r m a t i s i n c o r r e c t / ) . should ( 'be.visible' ) ;
229202 } ) ;
230203
@@ -242,18 +215,13 @@ describe('ImportStudiesDialog', () => {
242215
243216 cy . contains ( 'button' , 'next' ) . click ( ) ;
244217 cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
245- cy . contains ( 'button' , 'next' )
246- . click ( )
247- . url ( )
248- . should ( 'include' , '/projects/abc123/curation' ) ;
218+ cy . contains ( 'button' , 'next' ) . click ( ) . url ( ) . should ( 'include' , '/projects/abc123/curation' ) ;
249219 } ) ;
250220
251221 it ( 'should upload a onenote (ENW) file' , ( ) => {
252222 cy . get ( 'input[role="combobox"]' ) . click ( ) ;
253223 cy . contains ( 'li' , 'Scopus' ) . click ( ) ;
254- cy . get ( 'label[role="button"]' ) . selectFile (
255- 'cypress/fixtures/standardFiles/onenoteStudies.txt'
256- ) ;
224+ cy . get ( 'label[role="button"]' ) . selectFile ( 'cypress/fixtures/standardFiles/onenoteStudies.txt' ) ;
257225 cy . contains ( 'button' , 'next' ) . should ( 'be.visible' ) ;
258226 } ) ;
259227
@@ -264,49 +232,6 @@ describe('ImportStudiesDialog', () => {
264232 // it('should import studies via a file', () => {})
265233 } ) ;
266234
267- describe ( 'IMPORT DUPLICATES' , ( ) => {
268- beforeEach ( ( ) => {
269- cy . login ( 'mocked' )
270- . visit ( '/projects/abc123/curation' )
271- . wait ( '@projectFixture' )
272- . wait ( '@studysetFixture' ) ;
273- cy . intercept ( 'PUT' , '**/api/projects/abc123' ) . as ( 'updateProjectFixture' ) ;
274- cy . contains ( 'button' , 'import studies' ) . click ( ) ;
275- cy . contains ( 'Import via File Format' ) . click ( ) ;
276- cy . contains ( 'button' , 'next' ) . click ( ) ;
277-
278- cy . get ( 'input[role="combobox"' ) . click ( ) ;
279- cy . contains ( 'li' , 'Scopus' ) . click ( ) ;
280- } ) ;
281-
282- it ( 'should show the resolve duplicates page' , ( ) => {
283- cy . get ( 'label[role="button"]' ) . selectFile (
284- 'cypress/fixtures/standardFiles/onenoteStudiesDuplicates.txt'
285- ) ;
286- cy . contains ( 'button' , 'next' ) . click ( ) ;
287- cy . contains ( 'Duplicates were found in your import file' ) . should ( 'be.visible' ) ;
288- cy . contains ( 'button' , 'next' ) . should ( 'be.disabled' ) ;
289- } ) ;
290-
291- it ( 'should resolve all cases' , ( ) => {
292- cy . get ( 'label[role="button"]' ) . selectFile (
293- 'cypress/fixtures/standardFiles/onenoteStudiesDuplicates.txt'
294- ) ;
295- cy . contains ( 'button' , 'next' ) . click ( ) ;
296- cy . contains ( 'button' , 'Keep this study' ) . first ( ) . click ( ) ;
297- cy . contains ( 'button' , 'next' ) . should ( 'not.be.disabled' ) ;
298- } ) ;
299-
300- it ( 'should mark one case as duplicate' , ( ) => {
301- cy . get ( 'label[role="button"]' ) . selectFile (
302- 'cypress/fixtures/standardFiles/onenoteStudiesDuplicates.txt'
303- ) ;
304- cy . contains ( 'button' , 'next' ) . click ( ) ;
305- cy . contains ( 'button' , 'This is a duplicate' ) . first ( ) . click ( ) ;
306- cy . contains ( 'button' , 'next' ) . should ( 'be.disabled' ) ;
307- } ) ;
308- } ) ;
309-
310235 describe ( 'PROJECT DUPLICATES' , ( ) => {
311236 beforeEach ( ( ) => {
312237 cy . intercept ( 'GET' , `**/api/projects/*` , {
@@ -316,10 +241,7 @@ describe('ImportStudiesDialog', () => {
316241 cy . intercept ( 'PUT' , '**/api/projects/**' , { fixture : 'projects/projectWithStub' } ) . as (
317242 'updateProjectFixture'
318243 ) ;
319- cy . login ( 'mocked' )
320- . visit ( '/projects/abc123/curation' )
321- . wait ( '@projectFixture' )
322- . wait ( '@studysetFixture' ) ;
244+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
323245 cy . contains ( 'button' , 'import studies' ) . click ( ) ;
324246 cy . contains ( 'Import via File Format' ) . click ( ) ;
325247 cy . contains ( 'button' , 'next' ) . click ( ) ;
@@ -328,28 +250,13 @@ describe('ImportStudiesDialog', () => {
328250 cy . contains ( 'li' , 'Scopus' ) . click ( ) ;
329251 } ) ;
330252
331- it ( 'should show the resolve duplicates page if there are duplicates IN THE PROJECT' , ( ) => {
332- cy . get ( 'label[role="button"]' ) . selectFile (
333- 'cypress/fixtures/standardFiles/onenoteStudies.txt'
334- ) ;
335-
336- cy . contains ( 'button' , 'next' ) . click ( ) ;
337- cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
338- cy . contains ( 'button' , 'next' ) . click ( ) ;
339- cy . contains ( / d u p l i c a t e s t h a t a l r e a d y e x i s t w i t h i n t h e p r o j e c t / ) . should ( 'be.visible' ) ;
340- cy . contains ( 'button' , 'next' ) . should ( 'be.disabled' ) ;
341- } ) ;
342-
343- it ( 'should resolve all cases' , ( ) => {
344- cy . get ( 'label[role="button"]' ) . selectFile (
345- 'cypress/fixtures/standardFiles/onenoteStudies.txt'
346- ) ;
253+ it ( 'should show the resolve duplicates popup' , ( ) => {
254+ cy . get ( 'label[role="button"]' ) . selectFile ( 'cypress/fixtures/standardFiles/onenoteStudies.txt' ) ;
347255
348256 cy . contains ( 'button' , 'next' ) . click ( ) ;
349257 cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
350258 cy . contains ( 'button' , 'next' ) . click ( ) ;
351- cy . contains ( 'button' , 'Keep this study' ) . first ( ) . click ( ) ;
352- cy . contains ( 'button' , 'next' ) . should ( 'be.enabled' ) ;
259+ cy . contains ( / S o m e d u p l i c a t e s w e r e d e t e c t e d / ) . should ( 'be.visible' ) ;
353260 } ) ;
354261 } ) ;
355262
@@ -359,34 +266,22 @@ describe('ImportStudiesDialog', () => {
359266 fixture : 'baseStudies/baseStudiesWithResults' ,
360267 } ) . as ( 'baseStudiesFixture' ) ;
361268 cy . intercept ( 'PUT' , '**/api/projects/abc123' ) . as ( 'updateProjectFixture' ) ;
362- cy . login ( 'mocked' )
363- . visit ( '/projects/abc123/curation' )
364- . wait ( '@projectFixture' )
365- . wait ( '@studysetFixture' ) ;
269+ cy . login ( 'mocked' ) . visit ( '/projects/abc123/curation' ) . wait ( '@projectFixture' ) . wait ( '@studysetFixture' ) ;
366270 cy . contains ( 'button' , 'import studies' ) . click ( ) ;
367271 cy . contains ( 'button' , 'next' ) . click ( ) ;
368272 } ) ;
369273
370- it ( 'should select the import by clicking the option' , ( ) => {
274+ it ( 'should enter the import name based on the search and typed text' , ( ) => {
275+ cy . get ( 'input[type="text"]' ) . type ( 'neuron' ) ;
276+ cy . get ( 'button' ) . contains ( 'Search' ) . click ( ) ;
371277 cy . wait ( '@baseStudiesFixture' ) . then ( ( baseStudiesResponse ) => {
372278 cy . contains (
373279 'button' ,
374280 `Import ${ baseStudiesResponse . response ?. body ?. results ?. length } studies from neurostore`
375281 ) . click ( ) ;
376282 } ) ;
377- cy . get ( 'input' ) . type ( 'my new import' ) ;
378- cy . contains ( 'Set name as "my new import"' ) . click ( ) ;
379- cy . contains ( 'button' , 'next' ) . should ( 'not.be.disabled' ) ;
380- } ) ;
381-
382- it ( 'should select the import by pressing enter' , ( ) => {
383- cy . wait ( '@baseStudiesFixture' ) . then ( ( baseStudiesResponse ) => {
384- cy . contains (
385- 'button' ,
386- `Import ${ baseStudiesResponse . response ?. body ?. results ?. length } studies from neurostore`
387- ) . click ( ) ;
388- } ) ;
389- cy . get ( 'input' ) . type ( 'my new import{enter}' ) ;
283+ cy . get ( 'input[type="text"]' ) . type ( ' (my import)' ) ;
284+ cy . should ( 'have.value' , 'neuron (my import)' ) . click ( ) ;
390285 cy . contains ( 'button' , 'next' ) . should ( 'not.be.disabled' ) ;
391286 } ) ;
392287 } ) ;
0 commit comments