Skip to content

Instantly share code, notes, and snippets.

Testing and validating the redirection/URL of a QR Code is essential for a Test Engineer as you don't want to lose a chance of downloading your business App or even worse redirect to broken/wrong one

How to achieve this:

1- You need to install some dependencies which include a module that have API to decode QR Code/Barcode and read it for Cypress.io

npm i @zxing/browser
npm i @zxing/library
@fityanos
fityanos / iframes-with-cypress.js
Last active May 25, 2022 05:01
Handling HTML view during API testing with Iframe - Cypress
/// <reference types="Cypress"/>
/**
*
* @returns
*
* the shared HTML checkout page includes iframe
*
* * thereofe i to have to handle it and access the selectos....
*/
@fityanos
fityanos / upload-img-api-cypress.md
Last active August 22, 2022 09:19
upload images through API Cypress.io

You need to create a js file to build your helper funnction

export function XMLHttp_request(method, url, token, formData, done) {
  const xhr = new XMLHttpRequest();
  xhr.open(method, url);
  xhr.setRequestHeader("accept", "*/*");
  xhr.setRequestHeader("Authorization", `Bearer ${token}`); // only if you need token
  xhr.send(formData);
  xhr.onload = function () {
@fityanos
fityanos / mysql-cypress-connection-mac.md
Last active February 5, 2024 20:53
connecting mysql to your cypress tests

Verify if you have MYSQL

1- Through your terminal, make sure that you have mysql by running:

which mysql

2- If you got the path means you have mysql and you can verify mysql status by running:

brew services list
@fityanos
fityanos / salesforce-api-login.js
Last active May 25, 2022 04:59
Work around for cypress.io accessing salesforce
const sales_force_login_url = 'your salesforce login screen to land directly'
const sales_force_email = 'salesforce email address'
const sales_force_password = 'salesforce password'
const sales_force_ui_screen_url = 'desired salesforce screen/page'
describe(' Attempt salesforce login through API call', () => {
it('should perform magic', () => {
cy
.request(`${sales_force_login_url}?un=${sales_force_email}&pw=${sales_force_password}&startURL=%2Fhome`)
@fityanos
fityanos / testFile.php
Last active November 17, 2018 02:33
example test file
<?php
use \Codeception\Util\HttpCode as status;
/**
* Class invalidXauthAndAuthCest
*
* how to run =>
* codecept run api --env envName -g invalidXauthAndAuth --steps [execution with detailed steps]
* ********
[Appium] Welcome to Appium v1.7.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/PATH/TO/IPA/FILE.ipa","platformVersion":"12.0","automationName":"XCUITest","platformName":"iOS","deviceName":"iPhone X","launchTimeout":"5000","autoAcceptAlerts":"true"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"/PATH/TO/IPA/FILE.ipa","platformVersion":"12.0","automationName":"XCUITest","platformName":"iOS","deviceName":"iPhone X
","launchTimeout":"5000","autoAcceptAlerts":"true"},"requiredCapabilities":{},"alwaysMatch":{"platformName":"iOS"},"firstMatch":[]}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/PATH/TO/IPA/FILE.ipa","platformVersion":"12.0","automationName":"XCUITest","platformName":"iOS","deviceName":"iPhone X","launchTimeout":"5000","autoAcceptAlerts":"true"},{},{"desiredCapabilities":{"app":"/PATH/TO/IPA/FILE.ipa","platformVersion":"12.0","automationName":"XCUITest","platf
@fityanos
fityanos / exampleShellApi.sh
Created September 12, 2018 11:00
exampleShellApi
#!/usr/bin/env bash
source ../../UI/Colors.sh # Colors
source ../../TestData/BaseUrl.sh # baseUrls
source ../../TestData/SearchParamData.sh # iataCodes
source ../../TestData/DatesGenerator.sh # dates
UserAgent=`cat ././../../Headers/UserAgent.txt`
Accept=`cat ././../../Headers/Accept.txt`
ContentType=`cat ././../../Headers/ContentType.txt`
@fityanos
fityanos / exampleClassCest.php
Last active May 8, 2019 06:13
exampleClass
<?php
use \Codeception\Util\HttpCode as responseValidate;
/**
* Class classNameCest
*
* @group apiLevelOne
* @group apiLevelTwo