Skip to content

Commit 4bfcb5e

Browse files
committed
feat: add basic tests and instalation files
1 parent 4485b9f commit 4bfcb5e

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Mandatory environment variables
2+
WOPEE_PROJECT_URL=https://dronjo.wopee.io/ # Base url of your project
3+
WOPEE_PROJECT_UUID=put-your-project-uuid-here # Get your Project UUID from PROJECT SETTINGS / API keys
4+
# WOPEE_API_KEY= # Wopee project API key should be provided via secret environmet variable
5+
# GITHUB_TOKEN= # GitHub token is used in .npmrc file to download public packages from GitHub Package Registry
6+
7+
# Optional environment variables
8+
# WOPEE_BRANCH_NAME=master
9+
# WOPEE_CI_BUILD_ID=build-123
10+
# WOPEE_CUSTOM_TAGS=custom-tag
11+
# WOPEE_ENABLE_SOFT_ASSERT=true
12+
# WOPEE_PIXEL_TO_PIXEL_DIFF_TOLERANCE=0.1
13+
# WOPEE_API_URL=https://api.wopee.io/

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run Robot Framework tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
robot-file:
7+
description: 'Select robot file with tests to run'
8+
type: choice
9+
options:
10+
- tests/01-main.robot
11+
- tests/02-dronjo-simple.robot
12+
- tests/03-dronjo-advanced.robot
13+
required: true
14+
default: tests/01-main.robot
15+
16+
jobs:
17+
configure:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
uid_gid: ${{ env.UID_GID }}
21+
steps:
22+
- id: get-user
23+
run: echo "UID_GID=$(id -u):$(id -g)" >> $GITHUB_ENV
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
needs: configure
28+
container:
29+
image: ghcr.io/wopee-io/runtime
30+
options: --user ${{ needs.configure.outputs.uid_gid }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Run tests
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
WOPEE_API_KEY: ${{ secrets.WOPEE_API_KEY }}
39+
WOPEE_API_URL: ${{ vars.WOPEE_API_URL || 'https://api.wopee.io' }}
40+
WOPEE_PROJECT_UUID: ${{ vars.WOPEE_PROJECT_UUID }}
41+
WOPEE_PROJECT_URL: ${{ vars.WOPEE_PROJECT_URL || 'https://dronjo.wopee.io' }}
42+
# WOPEE_SCREENSHOT_VALIDATION_ENABLED: "true"
43+
# WOPEE_BRANCH_NAME: master
44+
# WOPEE_CI_BUILD_ID: build-123
45+
# WOPEE_CUSTOM_TAGS: custom-tag
46+
# WOPEE_ENABLE_SOFT_ASSERT: "true"
47+
# WOPEE_PIXEL_TO_PIXEL_DIFF_TOLERANCE: "0.1"
48+
run: robot ${{ github.event.inputs.robot-file }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Wopee.rf
2+
screenshots
3+
wopee_rf-*.tar.gz
4+
15
# Robot Report
26
log.html
37
output.xml

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
install:
2+
python -m venv .venv && \
3+
source .venv/bin/activate && \
4+
pip install -r requirements.txt && \
5+
cp .env.example .env
6+
7+
test:
8+
source .venv/bin/activate && \
9+
robot tests/
10+
11+
clean:
12+
rm -rf reports/

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
robotframework-seleniumlibrary
2+
wopee_rf-1.1.0.tar.gz

tests/agnostic_standalone.robot

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
*** Settings ***
2+
Library SeleniumLibrary
3+
Library wopee_rf.Wopee dot_env_path=.env
4+
5+
6+
*** Test Cases ***
7+
Test Browser Framework Agnostic Track
8+
Open Browser https://wopee.io headlesschrome
9+
Set Screenshot Directory screenshots/selenium
10+
11+
${timestamp} Generate Timestamp
12+
13+
Start Suite suite_name=Suite name-${timestamp}
14+
Start Scenario scenario_name=Scenario name-${timestamp}
15+
16+
${image_path} Capture Page Screenshot
17+
${image_base64} Convert Image to Base64 ${image_path}
18+
19+
&{payload} Create Dictionary image_base64=${image_base64} step_name=Step name-${timestamp}
20+
${track_result} Track payload=&{payload}
21+
22+
Stop Scenario
23+
24+
25+
*** Keywords ***
26+
Convert Image to Base64
27+
[Arguments] ${image_path}
28+
${image_base64} Evaluate
29+
... sys.modules['base64'].b64encode(open(r"${image_path}", 'rb').read()).decode('utf-8')
30+
... base64
31+
RETURN ${image_base64}
32+
33+
Generate Timestamp
34+
${timestamp} Evaluate int(datetime.datetime.now().timestamp()) datetime
35+
RETURN ${timestamp}

0 commit comments

Comments
 (0)