@@ -26,6 +26,7 @@ describe("SampleTable Component Tests", () => {
2626 item_id : "sample1" ,
2727 type : "samples" ,
2828 name : "Sample 1" ,
29+ status : "PLANNED" ,
2930 chemform : "H2O" ,
3031 date : "2023-09-01T12:34:56Z" ,
3132 collections : [ { collection_id : "collection1" } ] ,
@@ -38,6 +39,7 @@ describe("SampleTable Component Tests", () => {
3839 item_id : "sample2" ,
3940 type : "samples" ,
4041 name : "Sample 2" ,
42+ status : "ACTIVE" ,
4143 chemform : "H2O" ,
4244 date : "2023-09-02T12:34:56Z" ,
4345 collections : [ { collection_id : "collection2" } ] ,
@@ -50,6 +52,7 @@ describe("SampleTable Component Tests", () => {
5052 item_id : "sample3" ,
5153 type : "samples" ,
5254 name : "Sample 3" ,
55+ status : "FAILED" ,
5356 chemform : "H2O" ,
5457 date : "2023-09-03T12:34:56Z" ,
5558 collections : [ { collection_id : "collection3" } ] ,
@@ -62,6 +65,7 @@ describe("SampleTable Component Tests", () => {
6265 item_id : "cell1" ,
6366 type : "cells" ,
6467 name : "Cell 1" ,
68+ status : "CYCLED" ,
6569 chemform : "CH4" ,
6670 date : "2023-08-15T08:45:30Z" ,
6771 collections : [ { collection_id : "collection1" } ] ,
@@ -74,6 +78,7 @@ describe("SampleTable Component Tests", () => {
7478 item_id : "cell2" ,
7579 type : "cells" ,
7680 name : "Cell 2" ,
81+ status : "DISMANTLED" ,
7782 chemform : "CH4" ,
7883 date : "2023-08-16T08:45:30Z" ,
7984 collections : [ { collection_id : "collection1" } , { collection_id : "collection2" } ] ,
@@ -86,6 +91,7 @@ describe("SampleTable Component Tests", () => {
8691 item_id : "cell3" ,
8792 type : "cells" ,
8893 name : "Cell 3" ,
94+ status : "SHORTED" ,
8995 chemform : "CH4" ,
9096 date : "2023-08-17T08:45:30Z" ,
9197 collections : [
@@ -138,8 +144,8 @@ describe("SampleTable Component Tests", () => {
138144 "" , //checkbox
139145 "ID" ,
140146 "Type" ,
141- "Sample name " ,
142- "Formula " ,
147+ "Status " ,
148+ "Name " ,
143149 "Date" ,
144150 "Collections" ,
145151 "Creators" ,
@@ -160,8 +166,7 @@ describe("SampleTable Component Tests", () => {
160166 cy . get ( "td" ) . eq ( 0 ) . should ( "contain.text" , "" ) ;
161167 cy . get ( "td" ) . eq ( 1 ) . should ( "contain.text" , "sample1" ) ;
162168 cy . get ( "td" ) . eq ( 2 ) . should ( "contain.text" , "samples" ) ;
163- cy . get ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Sample 1" ) ;
164- cy . get ( "td" ) . eq ( 4 ) . should ( "contain.text" , "H2O" ) ;
169+ cy . get ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Sample 1" ) ;
165170 cy . get ( "td" ) . eq ( 5 ) . should ( "contain.text" , "9/1/2023" ) ;
166171 cy . get ( "td" ) . eq ( 6 ) . find ( ".badge" ) . should ( "have.length" , 1 ) ;
167172 cy . get ( "td" ) . eq ( 7 ) . find ( ".avatar" ) . should ( "have.length" , 1 ) ;
@@ -174,8 +179,7 @@ describe("SampleTable Component Tests", () => {
174179 cy . get ( "td" ) . eq ( 0 ) . should ( "contain.text" , "" ) ;
175180 cy . get ( "td" ) . eq ( 1 ) . should ( "contain.text" , "cell1" ) ;
176181 cy . get ( "td" ) . eq ( 2 ) . should ( "contain.text" , "cells" ) ;
177- cy . get ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Cell 1" ) ;
178- cy . get ( "td" ) . eq ( 4 ) . should ( "contain.text" , "CH4" ) ;
182+ cy . get ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Cell 1" ) ;
179183 cy . get ( "td" ) . eq ( 5 ) . should ( "contain.text" , "8/15/2023" ) ;
180184 cy . get ( "td" ) . eq ( 6 ) . find ( ".badge" ) . should ( "have.length" , 1 ) ;
181185 cy . get ( "td" ) . eq ( 7 ) . find ( ".avatar" ) . should ( "have.length" , 2 ) ;
@@ -259,20 +263,28 @@ describe("SampleTable Component Tests", () => {
259263 cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 2 ) . should ( "contain.text" , "samples" ) ;
260264
261265 cy . get ( ".p-datatable-thead th" ) . eq ( 3 ) . find ( ".p-datatable-sort-icon" ) . click ( ) ;
262- cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Cell 1" ) ;
263- cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Cell 2" ) ;
266+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "ACTIVE" ) ;
267+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "CYCLED" ) ;
268+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 2 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "DISMANTLED" ) ;
269+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 3 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "FAILED" ) ;
270+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 4 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "PLANNED" ) ;
271+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 5 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "SHORTED" ) ;
264272
265273 cy . get ( ".p-datatable-thead th" ) . eq ( 3 ) . find ( ".p-datatable-sort-icon" ) . click ( ) ;
266- cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Sample 3" ) ;
267- cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "Sample 2" ) ;
274+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "SHORTED" ) ;
275+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "PLANNED" ) ;
276+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 2 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "FAILED" ) ;
277+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 3 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "DISMANTLED" ) ;
278+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 4 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "CYCLED" ) ;
279+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 5 ) . find ( "td" ) . eq ( 3 ) . should ( "contain.text" , "ACTIVE" ) ;
268280
269281 cy . get ( ".p-datatable-thead th" ) . eq ( 4 ) . find ( ".p-datatable-sort-icon" ) . click ( ) ;
270- cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "CH4 " ) ;
271- cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "CH4 " ) ;
282+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Cell 1 " ) ;
283+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Cell 2 " ) ;
272284
273285 cy . get ( ".p-datatable-thead th" ) . eq ( 4 ) . find ( ".p-datatable-sort-icon" ) . click ( ) ;
274- cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "H2O " ) ;
275- cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "H2O " ) ;
286+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Sample 3 " ) ;
287+ cy . get ( ".p-datatable-tbody tr" ) . eq ( 1 ) . find ( "td" ) . eq ( 4 ) . should ( "contain.text" , "Sample 2 " ) ;
276288
277289 cy . get ( ".p-datatable-thead th" ) . eq ( 5 ) . find ( ".p-datatable-sort-icon" ) . click ( ) ;
278290 cy . get ( ".p-datatable-tbody tr" ) . eq ( 0 ) . find ( "td" ) . eq ( 5 ) . should ( "contain.text" , "8/15/2023" ) ;
@@ -366,6 +378,40 @@ describe("SampleTable Component Tests", () => {
366378 cy . get ( ".p-datatable-tbody tr" ) . eq ( 2 ) . find ( "td" ) . eq ( 1 ) . should ( "contain.text" , "cell3" ) ;
367379 } ) ;
368380
381+ it ( "filters by Status correctly" , ( ) => {
382+ cy . get ( ".p-datatable-thead th" ) . eq ( 3 ) . find ( ".p-datatable-column-filter-button" ) . click ( ) ;
383+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
384+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "ACTIVE" ) . click ( ) ;
385+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 1 ) ;
386+ cy . findByText ( "Clear" ) . click ( ) ;
387+
388+ cy . get ( ".p-datatable-thead th" ) . eq ( 3 ) . find ( ".p-datatable-column-filter-button" ) . click ( ) ;
389+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
390+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "CYCLED" ) . click ( ) ;
391+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 1 ) ;
392+ cy . findByText ( "Clear" ) . click ( ) ;
393+
394+ cy . get ( ".p-datatable-thead th" ) . eq ( 3 ) . find ( ".p-datatable-column-filter-button" ) . click ( ) ;
395+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
396+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "ACTIVE" ) . click ( ) ;
397+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 1 ) ;
398+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
399+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "CYCLED" ) . click ( ) ;
400+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 2 ) ;
401+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
402+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "PLANNED" ) . click ( ) ;
403+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 3 ) ;
404+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
405+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "FAILED" ) . click ( ) ;
406+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 4 ) ;
407+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
408+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "SHORTED" ) . click ( ) ;
409+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 5 ) ;
410+ cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
411+ cy . get ( ".p-multiselect-list-container" ) . findByText ( "DISMANTLED" ) . click ( ) ;
412+ cy . get ( ".p-datatable-tbody tr" ) . should ( "have.length" , 6 ) ;
413+ } ) ;
414+
369415 it ( "filters by Collections correctly" , ( ) => {
370416 cy . get ( ".p-datatable-thead th" ) . eq ( 6 ) . find ( ".p-datatable-column-filter-button" ) . click ( ) ;
371417 cy . get ( ".p-datatable-filter-overlay" ) . find ( ".p-multiselect-label-container" ) . click ( ) ;
0 commit comments