Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axe results violations save #498

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b48fb7f
working draft for test
mohanqxf2 Oct 17, 2024
d14cb49
delimiter error
mohanqxf2 Oct 18, 2024
17b9954
updated script to compare only violations part
mohanqxf2 Oct 21, 2024
05692fe
add assertions and to print the new violations found
mohanqxf2 Oct 21, 2024
588cd0a
update with log result summary
mohanqxf2 Oct 21, 2024
787f826
code cleanup
mohanqxf2 Oct 21, 2024
3b21f1c
move load and save snapshot methods to utils
mohanqxf2 Oct 21, 2024
8d41596
code cleanup
mohanqxf2 Oct 21, 2024
f4a0782
code cleanup
mohanqxf2 Oct 21, 2024
60c6dd5
remove snapshot txt file
mohanqxf2 Oct 22, 2024
2cc82fa
fix pr review suggestions
mohanqxf2 Oct 28, 2024
1cdab7b
partial working draft
mohanqxf2 Oct 29, 2024
5c793ff
print violation info
mohanqxf2 Oct 30, 2024
1ade780
display violations with info
mohanqxf2 Nov 4, 2024
bf66845
removed snapshot nested dir
mohanqxf2 Nov 4, 2024
f0be4bb
pr review changes
mohanqxf2 Nov 6, 2024
a9ad0da
rebase with latest master and code cleanup
mohanqxf2 Nov 7, 2024
d7fa3cb
new txt file to save all violations output and breakdown get new viol…
mohanqxf2 Nov 7, 2024
0c365b8
Merge branch 'master' of https://github.com/qxf2/qxf2-page-object-mod…
mohanqxf2 Nov 28, 2024
e1d1a3c
rebase with master and update user message
mohanqxf2 Nov 28, 2024
10d79ba
white space clear
mohanqxf2 Nov 28, 2024
48b3565
updated snapshot conf directory path
mohanqxf2 Dec 6, 2024
eddd086
move violation compare to utils
mohanqxf2 Dec 6, 2024
8376fc7
code cleanup
mohanqxf2 Dec 6, 2024
d9879f9
refactor test script and add snapshots repo
mohanqxf2 Dec 11, 2024
415b78b
working draft for using jsondiff
mohanqxf2 Dec 18, 2024
a4bf8aa
replace logic with using jsondiff
mohanqxf2 Dec 18, 2024
5f715b4
add jsondiff in requirement file
mohanqxf2 Dec 27, 2024
96da942
update witj json deepdiff library
mohanqxf2 Jan 2, 2025
44f8ee8
update snapshot
mohanqxf2 Jan 2, 2025
453d7db
fix create snapshot and remove testobj for log violations
mohanqxf2 Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,184 changes: 1,184 additions & 0 deletions conf/snapshot/snapshot_output_contact.json

Large diffs are not rendered by default.

741 changes: 741 additions & 0 deletions conf/snapshot/snapshot_output_main.json

Large diffs are not rendered by default.

