repo_id
stringclasses
208 values
file_path
stringlengths
31
190
content
stringlengths
1
2.65M
__index_level_0__
int64
0
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/gif_maker.py
""" Qxf2 Services: This utility is for creating a GIF of all the screenshots captured during current test run """ import imageio.v2 as imageio import os def make_gif(screenshot_dir_path,name = "test_recap",suffix=".gif",frame_duration=0.5): "Creates gif of the screenshots" gif_name = None images = [] ...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/custom_pytest_plugins.py
""" This module houses custom pytest plugins implemented Plugins added: - CustomTerminalReporter: Print a prettytable failure summary using pytest """ from _pytest.terminal import TerminalReporter from .prettytable_object import FailureSummaryTable # pylint: disable=relative-beyond-top-level class CustomTerminalRepor...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/prettytable_object.py
""" A module to house prettytable custom objects This tail made objects are used by pytest to print table output of failure summary """ from prettytable.colortable import ColorTable, Theme, Themes #pylint: disable=too-few-public-methods class PrettyTableTheme(Themes): "A custom color theme object" Failure = Th...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/logging_objects.py
""" Helper class for Logging Objects """ from utils.Base_Logging import Base_Logging from utils.stop_test_exception_util import Stop_Test_Exception import logging class Logging_Objects: def __init__(self): self.msg_list = [] self.exceptions = [] @staticmethod def color_text(text, color ="...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/screenshot_objects.py
""" Helper class for Screenshot Objects """ import os import shutil from core_helpers import gif_maker import conf.screenshot_conf as conf class Screenshot_Objects: def __init__(self): self.tesults_flag = False self.images = [] def save_screenshot(self,screenshot_name,pre_format=" #Debug ...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/web_app_helper.py
""" Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ import inspect from selenium.webdriver.common.by import By from core_helpers.drivers.driverfactory import DriverFactory from .selenium_action_objects import Selenium_Action_Objects from .remote_objects impo...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/mobile_app_helper.py
""" Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ import unittest,os,inspect import time from core_helpers.drivers.driverfactory import DriverFactory from .selenium_action_objects import Selenium_Action_Objects from .logging_objects import Logging_Objects ...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/selenium_action_objects.py
""" Helper class for Selenium Objects """ import time from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.b...
0
qxf2_public_repos/qxf2-page-object-model
qxf2_public_repos/qxf2-page-object-model/core_helpers/remote_objects.py
""" Helper class for Remote Objects """ class Remote_Objects: def __init__(self): self.image_url_list = [] self.msg_list = [] self.testrail_flag = False self.tesults_flag = False self.test_run_id = None self.images = [] def register_testrail(self): "Regi...
0
qxf2_public_repos/qxf2-page-object-model/core_helpers
qxf2_public_repos/qxf2-page-object-model/core_helpers/drivers/local_options.py
""" Get the webrivers for local browsers. """ from selenium.webdriver.chrome.options import Options import sys from selenium import webdriver class LocalOptions(): """Class contains methods for getting webfrivers for various browsers.""" @staticmethod def firefox_local(browser_version): """Get web...
0
qxf2_public_repos/qxf2-page-object-model/core_helpers
qxf2_public_repos/qxf2-page-object-model/core_helpers/drivers/driverfactory.py
""" DriverFactory class This module gets the webdrivers for different browsers and sets up the remote testing platforms for automation tests and mobile tests. """ import os import sys from dotenv import load_dotenv from integrations.cross_browsers.remote_options import RemoteOptions from .local_options import LocalOpti...
0
qxf2_public_repos
qxf2_public_repos/python-data-cleaning-blogpost/LICENSE
MIT License Copyright (c) 2017 Qxf2 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, ...
0
qxf2_public_repos
qxf2_public_repos/python-data-cleaning-blogpost/outputcleanup.csv
Id,Age,Weight,Firstname,Lastname,PulseRate,Sex,Time 1.0,56.0,70kgs,Micky,Mous,72,m,00-06 1.0,56.0,70kgs,Micky,Mous,69,m,06-12 1.0,56.0,70kgs,Micky,Mous,71,m,12-18 1.0,56.0,70kgs,Micky,Mous,-,f,00-06 1.0,56.0,70kgs,Micky,Mous,-,f,06-12 1.0,56.0,70kgs,Micky,Mous,-,f,12-18 2.0,34.0,70kgs,Donald,Duck,-,m,00-06 2.0,34.0,70k...
0
qxf2_public_repos
qxf2_public_repos/python-data-cleaning-blogpost/README.md
--------- Welcome --------- The patient_heart_rate.csv is the data file used for my blog post - "Cleaning data with Python" URL: https://qxf2.com/blog/cleaning-data-python-pandas
0
qxf2_public_repos
qxf2_public_repos/python-data-cleaning-blogpost/patient_heart_rate.csv
1,Mickéy Mousé,56,70kgs,72,69,71,-,-,- 2,Donald Duck,34,154.89lbs,-,-,-,85,84,76 3,Mini Mouse,16,,-,-,-,65,69,72 4,Scrooge McDuck,,78kgs,78,79,72,-,-,- 5,Pink Panther,54,198.658lbs,-,-,-,69,,75 6,Huey McDuck,52,189lbs,-,-,-,68,75,72 7,Dewey McDuck,19,56kgs,-,-,-,71,78,75 8,Scööpy Doo,32,78kgs,78,76,75,-,-,- ,,,,,,,,, ...
0
qxf2_public_repos
qxf2_public_repos/data-visualization/README.md
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view...
0
qxf2_public_repos
qxf2_public_repos/data-visualization/package-lock.json
{ "name": "visualize-testing", "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZ...
0
qxf2_public_repos
qxf2_public_repos/data-visualization/package.json
{ "name": "visualize-testing", "version": "0.1.0", "private": true, "dependencies": { "@grapecity/wijmo.react.all": "^5.20211.781", "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^12.8.3", "d3": "^6.7.0", "highcharts": "^8.2.2...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/public/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <meta name="description" content="Web site created using create-react-app" ...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/public/manifest.json
{ "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", ...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/public/robots.txt
# https://www.robotstxt.org/robotstxt.html User-agent: * Disallow:
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/reportWebVitals.js
const reportWebVitals = onPerfEntry => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); getFID(onPerfEntry); getFCP(onPerfEntry); getLCP(onPerfEntry); getTTFB(onPerfEntry); })...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/App.css
.AppContainer { height: 100vh; background-color: rgba(43, 189, 226, 0.281); display: flex; align-items: center; justify-content: center; } .split { display: flex; flex-direction: row; } .gutter { background-color: azure; background-repeat: no-repeat; background-position: 0%; pointer-events: none...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/index.js
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') ); // If you want to start measuring performance in yo...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/index.css
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } code { font-family: source-code-pro, Menlo, Mona...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/App.test.js
import { render, screen } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { render(<App />); const linkElement = screen.getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); });
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/setupTests.js
// jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom';
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/logo.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6...
0
qxf2_public_repos/data-visualization
qxf2_public_repos/data-visualization/src/App.js
import "./App.css"; import { Card, CardBody, CardHeader } from "react-simple-card"; import Features from "./Data/features.json"; import TileMap from "./Screens/Tiles/TileMap"; import SplitScreen from "./Screens/Split/SplitScreen"; import TreeMap from "./Screens/Tree/TreeMap"; import NTreeMap from "./Screens/NTree/NTree...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Split/SplitScreen.css
.App { background-color: blueviolet; height: 90vh; padding: 15vh; perspective: 1000px; } .split { display: flex; flex-direction: row; } .gutter { background-color: azure; background-repeat: no-repeat; background-position: 0%; pointer-events: none; } .container { background-color: antiquewhite; ...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Split/SplitScreen.js
import React from "react"; import { Card, CardHeader, CardBody } from "react-simple-card"; import Split from "react-split"; import "./SplitScreen.css"; import Features from "../../Data/features.json"; class SplitScreen extends React.Component { constructor(props) { super(props); // Don't call this.setState()...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Tree/TreeMap.js
import * as d3 from "d3"; import React, { useRef, useEffect } from "react"; import "./TreeMap.css"; function TreeMap({ width, height, data }) { const ref = useRef(); useEffect(() => { const svg = d3 .select(ref.current) .attr("width", width) .attr("height", height) .style("border", "1p...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Tree/TreeMap.css
.chart { background-color: "#d9d9d9"; padding: 10px; }
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/NTree/NTreeMap.js
import * as d3 from "d3"; import React, { useRef, useEffect } from "react"; import "./NTreeMap.css"; import Tree from "react-d3-tree"; function NTreeMap({ width, height, data }) { const svgRef = useRef(null); function renderTreemap() { const svg = d3.select(svgRef.current); svg.attr("width", width).attr(...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/NTree/NTreeMap.css
.node__root > circle { fill: red; } .node__branch > circle { fill: yellow; }
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Tiles/TileMap.css
.App { background-color: blueviolet; height: 90vh; padding: 15vh; perspective: 1000px; } .split { display: flex; flex-direction: row; } .gutter { background-color: azure; background-repeat: no-repeat; background-position: 0%; pointer-events: none; } .container { background-color: antiquewhite; ...
0
qxf2_public_repos/data-visualization/src/Screens
qxf2_public_repos/data-visualization/src/Screens/Tiles/TileMap.js
import React from "react"; import { Card, CardBody } from "react-simple-card"; import Highcharts from "highcharts"; import HighchartsReact from "highcharts-react-official"; import "./TileMap.css"; class TileMap extends React.Component { constructor(props) { super(props); // Don't call this.setState() here! ...
0
qxf2_public_repos/data-visualization/src
qxf2_public_repos/data-visualization/src/Data/features.json
[ { "feature": "Spam filter", "area": 0.3, "risk_score": 0.8, "metrics": [{ "name1": "200" }, { "name1": "100" }] }, { "feature": "Trash Folder", "area": 0.3, "risk_score": 0.2, "metrics": [{ "name1": "400" }, { "name1": "500" }] }, { "feature": ...
0
qxf2_public_repos/data-visualization/src
qxf2_public_repos/data-visualization/src/Data/data.js
const data = { name: "Spam", children: [ { name: "environment", color: "#FFF", children: [ { category: "environment", name: "Spam", value: 15, color: "#FFF000", }, { category: "environment", name: "Tremont Wate...
0
qxf2_public_repos/data-visualization/src
qxf2_public_repos/data-visualization/src/Data/TreeData.json
{ "children": [ { "name": "Spam filter", "value": 200, "children": [ { "name": "mister_c", "group": "C", "weight": 78, "colname": "level3" }, { ...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/conftest.py
import os,pytest,sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) from page_objects.PageFactory import PageFactory from conf import browser_os_name_conf from conf import base_url_conf from utils import post_test_reports_to_slack from utils.email_pytest_report import Email_Pytest_Report from utils import ...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/pytest.ini
[pytest] addopts = -v -s -rsxX --continue-on-collection-errors --tb=short --ignore=utils/Test_Rail.py --ignore=tests/test_boilerplate.py --ignore=utils/Test_Runner_Class.py -p no:cacheprovider norecursedirs = .svn _build tmp* log .vscode .git markers = GUI: mark a test as part of the GUI regression suite API: m...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/LICENSE
MIT License Copyright (c) 2016 Qxf2 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, ...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/requirements.txt
requests==2.20.0 pytest>=6.1.0 selenium==3.13.0 python_dotenv==0.8.2 Appium_Python_Client==0.28 pytest-xdist>=1.31 pytest-html>=3.0.0 pytest-rerunfailures>=9.1.1 pytest_reportportal==1.10.0 pillow>=6.2.0 tesults loguru imageio
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/Dockerfile
#Dockerfile to build an image for running Selenium tests #Pull ubuntu 16.04 base image FROM ubuntu LABEL maintainer = "Qxf2 Services" # Essential tools and xvfb RUN apt-get update && apt-get install -y \ software-properties-common \ unzip \ wget \ xvfb # Chrome browser to run the tests ARG CHROME_VERS...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/Readme.md
![Python version](https://img.shields.io/badge/python-3.x-green?color=brightgreen) ![GitHub](https://img.shields.io/github/license/qxf2/qxf2-page-object-model?color=brightgreen) ![Maintenance](https://img.shields.io/maintenance/yes/2020?color=brightgreen) [![CircleCI](https://circleci.com/gh/qxf2/qxf2-page-object-model...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/CONTRIBUTING.md
Contributing Guidelines -------- Your contributions are always welcome! There are a number of ways you can contribute. These guidelines instruct how to submit issues and contribute code or documentation to [Qxf2 Automation Framework](https://github.com/qxf2/qxf2-page-object-model). Reporting bugs -------- This sect...
0
qxf2_public_repos
qxf2_public_repos/pr-training-example/tox.ini
[tox] skipsdist = true [testenv] #Setting the dependency file deps = -r{toxinidir}/requirements.txt #used to not trigger the “not installed in virtualenv” warning message whitelist_externals=* #setting the environment setenv= app_path= {toxinidir}/bitcoin-info/app/ #Command to run the test commands = python -m py...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/endpoints/API_Player.py
""" API_Player class does the following: a) serves as an interface between the test and API_Interface b) contains several useful wrappers around commonly used combination of actions c) maintains the test context/state """ from base64 import b64encode from .API_Interface import API_Interface from utils.results import Re...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/endpoints/Base_API.py
""" A wrapper around Requests to make Restful API calls """ import requests from urllib.error import HTTPError from urllib.error import URLError class Base_API: "Main base class for Requests based scripts" def get(self, url, headers={}): "Get request" json_response = None error = {} ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/endpoints/API_Interface.py
""" A composed interface for all the API objects Use the API_Player to talk to this class """ import requests from .Base_API import Base_API from .Cars_API_Endpoints import Cars_API_Endpoints from .Registration_API_Endpoints import Registration_API_Endpoints from .User_API_Endpoints import User_API_Endpoints class API...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/tests/test_boilerplate.py
""" This test file will help you get started in writing a new test using our framework """ import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from page_objects.PageFactory import PageFactory from utils.Option_Parser import Option_Parser import pytest @pytest.mark.GUI def test_b...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/tests/test_e2e.py
""" This test file will help you get started in writing a new test using our framework """ import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from page_objects.PageFactory import PageFactory from utils.Option_Parser import Option_Parser import pytest @pytest.mark.GUI def test_e...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Test_Rail.py
""" TestRail integration: * limited to what we need at this time * we assume TestRail operates in single suite mode i.e., the default, reccomended mode API reference: http://docs.gurock.com/testrail-api2/start """ import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from utils i...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/ssh_util.py
""" Qxf2 Services: Utility script to ssh into a remote server * Connect to the remote server * Execute the given command * Upload a file * Download a file """ import paramiko import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from conf import ssh_conf as conf_file import socket ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/xpath_util.py
""" Qxf2 Services: Utility script to generate XPaths for the given URL * Take the input URL from the user * Parse the HTML content using beautifilsoup * Find all Input and Button tags * Guess the XPaths * Generate Variable names for the xpaths * To run the script in Gitbash use command 'python -u utils/xpath_util.py' ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/results.py
""" Tracks test results and logs them. Keeps counters of pass/fail/total. """ import logging from utils.Base_Logging import Base_Logging class Results(object): """ Base class for logging intermediate test outcomes """ def __init__(self, level=logging.DEBUG, log_file_path=None): self.logger = Base_Log...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/string_to_int_util.py
''' Qxf2 Services: This utility is for converting string to integer. string_to_int(): This is particularly useful when you want to convert any string to integer. ''' class String_To_Int(): "Class to convert string to integer" def string_to_int(self,str_var): "Method to convert string to integer" ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Image_Compare.py
""" Qxf2 Services: Utility script to compare images * Compare two images(actual and expected) smartly and generate a resultant image * Get the sum of colors in an image """ from PIL import Image, ImageChops import math, os def rmsdiff(im1,im2): "Calculate the root-mean-square difference between two images" h ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/stop_test_exception_util.py
''' This utility is for Custom Exceptions. a) Stop_Test_Exception You can raise a generic exceptions using just a string. This is particularly useful when you want to end a test midway based on some condition. ''' class Stop_Test_Exception(Exception): def __init__(self,message): self.message=message ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/email_util.py
""" A simple IMAP util that will help us with account activation * Connect to your imap host * Login with username/password * Fetch latest messages in inbox * Get a recent registration message * Filter based on sender and subject * Return text of recent messages [TO DO](not in any particular order) 1. Extend to POP3 s...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Tesults.py
import tesults import conf.tesults_conf as conf_file cases = [] def add_test_case(data): cases.append(data) def post_results_to_tesults (): token = conf_file.target_token_default # uses default token unless otherwise specified data = { 'target': token, 'results': { 'cases': cases } } ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/__init__.py
"Check if dict item exist for given key else return none" def get_dict_item(from_this, get_this): """ get dic object item """ if not from_this: return None item = from_this if isinstance(get_this, str): if get_this in from_this: item = from_this[get_this] else: ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Gif_Maker.py
""" Qxf2 Services: This utility is for creating a GIF of all the screenshots captured during current test run """ import imageio import os def make_gif(screenshot_dir_path,name = "test_recap",suffix=".gif",duration=2): "Creates gif of the screenshots" gif_name = None images = [] if "/" in name: ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/post_test_reports_to_slack.py
''' A Simple API util which used to post test reports on Slack Channel. Steps to Use: 1. Generate Slack incoming webhook url by reffering our blog: https://qxf2.com/blog/post-pytest-test-results-on-slack/ & add url in our code 2. Generate test report log file by adding ">log/pytest_report.log" command at end of py.tes...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/BrowserStack_Library.py
""" First version of a library to interact with BrowserStack's artifacts. For now, this is useful for: a) Obtaining the session URL b) Obtaining URLs of screenshots To do: a) Handle expired sessions better """ import os,requests from conf import remote_credentials as remote_credentials class BrowserStack_Library()...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Base_Logging.py
""" Qxf2 Services: A plug-n-play class for logging. This class wraps around Python's loguru module. """ import os, inspect import pytest,logging from loguru import logger from pytest_reportportal import RPLogger, RPLogHandler class Base_Logging(): "A plug-n-play class for logging" def __init__(self,log_file_na...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/clean_up_repo.py
""" The Qxf2 automation repository ships with example tests. Run this file to delete all the example files and start fresh with your example. After this script runs, you will need to edit a few files to configure them to suit your own repository Usage: python clean_up_repo.py """ import os, sys sys.path.append(os.path....
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/testrail.py
# # TestRail API binding for Python 3.x (API v2, available since # TestRail 3.0) # Compatible with TestRail 3.0 and later. # # Learn more: # # http://docs.gurock.com/testrail-api2/start # http://docs.gurock.com/testrail-api2/accessing # # Copyright Gurock Software GmbH. See license.md for details. # import requests im...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/excel_compare.py
""" Qxf2 Services: Utility script to compare two excel files using openxl module """ import openpyxl import os class Excel_Compare(): def is_equal(self,xl_actual,xl_expected): "Method to compare the Actual and Expected xl file" result_flag = True if not os.path.exists(xl_actual): ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Option_Parser.py
""" Class to wrap around parsing command line options """ import optparse from conf import base_url_conf as conf class Option_Parser: "The option parser class" def __init__(self,usage="\n----\n%prog -b <OPTIONAL: Browser> -c <OPTIONAL: configuration_file> -u <OPTIONAL: APP URL> -a <OPTIONAL: API URL> -r <Tes...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/email_pytest_report.py
""" Qxf2 Services: Utility script to send pytest test report email * Supports both text and html formatted messages * Supports text, html, image, audio files as an attachment To Do: * Provide support to add multiple attachment Note: * We added subject, email body message as per our need. You can update that as per yo...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/csv_compare.py
""" Qxf2 Services: Utility script to compare two csv files. """ import csv,os class Csv_Compare(): def is_equal(self,csv_actual,csv_expected): "Method to compare the Actual and Expected csv file" result_flag = True if not os.path.exists(csv_actual): result_flag = False ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/test_path.py
import os,sys import shutil sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from conf import test_path_conf as conf #get details from conf file for POM src_pom_files_list = conf.src_pom_files_list dst_folder_pom = conf.dst_folder_pom #check if POM folder exists and then copy files if os.p...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/Wrapit.py
""" Class to hold miscellaneous but useful decorators for our framework """ from inspect import getfullargspec class Wrapit(): "Wrapit class to hold decorator functions" def _exceptionHandler(f): "Decorator to handle exceptions" def inner(*args,**kwargs): try: ret...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/setup_testrail.py
""" One off utility script to setup TestRail for an automated run This script can: a) Add a milestone if it does not exist b) Add a test run (even without a milestone if needed) c) Add select test cases to the test run using the setup_testrail.conf file d) Write out the latest run id to a 'latest_test_run.txt' file Th...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/utils/copy_framework_template.py
""" This script would copy the required framework files from the input source to the input destination given by the user. 1. Copy files from POM to the newly created destination directory. 2. Verify if the destination directory is created and create the sub-folder to copy files from POM\Conf. 3. Verify if the destinati...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/__init__.py
""" GMail! Woo! """ __title__ = 'gmail' __version__ = '0.1' __author__ = 'Charlie Guo' __build__ = 0x0001 __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2013 Charlie Guo' from .gmail import Gmail from .mailbox import Mailbox from .message import Message from .exceptions import GmailException, ConnectionErr...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/message.py
import datetime import email import re import time import os from email.header import decode_header, make_header from imaplib import ParseFlags class Message(): def __init__(self, mailbox, uid): self.uid = uid self.mailbox = mailbox self.gmail = mailbox.gmail if mailbox else None ...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/gmail.py
from __future__ import absolute_import import re import imaplib from .mailbox import Mailbox from .utf import encode as encode_utf7, decode as decode_utf7 from .exceptions import * class Gmail(): # GMail IMAP defaults GMAIL_IMAP_HOST = 'imap.gmail.com' GMAIL_IMAP_PORT = 993 # GMail SMTP defaults ...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/utils.py
from .gmail import Gmail def login(username, password): gmail = Gmail() gmail.login(username, password) return gmail def authenticate(username, access_token): gmail = Gmail() gmail.authenticate(username, access_token) return gmail
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/mailbox.py
from .message import Message from .utf import encode as encode_utf7, decode as decode_utf7 class Mailbox(): def __init__(self, gmail, name="INBOX"): self.name = name self.gmail = gmail self.date_format = "%d-%b-%Y" self.messages = {} @property def external_name(self): ...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/exceptions.py
# -*- coding: utf-8 -*- """ gmail.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Gmails' exceptions. """ class GmailException(RuntimeError): """There was an ambiguous exception that occurred while handling your request.""" class ConnectionError(GmailException): """A Connection error oc...
0
qxf2_public_repos/pr-training-example/utils
qxf2_public_repos/pr-training-example/utils/gmail/utf.py
# The contents of this file has been derived code from the Twisted project # (http://twistedmatrix.com/). The original author is Jp Calderone. # Twisted project license follows: # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/Base_Page.py
""" Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.action...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/zero_page.py
""" This class models the first dummy page needed by the framework to start. URL: None Please do not modify or delete this page """ from .Base_Page import Base_Page class Zero_Page(Base_Page): "Page Object for the dummy page" def start(self): "Use this method to go to specific URL -- if needed" ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/Mobile_Base_Page.py
""" Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import unittest,time,logging,os,inspect from utils.Base_Logging import Base_Logging f...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/driverfactory.py
""" DriverFactory class This module gets the webdrivers for different browsers and sets up the remote testing platforms for automation tests and mobile tests. """ import os import sys from selenium import webdriver from selenium.webdriver.remote.webdriver import RemoteConnection from appium import webdriver as mobile_w...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/PageFactory.py
""" PageFactory uses the factory design pattern. get_page_object() returns the appropriate page object. Add elif clauses as and when you implement new pages. Pages implemented so far: 1. """ from page_objects.zero_page import Zero_Page from page_objects.home_page import Home_Page import conf.base_url_conf class Page...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/home_page.py
""" Models the home page of weather shopper """ from .Base_Page import Base_Page from utils.Wrapit import Wrapit import conf.locators_conf as LOCATORS class Home_Page(Base_Page): "Home page of the application" def start(self): "Use this method to go to specific URL -- if needed" url = '/' ...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/page_objects/zero_mobile_page.py
""" This class models the first dummy page needed by the framework to start. URL: None Please do not modify or delete this page """ from .Mobile_Base_Page import Mobile_Base_Page class Zero_Mobile_Page(Mobile_Base_Page): "Page Object for the dummy page" def start(self): "Use this method to go to speci...
0
qxf2_public_repos/pr-training-example/page_objects
qxf2_public_repos/pr-training-example/page_objects/drivers/remote_options.py
""" Set the desired option for running the test on a remote platform. """ from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from conf import remote_credentials import os import requests import json from datetime import datetime class RemoteOptions(): """Class contains methods for vario...
0
qxf2_public_repos/pr-training-example/page_objects
qxf2_public_repos/pr-training-example/page_objects/drivers/local_browsers.py
""" Get the webrivers for local browsers. """ from conf import opera_browser_conf from selenium.webdriver.chrome.options import Options import sys from selenium import webdriver class LocalBrowsers(): """Class contains methods for getting webfrivers for various browsers.""" @staticmethod def firefox_local...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/tesults_conf.py
""" Conf file to hold Tesults target tokens: Create projects and targets from the Tesults configuration menu: https://www.tesults.com You can regenerate target tokens from there too. Tesults upload will fail unless the token is valid. utils/Tesults.py will use the target_token_default unless otherwise specified Find o...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/ssh_conf.py
""" This config file would have the credentials of remote server, the commands to execute, upload and download file path details. """ #Server credential details needed for ssh HOST='Enter your host details here' USERNAME='Enter your username here' PASSWORD='Enter your password here' PORT = 22 TIMEOUT = 10 #.pem file d...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/clean_up_repo_conf.py
""" The file will have relative paths for dir and respective files which clean_up_repo.py will delete. """ import os # Declaring directories as directory list # dir_list : list REPO_DIR = os.path.dirname(os.path.dirname(__file__)) CONF_DIR = os.path.join(REPO_DIR, 'conf') ENDPOINTS_DIR = os.path.join(REPO_DIR, 'endpoi...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/email_conf.py
#Details needed for the Gmail #Fill out the email details over here imaphost="imap.gmail.com" #Add imap hostname of your email client username="Add your email address or username here" #Login has to use the app password because of Gmail security configuration # 1. Setup 2 factor authentication # 2. Follow the 2 facto...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/testrail_caseid_conf.py
""" Conf file to hold the testcase id """ test_example_form = 125 test_example_table = 126 test_example_form_name = 127 test_example_form_email = 128 test_example_form_phone = 129 test_example_form_gender = 130 test_example_form_footer_contact = 131 test_bitcoin_price_page_header = 234 test_bitcoin_real_time_price = 2...
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/setup_testrail.conf
[Example_Form_Test] case_ids = 125,127,128,129,130 [Example_Table_Test] case_ids = 126
0
qxf2_public_repos/pr-training-example
qxf2_public_repos/pr-training-example/conf/ports_conf.py
""" Specify the port in which you want to run your local mobile tests """ port = 4723
0