repo_id
stringclasses
208 values
file_path
stringlengths
31
190
content
stringlengths
1
2.65M
__index_level_0__
int64
0
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/AccModels.js
import React, { useEffect, useState } from "react"; import { Container, Typography, Box, Button } from "@mui/material"; import { fetchACCModels, createACCModel, updateACCModel, deleteACCModel, } from "../services/accModelService"; import AccModelForm from "../components/accModels/AccModelForm"; import AccModelL...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Users.js
import React, { useEffect, useState } from "react"; import { Container, Typography} from "@mui/material"; import { fetchUsers, createUser, updateUser, deleteUser, } from "../services/userService"; import UserForm from "../components/users/UserForm"; import UserList from "../components/users/UserList"; import Co...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Attributes.js
import React, { useEffect, useState } from "react"; import { Container, Typography, Box, Button } from "@mui/material"; import { fetchAttributes, createAttribute, updateAttribute, deleteAttribute, } from "../services/attributeService"; import AttributeForm from "../components/attributes/AttributeForm"; import A...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Home.js
import React from "react"; import { Container, Typography, Grid, Button, Box, Link as MuiLink, } from "@mui/material"; import { Link } from "react-router-dom"; const styles = { heroSection: { backgroundColor: "#708C70", // Sage green color width: "100vw", minHeight: "50vh", display: "flex...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Login.js
import React, { useState } from "react"; import { Button, TextField, Typography, Container } from "@mui/material"; import { useNavigate } from "react-router-dom"; import { login } from "../services/loginService"; /** * A React component for logging in to the application. * * This component renders a login form with...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/HistoricalComparison.js
import React, { useState, useEffect } from "react"; import { Box, TextField, Container, Grid, Typography, MenuItem, Accordion, AccordionDetails, AccordionSummary, } from "@mui/material"; import { Bar } from "react-chartjs-2"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import { fetchH...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Components.js
import React, { useEffect, useState } from "react"; import { Container, Typography, Box, Button } from "@mui/material"; import { fetchACCModels, fetchComponents, createComponent, updateComponent, deleteComponent, } from "../services/componentService"; import ComponentForm from "../components/components/Compon...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Capabilities.js
import React, { useEffect, useState } from "react"; import { Container, Typography, Box } from "@mui/material"; import AccModelSelector from "../components/capabilities/AccModelSelector"; import CapabilityForm from "../components/capabilities/CapabilityForm"; import CapabilityList from "../components/capabilities/Capab...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/AggregateRatings.js
import React, { useEffect, useState } from "react"; import { Box, Container, Typography, MenuItem, TextField, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, IconButton, } from "@mui/material"; import Grid from "@mui/material/Unstable_Grid2"; import { ExpandMore, Expan...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/pages/Ratings.js
import React, { useEffect, useState } from "react"; import { Box, Container, Typography, MenuItem, TextField, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, IconButton, Button, Dialog, DialogActions, DialogContent, DialogTitle, Snackbar, Tooltip, } from ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/loginService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; export const login = async (username, password) => { try { const response = await axios.post( `${API_BASE_URL}/token`, new URLSearchParams({ username, password, grant_type: "password", }...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/userService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; const getAuthHeaders = () => { const token = localStorage.getItem("authToken"); if (!token) { console.error("User is not authenticated"); return {}; } return { headers: { Authorization: `Bearer ${token}`, ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/componentService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; const getAuthHeaders = () => { const token = localStorage.getItem("authToken"); if (!token) { console.error("User is not authenticated"); return {}; } return { headers: { Authorization: `Bearer ${token}`, ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/apiService.js
import axios from "axios"; import { getAuthHeaders } from "./authService"; const apiClient = axios.create({ baseURL: process.env.REACT_APP_API_BASE_URL, }); apiClient.interceptors.request.use( async (config) => { try { const headers = await getAuthHeaders(); config.headers = { ...config.headers, ....
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/ratingsService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; export const fetchACCModels = async () => { try { const response = await axios.get(`${API_BASE_URL}/acc-models`); return response.data; } catch (error) { console.error("Error fetching ACC models:", error); throw er...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/capabilitiesService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; const getAuthHeaders = () => { const token = localStorage.getItem("authToken"); if (!token) { console.error("User is not authenticated"); return {}; } return { headers: { Authorization: `Bearer ${token}`, ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/attributeService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; const getAuthHeaders = () => { const token = localStorage.getItem("authToken"); if (!token) { console.error("User is not authenticated"); return {}; } return { headers: { Authorization: `Bearer ${token}`, ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/registerService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; export const registerUser = async (userData) => { try { const response = await axios.post(`${API_BASE_URL}/users/`, userData); console.log("Registration response:", response); return response; } catch (error) { con...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/authService.js
import axios from "axios"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; /** * Refreshes an access token by making a request to the server with the current * token. If the refresh is successful, the new access token is stored in * localStorage and returned. If the refresh fails, an error is thrown. * ...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/accModelService.js
import axios from "axios"; import getAuthHeaders from "./authService"; const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; export const fetchACCModels = async () => { try { const headers = await getAuthHeaders(); const response = await axios.get(`${API_BASE_URL}/acc-models`, headers); return respon...
0
qxf2_public_repos/acc-model-app/frontend/src
qxf2_public_repos/acc-model-app/frontend/src/services/api.js
import axios from 'axios'; const api = axios.create({ baseURL: process.env.REACT_APP_API_BASE_URL, }); export default api;
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/bandit.yml
# Skip flagging assert statement inclusion in test during Codacy check assert_used: skips: ['*/test_*.py']
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/conftest.py
""" Pytest configuration and shared fixtures This module contains the common pytest fixtures, hooks, and utility functions used throughout the test suite. These fixtures help to set up test dependencies such as browser configurations, base URLs, and external services (e.g., BrowserStack, SauceLabs, TestRail, Report P...
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/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/acc-model-app
qxf2_public_repos/acc-model-app/tests/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/acc-model-app
qxf2_public_repos/acc-model-app/tests/requirements.txt
requests==2.32.0 reportportal-client==5.5.4 pytest==8.1.1 selenium==4.12.0 python_dotenv==0.16.0 Appium_Python_Client==3.2.0 pytest-xdist>=1.31 pytest-html>=3.0.0 pytest-rerunfailures>=9.1.1 pytest_reportportal==5.4.0 pillow>=6.2.0 tesults==1.2.1 boto3==1.33.0 loguru imageio questionary>=1.9.0 clear-screen>=0.1.14 prom...
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/env_remote
#Set REMOTE_BROWSER_PLATFROM TO BS TO RUN ON BROWSERSTACK else #SET REMOTE_BROWSER_PLATFORM TO SL TO RUN ON SAUCELABS #SET REMOTE_BROWSER_PLATFORM TO LT TO RUN ON LAMBDATEST REMOTE_BROWSER_PLATFORM = "BS" REMOTE_USERNAME = "Enter your username" REMOTE_ACCESS_KEY = "Enter your access key"
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/env_conf
# Tesults Configuration tesults_target_token_default = "" #TestRail url and credentials testrail_url = "Add your testrail url" testrail_user = 'TESTRAIL_USERNAME' testrail_password = 'TESTRAIL_PASSWORD' #Details needed for the Gmail #Fill out the email details over here imaphost ="imap.gmail.com" #Add imap hostname...
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/Readme.md
## **Run API Tests** We are using the Qxf2 Page Object Model (POM) framework to run API tests for the ACC Model App. This framework helps in organizing and executing API test cases efficiently by providing a structured approach, reusable components, and easy integration with backend services for testing various API ...
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/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/acc-model-app
qxf2_public_repos/acc-model-app/tests/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}/weather-shopper-app-apk/app/ #Command to run the test commands = p...
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/entrypoint.sh
#!/bin/bash export DISPLAY=:20 Xvfb :20 -screen 0 1366x768x16 & # Start x11vnc x11vnc -passwd TestVNC -display :20 -N -forever & # Run CMD command exec "$@"
0
qxf2_public_repos/acc-model-app
qxf2_public_repos/acc-model-app/tests/env_ssh_conf
#Server credential details needed for ssh HOST = 'Enter your host details here' USERNAME = 'USERNAME' PASSWORD = 'PASSWORD' PORT = 22 TIMEOUT = 10 #.pem file details PKEY = 'Enter your key filename here' #Sample commands to execute(Add your commands here) COMMANDS = ['ls;mkdir sample'] #Sample file locations to upl...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 """ import logging from utils.results import Results from .api_interface import APIInterface class ...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/endpoints/base_api.py
""" A wrapper around Requests to make Restful API calls """ import asyncio import requests from requests.exceptions import HTTPError, RequestException class BaseAPI: "Main base class for Requests based scripts" session_object = requests.Session() base_url = None def get(self, url, headers=None): ...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/endpoints/user_api_endpoints.py
""" API endpoints get user information """ from .base_api import BaseAPI class UserAPIEndpoints(BaseAPI): "Class for user endpoints" def user_url(self,suffix=''): """Append API end point to base URL""" return self.base_url+'/users/users/me'+suffix def get_user(self,headers): "get us...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/endpoints/api_interface.py
""" A composed Interface for all the Endpoint abstraction objects: * ACC Model API Endpoints The APIPlayer Object interacts only to the Interface to access the Endpoint """ from .create_acc_model_endpoints import AccAPIEndpoints from .user_api_endpoints import UserAPIEndpoints class APIInterface(AccAPIEndpoints,UserA...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/endpoints/create_acc_model_endpoints.py
""" API methods for endpoints """ from .base_api import BaseAPI class AccAPIEndpoints(BaseAPI): """Class for ACC model endpoints""" def acc_url(self, suffix=''): "Append endpoint to base URL" return self.base_url + suffix def create_acc_model(self, data, headers): "Adds a new ACC...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_end_to_end_api_test.py
""" API automated test for ACC model app 1. Create a new ACC model name 2. Create an attribute 3. Create a component 4. Create a capability 5. Submit ratings 6. Delete newly created ACC model """ import os import sys import pytest from conf import api_acc_model_conf as conf sys.path.append(os.path.dirname(os.path.dirn...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_multiple_acc_models.py
""" API automated test for ACC model app 1. Create new multiple ACC models 2. Delete the newly created ACC models """ import os import sys import time import pytest from conf import api_acc_model_conf as conf sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @pytest.mark.API def test_multip...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_multiple_components.py
""" API automated test for ACC model app 1. Create an ACC model name 2. Create multiple components for each ACC model name 3. Delete an ACC model """ import os import sys import pytest from conf import api_acc_model_conf as conf sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @pytest.mark...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_submit_multiple_ratings.py
""" API automated test for ACC model app 1. Create an ACC model 2. Create multiple attributes 3. Create components for the ACC model 4. Create capabilities for each component 5. Submit ratings for capabilities with different ratings 6. Delete created attributes and an ACC model """ import os import sys import time imp...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_multiple_attributes.py
""" API automated test for ACC model app 1. Create and delete multiple attributes """ import os import sys import time import pytest from conf import api_acc_model_conf as conf sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @pytest.mark.API def test_create_and_delete_multiple_attributes...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/tests/test_multiple_capabilities.py
""" API automated test for ACC model app 1. Create ACC models 2. Create multiple components 3. Create multiple capabilities 4. Delete all ACC models which were created """ import os import sys import pytest from conf import api_acc_model_conf as conf sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__fi...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import socket import paramiko from dotenv import load_dotenv load_d...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 BeautifulSoup * 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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/gpt_summary_generator.py
""" Utility function which is used to summarize the Pytest results using LLM (GPT-4). And provide recommendations for any failures encountered. The input for the script is a log file containing the detailed Pytest results. It then uses the OpenAI API to generate a summary based on the test results. The summary is writt...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/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",duration=2): "Creates gif of the screenshots" gif_name = None images = [] if "/"...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/snapshot_util.py
""" Snapshot Integration * This is a class which extends the methods of Snapshot parent class """ import conf.snapshot_dir_conf from pytest_snapshot.plugin import Snapshot snapshot_dir = conf.snapshot_dir_conf.snapshot_dir class Snapshotutil(Snapshot): "Snapshot object to use snapshot for comparisions" def _...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 sys import logging from loguru import logger import re from reportportal_client import RPLogger, RPLogHandler class Base_Logging(): "A plug-n-play class for logging" def __init__(se...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/accessibility_util.py
""" Accessibility Integration * This is a class which extends the methods of Axe parent class """ import os from axe_selenium_python import Axe script_url=os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "utils", "axe.min.js")) class Accessibilityutil(Axe): "Accessibility object to run accessibility...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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. Usage: python clean_up_repo.py """ import os import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from conf import clean_up_repo_conf as conf f...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/interactive_mode.py
""" Implementing the questionaty library to fetch the users choices for different arguments """ import os import sys import questionary from clear_screen import clear from conf import base_url_conf from conf import browser_os_name_conf as conf def display_gui_test_options(browser,browser_version,os_version, ...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/axe.min.js
!function e(window){var document=window.document,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function c(e){this.name="SupportError",this.cause=e.cause,this.mess...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/Wrapit.py
""" Class to hold miscellaneous but useful decorators for our framework """ from inspect import getfullargspec import traceback class Wrapit(): "Wrapit class to hold decorator functions" def _exceptionHandler(f): "Decorator to handle exceptions" def inner(*args,**kwargs): try: ...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/utils/copy_framework_template.py
r""" This script would copy the required framework files from the input source to the input destination given by the user. 1. Copy root files from POM to the newly created destination directory. 2. Create the sub-folder to copy files from POM\conf. 3. Create the sub-folder to copy files from POM\page_objects. 4. Create...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/cross_browsers/remote_options.py
""" Set the desired option for running the test on a remote platform. """ from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.ie.options import Options as IeOptions from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.webdriver.safari.options ...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/cross_browsers/saucelab_runner.py
""" Get the webdriver and mobiledriver for SauceLab. """ import os from selenium import webdriver from integrations.cross_browsers.remote_options import RemoteOptions from conf import remote_url_conf class SauceLabRunner(RemoteOptions): """Configure and get the webdriver and the mobiledriver for SauceLab""" de...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/cross_browsers/browserstack_runner.py
""" Get the webdriver and mobiledriver for BrowserStack. """ import os from selenium import webdriver from integrations.cross_browsers.remote_options import RemoteOptions from conf import screenshot_conf from conf import remote_url_conf class BrowserStackRunner(RemoteOptions): """Configure and get the webdriver an...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/cross_browsers/lambdatest_runner.py
""" Get the webdriver for LambdaTest browsers. """ import os import time import requests from selenium import webdriver from integrations.cross_browsers.remote_options import RemoteOptions from conf import remote_url_conf class LambdaTestRunner(RemoteOptions): """Configure and get the webdriver for the LambdaTest"...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/cross_browsers/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 import requests from conf import remote_url_conf class BrowserStack_Library(): "BrowserStack ...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_tools/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 integra...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_tools/testrail_client.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/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_tools/Tesults.py
import os import tesults cases = [] def add_test_case(data): cases.append(data) def post_results_to_tesults (): " This method is to post the results into the tesults" # uses default token unless otherwise specified token = os.getenv('tesults_target_token_default') if not token: solution ...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_tools/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/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/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/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/post_test_reports_to_slack.py
''' A Simple script 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 pytest...
0
qxf2_public_repos/acc-model-app/tests/integrations
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/email_pytest_report.py
""" Qxf2 Services: 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 your requi...
0
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/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/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/gmail/message.py
import datetime import email import re import time import os from email.header import decode_header class Message(): "Message class provides methods for mail functions." def __init__(self, mailbox, uid): self.uid = uid self.mailbox = mailbox self.gmail = mailbox.gmail if mailbox else No...
0
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/gmail/gmailtest.py
""" This is an example automated test to check gmail utils Our automated test will do the following: #login to gmail and fetch mailboxes #After fetching the mail box ,select and fetch messages and print the number of messages #and the subject of the messages Prerequisites: - Gmail account with app pas...
0
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/gmail/gmail.py
""" This module defines the `Gmail` class, which provides methods to interact with a Gmail account via IMAP. The class includes functionalities to connect to the Gmail server, login using credentials, and manage various mailboxes. Also, has functions for fetching mailboxes, selecting a specific mailbox, searching for ...
0
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/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/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/gmail/mailbox.py
""" This module defines the `Mailbox` class, which represents a mailbox in a Gmail account. The class provides methods to interact with the mailbox, including searching for emails based on various criteria, fetching email threads, counting emails, and managing cached messages. """ import re from .message import Mes...
0
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/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/acc-model-app/tests/integrations/reporting_channels
qxf2_public_repos/acc-model-app/tests/integrations/reporting_channels/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 (th...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 core_helpers.web_app_helper import Web_App_Helper class Zero_Page(Web_App_Helper): "Page Object for the dummy page" def start(self): "Use this method to go to specif...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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. Tutorial main page 2. Tutorial redirect page 3. Contact Page 4. Bitcoin main page 5. Bitcoin price page """ # pylint: disable=import-...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 core_helpers.mobile_app_helper import Mobile_App_Helper class Zero_Mobile_Page(Mobile_App_Helper): "Page Object for the dummy page" def start(self): "Use this method...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/api_acc_model_conf.py
""" Configuration for creating ACC models, attributes, components, and capabilities. """ # pylint: disable=invalid-name import time import os import random # Constant for current timestamp current_timestamp = str(int(time.time())) # Bearer token from environment variables bearer_token = os.environ.get('bearer_token')...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/remote_url_conf.py
#The URLs for connecting to BrowserStack and Sauce Labs. browserstack_url = "http://hub-cloud.browserstack.com/wd/hub" browserstack_app_upload_url = "https://api-cloud.browserstack.com/app-automate/upload" browserstack_api_server_url = "https://api.browserstack.com/automate" browserstack_cloud_api_server_url = "https:...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/snapshot_dir_conf.py
""" Conf file for snapshot directory """ import os snapshot_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'tests', 'snapshots', 'test_accessibility', 'test_accessibility', 'chrome')
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/ports_conf.py
""" Specify the port in which you want to run your local mobile tests """ port = 4723
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/screenshot_conf.py
BS_ENABLE_SCREENSHOTS = False overwrite_flag = False
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/gpt_summarization_prompt.py
summarization_prompt = """ You are a helpful assistant who specializes in providing technical solutions or recommendations to errors in Python. You will receive the contents of a consolidated log file containing results of automation tests run using Pytest. These tests were conducted using a Python Selenium framewo...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/locators_conf.py
#Common locator file for all locators #Locators are ordered alphabetically ############################################ #Selectors we can use #ID #NAME #css selector #CLASS_NAME #LINK_TEXT #PARTIAL_LINK_TEXT #XPATH ########################################### #Locators for the footer object(footer_object.py) footer_m...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/copy_framework_template_conf.py
""" This conf file would have the relative paths of the files & folders. """ import os #Files from src: src_file1 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','__init__.py')) src_file2 = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','conftest.py')) src_file3 = os.path.abspath(os.path.joi...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/base_url_conf.py
""" Conf file for base_url """ ui_base_url = "add_ui_test_url" api_base_url= "http://127.0.0.1:8000"
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/conf/browser_os_name_conf.py
""" Conf file to generate the cross browser cross platform test run configuration """ import os #Conf list for local default_browser = ["chrome"] #default browser for the tests to run against when -B option is not used local_browsers = ["firefox","chrome"] #local browser list against which tests would run if no -M...
0
qxf2_public_repos/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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/acc-model-app/tests
qxf2_public_repos/acc-model-app/tests/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 = [] def write_test_summary(self): "Print ou...
0