260 changes: 260 additions & 0 deletions conf/snapshot/snapshot_output_redirect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
[
{
"description": "Ensures every HTML document has a lang attribute",
"help": "<html> element must have a lang attribute",
"helpUrl": "https://dequeuniversity.com/rules/axe/3.1/html-has-lang?application=axeAPI",
"id": "html-has-lang",
"impact": "serious",
"nodes": [
{
"all": [],
"any": [
{
"data": null,
"id": "has-lang",
"impact": "serious",
"message": "The <html> element does not have a lang attribute",
"relatedNodes": []
}
],
"failureSummary": "Fix any of the following:\n The <html> element does not have a lang attribute",
"html": "<html>",
"impact": "serious",
"none": [],
"target": [
"html"
]
}
],
"tags": [
"cat.language",
"wcag2a",
"wcag311"
]
},
{
"description": "Ensures <img> elements have alternate text or a role of none or presentation",
"help": "Images must have alternate text",
"helpUrl": "https://dequeuniversity.com/rules/axe/3.1/image-alt?application=axeAPI",
"id": "image-alt",
"impact": "critical",
"nodes": [
{
"all": [],
"any": [
{
"data": null,
"id": "has-alt",
"impact": "critical",
"message": "Element does not have an alt attribute",
"relatedNodes": []
},
{
"data": null,
"id": "aria-label",
"impact": "serious",
"message": "aria-label attribute does not exist or is empty",
"relatedNodes": []
},
{
"data": null,
"id": "aria-labelledby",
"impact": "serious",
"message": "aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty",
"relatedNodes": []
},
{
"data": null,
"id": "non-empty-title",
"impact": "serious",
"message": "Element has no title attribute or the title attribute is empty",
"relatedNodes": []
},
{
"data": null,
"id": "role-presentation",
"impact": "minor",
"message": "Element's default semantics were not overridden with role=\"presentation\"",
"relatedNodes": []
},
{
"data": null,
"id": "role-none",
"impact": "minor",
"message": "Element's default semantics were not overridden with role=\"none\"",
"relatedNodes": []
}
],
"failureSummary": "Fix any of the following:\n Element does not have an alt attribute\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute or the title attribute is empty\n Element's default semantics were not overridden with role=\"presentation\"\n Element's default semantics were not overridden with role=\"none\"",
"html": "<img src=\"./assets/img/cut_line.png\" class=\"img-responsive col-lg-12\">",
"impact": "critical",
"none": [],
"target": [
".col-lg-12"
]
}
],
"tags": [
"cat.text-alternatives",
"wcag2a",
"wcag111",
"section508",
"section508.22.a"
]
},
{
"description": "Ensures the page has only one main landmark and each iframe in the page has at most one main landmark",
"help": "Page must have one main landmark",
"helpUrl": "https://dequeuniversity.com/rules/axe/3.1/landmark-one-main?application=axeAPI",
"id": "landmark-one-main",
"impact": "moderate",
"nodes": [
{
"all": [
{
"data": null,
"id": "page-has-main",
"impact": "moderate",
"message": "Page does not have a main landmark",
"relatedNodes": []
}
],
"any": [],
"failureSummary": "Fix all of the following:\n Page does not have a main landmark",
"html": "<html>",
"impact": "moderate",
"none": [],
"target": [
"html"
]
}
],
"tags": [
"cat.semantics",
"best-practice"
]
},
{
"description": "Ensures all page content is contained by landmarks",
"help": "All page content must be contained by landmarks",
"helpUrl": "https://dequeuniversity.com/rules/axe/3.1/region?application=axeAPI",
"id": "region",
"impact": "moderate",
"nodes": [
{
"all": [],
"any": [
{
"data": null,
"id": "region",
"impact": "moderate",
"message": "Some page content is not contained by landmarks",
"relatedNodes": [
{
"html": "<img src=\"./assets/img/qxf2_logo.png\" class=\"img-responsive logo col-md-12\" alt=\"Qxf2 Services\">",
"target": [
".logo"
]
},
{
"html": "<h1 class=\"banner-brown text-center\">SOFTWARE TESTING SERVICES</h1>",
"target": [
".banner-brown"
]
},
{
"html": "<h1 class=\"text-center banner-grey\">for startups</h1>",
"target": [
".banner-grey"
]
},
{
"html": "<img src=\"./assets/img/menu.png\" data-toggle=\"dropdown\" class=\"img-responsive menu-img col-md-12 pull-right dropdown-toggle\" alt=\"Menu\">",
"target": [
".menu-img"
]
},
{
"html": "<h2 class=\"grey_text text-center\">Selenium for beginners: Practice page 2</h2>",
"target": [
"h2"
]
},
{
"html": "<p>Thank you for submitting the example form. This page will get fleshed out as our tutorials progress. Until then, go back to the <a href=\"./selenium-tutorial-main\">first example page</a> and continue practicing.</p>",
"target": [
".top-space-40 > p"
]
},
{
"html": "<img src=\"./assets/img/cut_line.png\" class=\"img-responsive col-lg-12\">",
"target": [
".col-lg-12"
]
},
{
"html": "<a href=\"./\" onclick=\"_gaq.push(['_trackEvent', 'Nav-Home', 'Click', 'Home']);\">Home</a>",
"target": [
".nav > li:nth-child(1) > a[href=\"./\"]"
]
},
{
"html": "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\" onclick=\"_gaq.push(['_trackEvent', 'Nav-Approach-Expand', 'Click', 'Open approach caret']);\">Approach<span class=\"caret\"></span></a>",
"target": [
".dropup:nth-child(2) > .dropdown-toggle[role=\"button\"][href=\"#\"]"
]
},
{
"html": "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\" onclick=\"_gaq.push(['_trackEvent', 'Nav-Automation-Expand', 'Click', 'Open automation caret']);\">Resources<span class=\"caret\"></span></a>",
"target": [
".dropup:nth-child(3) > .dropdown-toggle[role=\"button\"][href=\"#\"]"
]
},
{
"html": "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\" onclick=\"_gaq.push(['_trackEvent', 'Nav-About-Expand', 'Click', 'Open about caret']);\">About<span class=\"caret\"></span></a>",
"target": [
".dropup:nth-child(4) > .dropdown-toggle[role=\"button\"][href=\"#\"]"
]
},
{
"html": "<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\" onclick=\"_gaq.push(['_trackEvent', 'Nav-Contact-Expand', 'Click', 'Open Contact caret']);\">Contact<span class=\"caret\"></span></a>",
"target": [
".dropup:nth-child(5) > .dropdown-toggle[role=\"button\"][href=\"#\"]"
]
},
{
"html": "<a href=\"https://qxf2.com/blog\" onclick=\"_gaq.push(['_trackEvent', 'Nav-Blog', 'Click', 'To Blog']);\">Blog</a>",
"target": [
".nav > li:nth-child(6) > a[href$=\"blog\"]"
]
},
{
"html": "<a href=\"http://news.qxf2.com\" onclick=\"_gaq.push(['_trackEvent', 'Nav-News', 'Click', 'To news']);\">News for testers</a>",
"target": [
".nav > li:nth-child(7) > a[href$=\"news.qxf2.com\"]"
]
},
{
"html": "<p class=\"text-center qxf2_copyright\">\n\t© Qxf2 Services 2013 - 2015\n </p>",
"target": [
".qxf2_copyright"
]
}
]
}
],
"failureSummary": "Fix any of the following:\n Some page content is not contained by landmarks",
"html": "<html>",
"impact": "moderate",
"none": [],
"target": [
"html"
]
}
],
"tags": [
"cat.keyboard",
"best-practice"
]
}
]
3 changes: 2 additions & 1 deletion conf/snapshot_dir_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
"""
import os

snapshot_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'utils', 'snapshot')
snapshot_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'conf', 'snapshot')
mohanqxf2 marked this conversation as resolved.
Show resolved Hide resolved
page_names = ["main", "redirect", "contact"]
12 changes: 2 additions & 10 deletions page_objects/PageFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def get_page_object(page_name,base_url=url_conf.ui_base_url):
elif page_name in ["zero mobile","zero mobile page"]:
from page_objects.zero_mobile_page import Zero_Mobile_Page
test_obj = Zero_Mobile_Page()
elif page_name == "main page":
elif page_name in ["main","main page"]:
from page_objects.examples.selenium_tutorial_webpage.tutorial_main_page import Tutorial_Main_Page
test_obj = Tutorial_Main_Page(base_url=base_url)
elif page_name == "redirect":
from page_objects.examples.selenium_tutorial_webpage.tutorial_redirect_page import Tutorial_Redirect_Page
test_obj = Tutorial_Redirect_Page(base_url=base_url)
elif page_name == "contact page":
elif page_name in ["contact","contact page"]:
from page_objects.examples.selenium_tutorial_webpage.contact_page import Contact_Page
test_obj = Contact_Page(base_url=base_url)
elif page_name == "bitcoin main page":
Expand All @@ -57,11 +57,3 @@ def get_page_object(page_name,base_url=url_conf.ui_base_url):
from page_objects.examples.weather_shopper_mobile_app.webview_chrome import WebviewChrome
test_obj = WebviewChrome()
return test_obj


@staticmethod
def get_all_page_names():
"Return the page names"
return ["main page",
"redirect",
"contact page"]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ pytesseract==0.3.10
pytest-asyncio==0.23.7
prettytable==3.10.2
setuptools>=75.1.0; python_version >= '3.12'
deepdiff>=8.1.1
Loading