Skip to content

Instantly share code, notes, and snippets.

import os
import pytest
from os import environ
import time
from selenium.webdriver import ChromeOptions
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
@SarahElson
SarahElson / test_main.py
Created October 1, 2024 11:11
Python Asyncio Tutorial: A Complete Guide
import pytest
import aiohttp
import sys
import os
# Add the project directory to the system path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'app')))
from fastapi.testclient import TestClient
from main import app # Import the app from app/main.py
@SarahElson
SarahElson / main.py
Created October 1, 2024 11:09
Python Asyncio Tutorial: A Complete Guide
import os
import ssl
import certifi
import aiohttp
from fastapi import FastAPI, HTTPException
from dotenv import load_dotenv
load_dotenv()
@SarahElson
SarahElson / lambdatest-config.json
Last active September 17, 2024 14:57
How To Run Cypress Tests In Azure DevOps Pipeline
{
"lambdatest_auth": {
"username": "<username>",
"access_key": "<access_key>"
},
"browsers": [
{
"browser": "Chrome",
"platform": "Windows 10",
"versions": ["latest"]
@SarahElson
SarahElson / azure-pipelines.yml
Created September 17, 2024 14:05
How To Run Cypress Tests In Azure DevOps Pipeline
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
@SarahElson
SarahElson / testng.xml
Created September 13, 2024 12:54
How to Test Biometric Authentication With Appium
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Biometric authentication tests for Android using appium">
<test name="WebDriverIO Android App Biometric Authentication Test">
<parameter name="deviceType" value="local"/>
<classes>
<class name="io.github.mfaisalkhatri.tests.BiometricAuthTests">
<methods>
<include name="testFingerPrintAuthenticationLogin"/>
</methods>
@SarahElson
SarahElson / LoginPage.java
Created September 13, 2024 12:54
How to Test Biometric Authentication With Appium
public class LoginPage {
private final AndroidDriver androidDriver;
private final WebDriverWait wait;
public LoginPage(final AndroidDriver androidDriver) {
this.androidDriver = androidDriver;
this.wait = new WebDriverWait(androidDriver, Duration.ofSeconds(10));
}
@SarahElson
SarahElson / MainPage.java
Created September 13, 2024 12:53
How to Test Biometric Authentication With Appium
public class MainPage {
private final AndroidDriver androidDriver;
public MainPage(final AndroidDriver androidDriver) {
this.androidDriver = androidDriver;
}
public void openMenu(final String menuName) {
this.androidDriver.findElement(AppiumBy.accessibilityId(menuName)).click();
@SarahElson
SarahElson / BiometricAuthTests.java
Created September 13, 2024 12:51
How to Test Biometric Authentication With Appium
public class BiometricAuthTests extends BaseTest {
@Test
public void testFingerPrintAuthenticationLogin() {
final MainPage mainPage = new MainPage(this.androidDriverManager.getAndroidDriver());
final LoginPage loginPage = mainPage.openLoginPage();
loginPage.performBioMetricLogin(1);
@SarahElson
SarahElson / BaseTest.java
Created September 13, 2024 12:50
How to Test Biometric Authentication With Appium
public class BaseTest {
protected AndroidDriverManager androidDriverManager;
@Parameters({"deviceType"})
@BeforeClass(alwaysRun = true)
public void setup(final String deviceType) {
this.androidDriverManager = new AndroidDriverManager();
if (deviceType.equalsIgnoreCase("LOCAL")) {