Skip to content

Commit

Permalink
19 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhi-Cool-karni committed Aug 2, 2023
1 parent f88f630 commit a9993e0
Show file tree
Hide file tree
Showing 19 changed files with 912 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Selenium Python Framework Implementation from scratch:
• Creating Selenium WebDriver Custom Utilities in Base class. (DONE)
• Parameterizing WebDriver tests with Multiple Data sets. (DONE)
• Organizing Data from Separate Data files and injecting into fixture at run time. (DONE)
• Implementing Logging feature to WebDriver tests.
• Text Execution Html Reporting.
• Automatic Screenshot Capture on Test failures.
• Implementing Logging feature to WebDriver tests. (DONE)
• Text Execution Html Reporting. (DONE)
• Automatic Screenshot Capture on Test failures. (DONE)
• Integrating Selenium Python Framework to Jenkins CI tool with Jenkins build Parameterization.
• GitHub Basics for Project version control.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions PythonSelFramework/Utility/BaseClass.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import inspect
import logging
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.select import Select


@pytest.mark.usefixtures("setup")
class baseClass:

def getLogger(self):
loggerName = inspect.stack()[1][3]
logger = logging.getLogger(loggerName)

# File location
fileHandler = logging.FileHandler("logfile.log")

# Log format
formatter = logging.Formatter("%(asctime)s : %(levelname)s : %(name)s : %(message)s")
fileHandler.setFormatter(formatter)

logger.addHandler(fileHandler)

logger.setLevel(logging.DEBUG)
return logger

def verifyLinktextPresence(self, text):
wait = WebDriverWait(self.driver, 10)
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, text)))
Expand Down
Binary file modified PythonSelFramework/Utility/__pycache__/BaseClass.cpython-311.pyc
Binary file not shown.
19 changes: 19 additions & 0 deletions PythonSelFramework/logfile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
2023-08-01 01:24:22,856 : INFO : test_FormSubmission : Entering Name as Abhishek
2023-08-01 01:24:32,256 : INFO : test_FormSubmission : �
Success! The Form has been submitted successfully!.
2023-08-01 01:24:33,321 : INFO : test_FormSubmission : Entering Name as Priya
2023-08-01 01:24:33,321 : INFO : test_FormSubmission : Entering Name as Priya
2023-08-01 01:24:35,171 : INFO : test_FormSubmission : �
Success! The Form has been submitted successfully!.
2023-08-01 01:24:35,171 : INFO : test_FormSubmission : �
Success! The Form has been submitted successfully!.
2023-08-01 01:25:10,611 : INFO : test_e2e : Invoking browser and redirecting to link and filling form.
2023-08-01 01:25:13,718 : INFO : test_e2e : clicking on shop text link
2023-08-01 01:25:13,926 : INFO : test_e2e : getting card details
2023-08-01 01:25:14,048 : INFO : test_e2e : iphone X
2023-08-01 01:25:14,115 : INFO : test_e2e : Samsung Note 8
2023-08-01 01:25:14,182 : INFO : test_e2e : Nokia Edge
2023-08-01 01:25:14,255 : INFO : test_e2e : Blackberry
2023-08-01 01:25:16,961 : INFO : test_e2e : Entering country name as Ind
2023-08-01 01:25:23,232 : INFO : test_e2e : Text received form application �
Success! Thank you! Your order will be delivered in next few weeks :-).
Empty file.
186 changes: 186 additions & 0 deletions PythonSelFramework/reports/assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
/* do not increase min-width as some may use split screens */
min-width: 800px;
color: #999;
}

h1 {
font-size: 24px;
color: black;
}

h2 {
font-size: 16px;
color: black;
}

p {
color: black;
}

a {
color: #999;
}

table {
border-collapse: collapse;
}

/******************************
* SUMMARY INFORMATION
******************************/
#environment td {
padding: 5px;
border: 1px solid #E6E6E6;
}
#environment tr:nth-child(odd) {
background-color: #f6f6f6;
}

/******************************
* TEST RESULT COLORS
******************************/
span.passed,
.passed .col-result {
color: green;
}

span.skipped,
span.xfailed,
span.rerun,
.skipped .col-result,
.xfailed .col-result,
.rerun .col-result {
color: orange;
}

span.error,
span.failed,
span.xpassed,
.error .col-result,
.failed .col-result,
.xpassed .col-result {
color: red;
}

