Skip to content

Instantly share code, notes, and snippets.

Avatar
🤩
code with love ... test with imagination

0xIslamTaha 0xIslamTaha

🤩
code with love ... test with imagination
View GitHub Profile
View 0xislamTaha.json
{
"Twitter": "@0xislamtaha",
"Github": "github.com/0xIslamTaha",
"Youtube": "youtube.com/c/0xislamtaha",
"Medium": "0xIslamTaha.medium.com"
}
View over.sh
# overwrite the specs list
npx orchestrator --config orchestrator.json --specs '["avatar.js"]'
# overwrite the specs list and export environment variables.
npx orchestrator --config orchestrator.json --specs '["avatar.js"]' --environment '{"DOCKER_TAG":"master_35"}'
# overwrite the timeout and the parallelizm
npx orchestrator --config orchestrator.jon --timeout 50m --parallelizm 2
View orchestrator.json
{
"parallelizm": 1,
"browsers": ["chrome", "firefox"],
"timeout": "30m",
"environment": {},
"preCommands": [
"echo 'START ORCHESTRATOR'",
"rm -rf cypress/report/* #Remove the old reports",
"mkdir -p mochawesome-report"
],
View docker-compose.yml
version: '3.8'
services:
cypress-container:
build: ./
network_mode: "bridge"
volumes:
- ./cypress/:/orechestrator_usecase/cypress
- ./mochawesome-report:/orechestrator_usecase/mochawesome-report
- /dev/shm:/dev/shm
View Dockerfile
FROM cypress/browsers:node14.16.0-chrome89-ff86
WORKDIR /orechestrator_usecase
COPY package.json package-lock.json cypress.json ./
RUN npm ci && npx cypress verify
@0xIslamTaha
0xIslamTaha / openvpn_installer_additional_command.sh
Created Aug 31, 2020
openvpn_installer_additional_command.sh
View openvpn_installer_additional_command.sh
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl -p
View generate_tc_lists.py
```python
count = 1
for i in range(15):
ids = ''
s = 'ui_testing/testcases/basic_tests/test06_orders.py:OrdersTestCases --with-id'
for k in range(5):
ids= f"{ids} {count}"
count = count + 1
print(f'"{s}{ids}",')
@0xIslamTaha
0xIslamTaha / command.js
Created Apr 13, 2020
custom matchImageSnapshot command
View command.js
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
const snapshotsFolder = Cypress.config('customSnapshotsDir');
const waitForFirstTime = Cypress.config('waitForFirstTime');
addMatchImageSnapshotCommand();
Cypress.Commands.add(
'waitMatchImageSnapshot',
{
prevSubject: 'optional',
View cypress_notes.md

Find elements:

  • Cypress get or find selecet elements based on (CSS selectors)[https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors]
  • Cypress get looks in the whole DOM and it usually returns #all# elements matching the selecotr. You can use .eq(n) to get the nth element.
  • Cypress find ususally used after get and looks inside the parent element.

Find elements attributes (href):

  • cy.get('css_selector').its('href')
  • cy.get('a').each( ($element, index, $list){ cy.wrap($element).its('href');
View docker.sh
# remove all docker containers
docker rm -f $(docker container ls -aq)
# remove all none images
docker image rm -f $(docker images -a | grep none | awk -F' ' '{ print $3 }')