@@ -11,16 +11,16 @@ describe("Fetch Status", () => {
1111 // Check if the public and restricted sources appear
1212 cy . get ( '[aria-label="Sources info"]' ) . click ( ) ;
1313
14- cy . contains ( "http://localhost:8080/example/favourite-books" ) ;
15- cy . contains ( "http://localhost:8080/example/wish-list" ) ;
16-
1714 // Check if the correct icons appear
18- cy . get ( '[aria-label="Authentication required"]' ) . should ( "exist" ) ;
19- cy . get ( '[aria-label="Unauthorized"]' ) . should ( "exist" ) ;
20-
21- cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
22- cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
23-
15+ cy . contains ( "http://localhost:8080/example/wish-list" ) . parent ( ) . within ( ( ) => {
16+ cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
17+ cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
18+ } ) ;
19+ cy . contains ( "http://localhost:8080/example/favourite-books" ) . parent ( ) . within ( ( ) => {
20+ cy . get ( '[aria-label="Authentication required"]' ) . should ( "exist" ) ;
21+ cy . get ( '[aria-label="Unauthorized"]' ) . should ( "exist" ) ;
22+ } ) ;
23+ cy . get ( '[aria-label="Not fetched"]' ) . should ( "not.exist" ) ;
2424
2525 // Checking that a non-authorized book is not appearing
2626 cy . contains ( "It Ends With Us" ) . should ( "not.exist" ) ;
@@ -58,16 +58,16 @@ describe("Fetch Status", () => {
5858 // Check if the public and restricted sources appear
5959 cy . get ( '[aria-label="Sources info"]' ) . click ( ) ;
6060
61- cy . contains ( "http://localhost:8080/example/favourite-books" ) ;
62- cy . contains ( "http://localhost:8080/example/wish-list" ) ;
63-
6461 // Check if the correct icons appear
65- cy . get ( '[aria-label="Authentication required"]' ) . should ( "exist" ) ;
66- cy . get ( '[aria-label="Fetch Failed"]' ) . should ( "not.exist" ) ;
67- cy . get ( '[aria-label="Unauthorized"]' ) . should ( "not.exist" ) ;
68-
69- cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
70- cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
62+ cy . contains ( "http://localhost:8080/example/wish-list" ) . parent ( ) . within ( ( ) => {
63+ cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
64+ cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
65+ } ) ;
66+ cy . contains ( "http://localhost:8080/example/favourite-books" ) . parent ( ) . within ( ( ) => {
67+ cy . get ( '[aria-label="Authentication required"]' ) . should ( "exist" ) ;
68+ cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
69+ } ) ;
70+ cy . get ( '[aria-label="Not fetched"]' ) . should ( "not.exist" ) ;
7171
7272 // Checking that you see authorized books
7373 cy . contains ( "It Ends With Us" ) ;
@@ -85,15 +85,45 @@ describe("Fetch Status", () => {
8585 // Check if the good and bad sources appear
8686 cy . get ( '[aria-label="Sources info"]' ) . click ( ) ;
8787
88- // First fetch should be a success
89- cy . contains ( "http://localhost:8080/example/favourite-musicians" ) ;
90- cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
91- cy . get ( '[aria-label="Unauthorized"]' ) . should ( "not.exist" ) ;
92- cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
93-
94- // the bad source should fail to fetch
95- cy . contains ( "http://www.example.com/fetch-failure-but-query-success" ) ;
96- cy . get ( '[aria-label="Fetch failed"]' ) . should ( "exist" ) ;
88+ // Check if the correct icons appear
89+ cy . contains ( "http://localhost:8080/example/favourite-musicians" ) . parent ( ) . within ( ( ) => {
90+ cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
91+ cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
92+ } ) ;
93+ cy . contains ( "http://www.example.com/fetch-failure-but-query-success" ) . parent ( ) . within ( ( ) => {
94+ cy . get ( '[aria-label="Uncertain if authentication is required"]' ) . should ( "exist" ) ;
95+ cy . get ( '[aria-label="Fetch failed"]' ) . should ( "exist" ) ;
96+ } ) ;
97+ cy . get ( '[aria-label="Not fetched"]' ) . should ( "not.exist" ) ;
98+
99+ } ) ;
100+
101+ it ( "Fetch data with no authenticated user, indirect source & indirect variables and one unauthorized source" , ( ) => {
102+
103+ cy . visit ( "/" ) ;
104+ cy . contains ( "For testing only" ) . click ( ) ;
105+ cy . contains ( "Component and materials - 1 variable (indirect source & indirect variables; one unauthorized source)" ) . click ( ) ;
106+
107+ // Fill in the form
108+ cy . get ( '.ra-input-componentName' ) . click ( ) ;
109+ cy . get ( 'li' ) . contains ( 'Component 1' ) . click ( ) ;
110+
111+ // Comfirm query
112+ cy . get ( 'button[type="submit"]' ) . click ( ) ;
113+
114+ // Check if the public and restricted sources appear
115+ cy . get ( '[aria-label="Sources info"]' ) . click ( ) ;
116+
117+ // Check if the correct icons appear
118+ cy . contains ( "http://localhost:8080/example/boms" ) . parent ( ) . within ( ( ) => {
119+ cy . get ( '[aria-label="No authentication required"]' ) . should ( "exist" ) ;
120+ cy . get ( '[aria-label="Fetch was successful"]' ) . should ( "exist" ) ;
121+ } ) ;
122+ cy . contains ( "http://localhost:8080/example/favourite-books" ) . parent ( ) . within ( ( ) => {
123+ cy . get ( '[aria-label="Authentication required"]' ) . should ( "exist" ) ;
124+ cy . get ( '[aria-label="Unauthorized"]' ) . should ( "exist" ) ;
125+ } ) ;
126+ cy . get ( '[aria-label="Not fetched"]' ) . should ( "not.exist" ) ;
97127
98128 } ) ;
99129
0 commit comments