Skip to content

Commit 6496a47

Browse files
committed
Fixes, expands, and modifies E2E tests
1 parent ad53d73 commit 6496a47

37 files changed

Lines changed: 3514 additions & 25 deletions

docker-compose.override.integration_tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
services:
33
integration-tests:
4+
platform: linux/amd64
45
build:
56
context: ./
67
dockerfile: ${INTEGRATION_TESTS_DOCKERFILE:-Dockerfile.integration-tests-debian}
8+
platforms:
9+
- linux/amd64
710
image: "defectdojo/defectdojo-integration-tests:${INTEGRATION_TESTS_VERSION:-latest}"
811
depends_on:
912
- nginx

docker/entrypoint-integration-tests.sh

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,278 @@ else
296296
fail "$test"
297297
fi
298298

299+
test="Note Type integration tests"
300+
echo "Running: $test"
301+
if python3 tests/note_type_test.py ; then
302+
success "$test"
303+
else
304+
fail "$test"
305+
fi
306+
307+
test="SLA Configuration integration tests"
308+
echo "Running: $test"
309+
if python3 tests/sla_configuration_test.py ; then
310+
success "$test"
311+
else
312+
fail "$test"
313+
fi
314+
315+
test="Dashboard integration tests"
316+
echo "Running: $test"
317+
if python3 tests/dashboard_test.py ; then
318+
success "$test"
319+
else
320+
fail "$test"
321+
fi
322+
323+
test="Login integration tests"
324+
echo "Running: $test"
325+
if python3 tests/login_test.py ; then
326+
success "$test"
327+
else
328+
fail "$test"
329+
fi
330+
331+
test="Alerts integration tests"
332+
echo "Running: $test"
333+
if python3 tests/alerts_test.py ; then
334+
success "$test"
335+
else
336+
fail "$test"
337+
fi
338+
339+
test="System Settings integration tests"
340+
echo "Running: $test"
341+
if python3 tests/system_settings_test.py ; then
342+
success "$test"
343+
else
344+
fail "$test"
345+
fi
346+
347+
test="Credential integration tests"
348+
echo "Running: $test"
349+
if python3 tests/credential_test.py ; then
350+
success "$test"
351+
else
352+
fail "$test"
353+
fi
354+
355+
test="Engagement Extended integration tests"
356+
echo "Running: $test"
357+
if python3 tests/engagement_extended_test.py ; then
358+
success "$test"
359+
else
360+
fail "$test"
361+
fi
362+
363+
test="Finding Extended integration tests"
364+
echo "Running: $test"
365+
if python3 tests/finding_extended_test.py ; then
366+
success "$test"
367+
else
368+
fail "$test"
369+
fi
370+
371+
test="Test Copy integration tests"
372+
echo "Running: $test"
373+
if python3 tests/test_copy_test.py ; then
374+
success "$test"
375+
else
376+
fail "$test"
377+
fi
378+
379+
test="Endpoint Extended integration tests"
380+
echo "Running: $test"
381+
if python3 tests/endpoint_extended_test.py ; then
382+
success "$test"
383+
else
384+
fail "$test"
385+
fi
386+
387+
test="Calendar integration tests"
388+
echo "Running: $test"
389+
if python3 tests/calendar_test.py ; then
390+
success "$test"
391+
else
392+
fail "$test"
393+
fi
394+
395+
test="Finding Group integration tests"
396+
echo "Running: $test"
397+
if python3 tests/finding_group_test.py ; then
398+
success "$test"
399+
else
400+
fail "$test"
401+
fi
402+
403+
test="Engagement Presets integration tests"
404+
echo "Running: $test"
405+
if python3 tests/engagement_presets_test.py ; then
406+
success "$test"
407+
else
408+
fail "$test"
409+
fi
410+
411+
test="Questionnaire integration tests"
412+
echo "Running: $test"
413+
if python3 tests/questionnaire_test.py ; then
414+
success "$test"
415+
else
416+
fail "$test"
417+
fi
418+
419+
test="Benchmark integration tests"
420+
echo "Running: $test"
421+
if python3 tests/benchmark_test.py ; then
422+
success "$test"
423+
else
424+
fail "$test"
425+
fi
426+
427+
test="Notification Webhook integration tests"
428+
echo "Running: $test"
429+
if python3 tests/notification_webhook_test.py ; then
430+
success "$test"
431+
else
432+
fail "$test"
433+
fi
434+
435+
test="Threat Model integration tests"
436+
echo "Running: $test"
437+
if python3 tests/threat_model_test.py ; then
438+
success "$test"
439+
else
440+
fail "$test"
441+
fi
442+
443+
test="Product Tag Metrics integration tests"
444+
echo "Running: $test"
445+
if python3 tests/product_tag_metrics_test.py ; then
446+
success "$test"
447+
else
448+
fail "$test"
449+
fi
450+
451+
test="Object integration tests"
452+
echo "Running: $test"
453+
if python3 tests/object_test.py ; then
454+
success "$test"
455+
else
456+
fail "$test"
457+
fi
458+
459+
test="Tool Type integration tests"
460+
echo "Running: $test"
461+
if python3 tests/tool_type_test.py ; then
462+
success "$test"
463+
else
464+
fail "$test"
465+
fi
466+
467+
test="Tool Product integration tests"
468+
echo "Running: $test"
469+
if python3 tests/tool_product_test.py ; then
470+
success "$test"
471+
else
472+
fail "$test"
473+
fi
474+
475+
test="Risk Acceptance integration tests"
476+
echo "Running: $test"
477+
if python3 tests/risk_acceptance_test.py ; then
478+
success "$test"
479+
else
480+
fail "$test"
481+
fi
482+
483+
test="Product Metadata integration tests"
484+
echo "Running: $test"
485+
if python3 tests/product_metadata_test.py ; then
486+
success "$test"
487+
else
488+
fail "$test"
489+
fi
490+
491+
test="Product Credential integration tests"
492+
echo "Running: $test"
493+
if python3 tests/product_credential_test.py ; then
494+
success "$test"
495+
else
496+
fail "$test"
497+
fi
498+
499+
test="Test Type integration tests"
500+
echo "Running: $test"
501+
if python3 tests/test_type_test.py ; then
502+
success "$test"
503+
else
504+
fail "$test"
505+
fi
506+
507+
test="User Profile integration tests"
508+
echo "Running: $test"
509+
if python3 tests/user_profile_test.py ; then
510+
success "$test"
511+
else
512+
fail "$test"
513+
fi
514+
515+
test="Engagement Checklist integration tests"
516+
echo "Running: $test"
517+
if python3 tests/engagement_checklist_test.py ; then
518+
success "$test"
519+
else
520+
fail "$test"
521+
fi
522+
523+
test="Questionnaire Advanced integration tests"
524+
echo "Running: $test"
525+
if python3 tests/questionnaire_advanced_test.py ; then
526+
success "$test"
527+
else
528+
fail "$test"
529+
fi
530+
531+
test="Engagement Export integration tests"
532+
echo "Running: $test"
533+
if python3 tests/engagement_export_test.py ; then
534+
success "$test"
535+
else
536+
fail "$test"
537+
fi
538+
539+
test="Action History integration tests"
540+
echo "Running: $test"
541+
if python3 tests/action_history_test.py ; then
542+
success "$test"
543+
else
544+
fail "$test"
545+
fi
546+
547+
test="Reimport Scan integration tests"
548+
echo "Running: $test"
549+
if python3 tests/reimport_scan_test.py ; then
550+
success "$test"
551+
else
552+
fail "$test"
553+
fi
554+
555+
test="Banner Configuration integration tests"
556+
echo "Running: $test"
557+
if python3 tests/banner_test.py ; then
558+
success "$test"
559+
else
560+
fail "$test"
561+
fi
562+
563+
test="Metrics Extended integration tests"
564+
echo "Running: $test"
565+
if python3 tests/metrics_extended_test.py ; then
566+
success "$test"
567+
else
568+
fail "$test"
569+
fi
570+
299571
test="Tool Config integration tests"
300572
echo "Running: $test"
301573
if python3 tests/tool_config.py ; then

