Skip to content

Instantly share code, notes, and snippets.

View bbchriscesar's full-sized avatar
🏠
Working from home

Christianne Cesar bbchriscesar

🏠
Working from home
View GitHub Profile
test('A user can copy a post in the feed card', async ({ page }) => {
const loginPage = new LoginPage(page);
const feedPage = new FeedPage(page);
const postText = TestHelpers.generateRandomPostText();
await setupUserSession(loginPage, feedPage);
await feedPage.createPost(postText);
// Verify post creation
await expect(feedPage.sendingPostMessage).toBeVisible();

AI Code Review Prompt for Professional Standards

Instructions

Please review the following Playwright TypeScript test automation code and evaluate it against professional standards. Focus on identifying whether the code appears AI-generated and provide specific recommendations for improvement.

Review Criteria

1. Code Quality & Professionalism

  • Variable Naming: Are variables named meaningfully and domain-specifically? Flag generic names like element, data, result, item, temp, value1, response
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
// Enable network request interception
await context.route('**/*', (route, request) => {
// Intercept the network request
console.log(`Intercepted: ${request.url()}`);
@bbchriscesar
bbchriscesar / scan_and_delete.bat
Created April 4, 2023 16:41
This Windows batch script will scan a given directory and permanently delete any files or subdirectories found without warning. If no files or subdirectories are found, the script will simply exit without taking any action.
@echo off
set dir_path=C:\Example\Directory
if not exist "%dir_path%" (
echo Directory does not exist.
exit /b
)
echo Scanning directory "%dir_path%"...
@bbchriscesar
bbchriscesar / install_apk.cmd
Created April 4, 2023 10:41
This Windows batch script is designed to scan a directory for APK files and install them via ADB. The script was particularly helpful to me in a CI/CD setup.
@echo off
set "dir=C:\path\to\APK\files"
for /r "%dir%" %%i in (*.apk) do (
set "filename=%%~nxi"
goto install
)
echo No APK files found in %dir%
goto end
:install
import os
from time import sleep
# os.system("start /B start cmd.exe @cmd /k appium")
os.system("start /B start cmd.exe @cmd /k appium -a 127.0.0.1 -p 4728")
sleep(8)
os.system("taskkill /F /IM node.exe")
os.system("taskkill /F /IM cmd.exe")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
import time
mobile_emulation = {
"deviceMetrics": { "width": 411, "height": 731, "pixelRatio": 3.0 },
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19" } # For LINUX
#"userAgent": "mobile web mac : "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" } # For MAC
#!/bin/bash
## declare an array variable
## declare -a arr=("element1" "element2" "element3")
local=(ja)
#local=(pt-BR pt-PT ru th tr vi zh-TW)
function switchLocal(){
adb shell am broadcast -a com.google.android.testing.i18n.localeswitcher.CHANGE_LOCALE -e LANGUAGE_TAG "$1"
}
import pytest
from appium import webdriver
import time
@pytest.mark.parametrize("udid, systemPort", [
("FA7BN1A04058", "8201"),
("FA7BN1A04086", "8202")
]
)
def test_SettingsTestCase(udid, systemPort):
from appium import webdriver
import time
import os.path
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
xpath = By.XPATH
id = By.ID
css = By.CSS_SELECTOR