@@ -189,10 +189,19 @@ public void testHtmlUnauthorized() {
189189 .asString ();
190190
191191 HtmlPage page = extractPage (body );
192- HtmlHeading4 heading = page .getFirstByXPath ("//div[@class='pf-v5-c-alert pf-m-warning']/h4" );
193- assertEquals (
194- "Warning alert:Snyk: Unauthorized: Verify the provided credentials are valid." ,
195- heading .getTextContent ());
192+ List <HtmlHeading4 > headings = page .getByXPath ("//div[@class='pf-v5-c-alert pf-m-warning']/h4" );
193+ assertTrue (
194+ headings .stream ()
195+ .allMatch (
196+ heading ->
197+ heading
198+ .getTextContent ()
199+ .equals ("Warning alert:Oss-index: Missing mandatory credentials" )
200+ || heading
201+ .getTextContent ()
202+ .equals (
203+ "Warning alert:Snyk: Unauthorized: Verify the provided credentials"
204+ + " are valid." )));
196205 assertTrue (page .getElementsByTagName ("table" ).isEmpty ());
197206
198207 verifySnykRequest (INVALID_TOKEN );
@@ -220,11 +229,20 @@ public void testHtmlForbidden() {
220229 .asString ();
221230
222231 HtmlPage page = extractPage (body );
223- HtmlHeading4 heading = page .getFirstByXPath ("//div[@class='pf-v5-c-alert pf-m-warning']/h4" );
224- assertEquals (
225- "Warning alert:Snyk: Forbidden: The provided credentials don't have the required"
226- + " permissions." ,
227- heading .getTextContent ());
232+ List <HtmlHeading4 > headings = page .getByXPath ("//div[@class='pf-v5-c-alert pf-m-warning']/h4" );
233+ assertTrue (
234+ headings .stream ()
235+ .allMatch (
236+ heading ->
237+ heading
238+ .getTextContent ()
239+ .equals ("Warning alert:Oss-index: Missing mandatory credentials" )
240+ || heading
241+ .getTextContent ()
242+ .equals (
243+ "Warning alert:Snyk: Forbidden: The provided credentials don't have"
244+ + " the required permissions." )));
245+
228246 assertTrue (page .getElementsByTagName ("table" ).isEmpty ());
229247
230248 verifySnykRequest (UNAUTH_TOKEN );
@@ -252,11 +270,15 @@ public void testHtmlError() {
252270 .asString ();
253271
254272 HtmlPage page = extractPage (body );
255- HtmlHeading4 heading = page .getFirstByXPath ("//div[@class='pf-v5-c-alert pf-m-danger']/h4" );
273+ HtmlHeading4 errorHeading =
274+ page .getFirstByXPath ("//div[@class='pf-v5-c-alert pf-m-danger']/h4" );
256275 assertEquals (
257- "Danger alert:Snyk: Server Error: This is an example error" , heading .getTextContent ());
276+ "Danger alert:Snyk: Server Error: This is an example error" , errorHeading .getTextContent ());
258277 assertTrue (page .getElementsByTagName ("table" ).isEmpty ());
259-
278+ HtmlHeading4 warningHeading =
279+ page .getFirstByXPath ("//div[@class='pf-v5-c-alert pf-m-warning']/h4" );
280+ assertEquals (
281+ "Warning alert:Oss-index: Missing mandatory credentials" , warningHeading .getTextContent ());
260282 verifySnykRequest (ERROR_TOKEN );
261283 verifyNoInteractionsWithOSS ();
262284 }
0 commit comments