tests/action_history_test.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import sys
2+
import time
3+
import unittest
4+
5+
from base_test_class import BaseTestCase, on_exception_html_source_logger, set_suite_settings
6+
from product_test import ProductTest
7+
from selenium.webdriver.common.by import By
8+
9+
10+
class ActionHistoryTest(BaseTestCase):
11+
12+
@on_exception_html_source_logger
13+
def test_product_action_history(self):
14+
"""Test the action history page for a product."""
15+
driver = self.driver
16+
self.goto_product_overview(driver)
17+
driver.find_element(By.LINK_TEXT, "QA Test").click()
18+
current_url = driver.current_url
19+
parts = current_url.rstrip("/").split("/")
20+
pid = parts[-1]
21+
# Get the content type ID for Product
22+
# Use the Django history URL pattern: history/<content_type_id>/<object_id>
23+
# We can navigate to it via the product page's history link if available
24+
driver.find_element(By.ID, "dropdownMenu1").click()
25+
time.sleep(0.5)
26+
history_links = driver.find_elements(By.LINK_TEXT, "History")
27+
if len(history_links) > 0:
28+
history_links[0].click()
29+
time.sleep(1)
30+
self.assertTrue(
31+
self.is_text_present_on_page(text="History")
32+
or self.is_text_present_on_page(text="history")
33+
or self.is_text_present_on_page(text="Action"),
34+
)
35+
else:
36+
# History link might not be in dropdown, just verify no error
37+
self.assertFalse(self.is_error_message_present())
38+
39+
@on_exception_html_source_logger
40+
def test_components_page_loads(self):
41+
"""Test the global components page loads."""
42+
driver = self.driver
43+
driver.get(self.base_url + "components")
44+
time.sleep(1)
45+
self.assertTrue(
46+
self.is_text_present_on_page(text="Component")
47+
or self.is_text_present_on_page(text="component"),
48+
)
49+
50+
@on_exception_html_source_logger
51+
def test_product_components_page(self):
52+
"""Test the product components page."""
53+
driver = self.driver
54+
self.goto_product_overview(driver)
55+
driver.find_element(By.LINK_TEXT, "QA Test").click()
56+
current_url = driver.current_url
57+
parts = current_url.rstrip("/").split("/")
58+
pid = parts[-1]
59+
driver.get(self.base_url + f"product/{pid}/components")
60+
time.sleep(1)
61+
self.assertTrue(
62+
self.is_text_present_on_page(text="Component")
63+
or self.is_text_present_on_page(text="QA Test"),
64+
)
65+
66+
67+
def suite():
68+
suite = unittest.TestSuite()
69+
suite.addTest(BaseTestCase("test_login"))
70+
set_suite_settings(suite, jira=False, github=False, block_execution=False)
71+
suite.addTest(ProductTest("test_create_product"))
72+
suite.addTest(ProductTest("test_add_product_finding"))
73+
suite.addTest(ActionHistoryTest("test_product_action_history"))
74+
suite.addTest(ActionHistoryTest("test_components_page_loads"))
75+
suite.addTest(ActionHistoryTest("test_product_components_page"))
76+
suite.addTest(ProductTest("test_delete_product"))
77+
return suite
78+
79+
80+
if __name__ == "__main__":
81+
runner = unittest.TextTestRunner(descriptions=True, failfast=True, verbosity=2)
82+
ret = not runner.run(suite()).wasSuccessful()
83+
BaseTestCase.tearDownDriver()
84+
sys.exit(ret)

0 commit comments

Comments
 (0)