/******************************
* RESULTS TABLE
*
* 1. Table Layout
* 2. Extra
* 3. Sorting items
*
******************************/
/*------------------
* 1. Table Layout
*------------------*/
#results-table {
border: 1px solid #e6e6e6;
color: #999;
font-size: 12px;
width: 100%;
}
#results-table th,
#results-table td {
padding: 5px;
border: 1px solid #E6E6E6;
text-align: left;
}
#results-table th {
font-weight: bold;
}

/*------------------
* 2. Extra
*------------------*/
.log {
background-color: #e6e6e6;
border: 1px solid #e6e6e6;
color: black;
display: block;
font-family: "Courier New", Courier, monospace;
height: 230px;
overflow-y: scroll;
padding: 5px;
white-space: pre-wrap;
}
.log:only-child {
height: inherit;
}

div.image {
border: 1px solid #e6e6e6;
float: right;
height: 240px;
margin-left: 5px;
overflow: hidden;
width: 320px;
}
div.image img {
width: 320px;
}

div.video {
border: 1px solid #e6e6e6;
float: right;
height: 240px;
margin-left: 5px;
overflow: hidden;
width: 320px;
}
div.video video {
overflow: hidden;
width: 320px;
height: 240px;
}

.collapsed {
display: none;
}

.expander::after {
content: " (show details)";
color: #BBB;
font-style: italic;
cursor: pointer;
}

.collapser::after {
content: " (hide details)";
color: #BBB;
font-style: italic;
cursor: pointer;
}

/*------------------
* 3. Sorting items
*------------------*/
.sortable {
cursor: pointer;
}

.sort-icon {
font-size: 0px;
float: left;
margin-right: 5px;
margin-top: 5px;
/*triangle*/
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
}
.inactive .sort-icon {
/*finish triangle*/
border-top: 8px solid #E6E6E6;
}
.asc.active .sort-icon {
/*finish triangle*/
border-bottom: 8px solid #999;
}
.desc.active .sort-icon {
/*finish triangle*/
border-top: 8px solid #999;
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@
}
</script>
<h1>report.html</h1>
<p>Report generated on 28-Jul-2023 at 18:29:39 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.2.0</p>
<p>Report generated on 01-Aug-2023 at 01:49:58 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.2.0</p>
<h2>Summary</h2>
<p>1 tests ran in 38.40 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">1 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>
<p>3 tests ran in 65.30 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">3 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>
<h2>Results</h2>
<table id="results-table">
<thead id="results-table-head">
Expand All @@ -270,9 +270,40 @@ <h2>Results</h2>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">tests/test_e2e.py::TestOne::test_e2e</td>
<td class="col-duration">38.06</td>
<td class="col-name">test_anugularPractice.py::TestHomePage::test_FormSubmission[getData0]</td>
<td class="col-duration">39.68</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody></table></body></html>
<div class="log"> -------------------------------Captured log call-------------------------------- <br/>INFO test_FormSubmission:test_anugularPractice.py:11 Entering Name as Abhishek
INFO test_FormSubmission:test_anugularPractice.py:21 ×
Success! The Form has been submitted successfully!.<br/></div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_anugularPractice.py::TestHomePage::test_FormSubmission[getData1]</td>
<td class="col-duration">2.81</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> -------------------------------Captured log call-------------------------------- <br/>INFO test_FormSubmission:test_anugularPractice.py:11 Entering Name as Priya
INFO test_FormSubmission:test_anugularPractice.py:21 ×
Success! The Form has been submitted successfully!.<br/></div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_e2e.py::TestOne::test_e2e</td>
<td class="col-duration">21.86</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> -------------------------------Captured log call-------------------------------- <br/>INFO test_e2e:test_e2e.py:11 Invoking browser and redirecting to link and filling form.
INFO test_e2e:test_e2e.py:16 clicking on shop text link
INFO test_e2e:test_e2e.py:20 getting card details
INFO test_e2e:test_e2e.py:24 iphone X
INFO test_e2e:test_e2e.py:24 Samsung Note 8
INFO test_e2e:test_e2e.py:24 Nokia Edge
INFO test_e2e:test_e2e.py:24 Blackberry
INFO test_e2e:test_e2e.py:39 Entering country name as Ind
INFO test_e2e:test_e2e.py:53 Text received form application ×
Success! Thank you! Your order will be delivered in next few weeks :-).<br/></div></td></tr></tbody></table></body></html>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a9993e0

Please sign in to comment.