Skip to content

Commit

Permalink
Merge pull request #37 from RahulARanger/nodejs-reporters
Browse files Browse the repository at this point in the history
Nodejs reporters
  • Loading branch information
RahulARanger authored Dec 17, 2023
2 parents cea3367 + c1748d9 commit df4658e
Show file tree
Hide file tree
Showing 267 changed files with 7,769 additions and 4,836 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/release-server-tag.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/bash
# root directory is in root of this project
#
output="graspit-reporters/packages/graspit-commons/.version"
output="handshake-nodejs-reporters/packages/common-handshakes/.version"

if [ -f "$output" ] ; then
rm "$output"
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/dashboard-test.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/deploy-nodejs-reporters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'deploy-nodejs-reporters'

on:
push:
branches:
- "nodejs-reporters"
paths:
- '**.js'
- '**.ts'
- '**deploy-nodejs-reporters.yml' # for testing this workflow

permissions:
contents: write

jobs:
test:
name: Test Dashboard
runs-on: 'macos-latest'
permissions: write-all

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Setup Turbo Repo and conduct sanity test
working-directory: ./handshake-nodejs-reporters
run: npm install && npm run build && sudo npm run sanity

- name: Download required for Dashboard
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard
run: npm install

- name: exporting results
working-directory: ./handshake-nodejs-reporters
run: |
sudo npx handshake export ../TestResults --out ../TestReports
- name: Create Release Pull Request
uses: changesets/action@v1
with:
cwd: ./handshake-nodejs-reporters
publish: npx changeset publish
title: "version handshake-nodejs-reporters"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish the package if required
if: steps.changesets.outputs.published == 'true'
run: echo 'published packages'
6 changes: 3 additions & 3 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ jobs:
id: release
with:
files: dist/**/*
body: ":rocket: Bump graspit-server version to `${{ steps.version.outputs.VERSION }}`"
body: ":rocket: Bump Handshake-server version to `${{ steps.version.outputs.VERSION }}`"
prerelease: true
tag_name: ${{ steps.version.outputs.VERSION }}
name: "Graspit - ${{ steps.version.outputs.VERSION }}"
name: "Handshake 🤝 - ${{ steps.version.outputs.VERSION }}"
generate_release_notes: true

- name: Post Release Post
Expand All @@ -128,7 +128,7 @@ jobs:
title: "Bump Server Build"
labels: "Automated,Server-build"
reviewers: "RahulARanger"
body: ":rocket: Bumped graspit-server version to `${{ steps.version.outputs.VERSION }}`.<br/>
body: ":rocket: Bumped handshake-server version to `${{ steps.version.outputs.VERSION }}`.<br/>
:magic_wand: Make sure to edit this [release](${{ steps.release.outputs.url }}) once done."
base: "nodejs-reporters"
assignees: "RahulARanger"
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dependencies
graspit-dashboard/.next/*
handshake-dashboard/.next/*
dist/*
**/out/*
**/node_modules/*
Expand Down Expand Up @@ -45,14 +45,14 @@ venv/*
**/dist/**
**/build/**
check.py
graspit-reporters/packages/graspit-dashboard/public/antd.min.css
graspit-reporters/packages/graspit-dashboard/src/styles/antd.min.css

# Production
/build

# Generated files

# Misc
.DS_Store
graspit-reporters/packages/graspit-commons/bin
handshake-nodejs-reporters/packages/common-handshakes/bin
handshake-nodejs-reporters/Jest-Results
handshake-nodejs-reporters/packages/handshake-dashboard/src/styles/antd.min.css
/handshake-nodejs-reporters/packages/handshake-dashboard/test-export.ps1
3 changes: 2 additions & 1 deletion .idea/GraspIt.iml → .idea/Handshake.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 13 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
# Grasp-it
# Handshake 🤝
_A Modern Test Reporter_

Utilizes the data collected from the test execution does some processing and then displays it in the Dashboard.
Processes the data collected from the test execution and then generates a modern Dashboard.

## Architecture
## Getting Started

- we initiate the Grasp-it-dashboard
- this step would be skipped if these below steps were done previously, Note: it would be not skipped if it finds a new version of the dashboard
- Copy the dashboard from `src`
- downloads all the required npm modules
- creates a new `TeStReSuLtS.db`
- And then we start the framework
- Past that we collect all the Test suites, sessions, test cases, we name this routes under the prefix: "register"
- After the registration, we collect the details pertaining to the end result of the registered entity
- Now we make sure to fill the calculated cells in some records that were added, this is to save the time while generating the report.
- we export the results past the test completion, while this is an optional step, which could be configured at the plugin level, but it has to done at some point in order to generate a report.
### Nodejs-Reporters

#### WebdriverIO

[WebdriverIO](https://webdriver.io/) is a Next-gen browser and mobile automation test framework for Node.js

with the help of customer [reporter](https://webdriver.io/docs/customreporter/) and [service](https://webdriver.io/docs/customservices), we would be able to collect the results generated through its project.

1. Install Packages: `npm install wdio-handshake-reporter`

## Plans

### Test Reports
- Adding Attachments
- Dynamic Report
- JIRA Reporter

### wdio-py-reporter
- Support Cucumber framework
- Dynamic Report

### Note
* https://python-poetry.org/docs/basic-usage/#using-your-virtual-environment
65 changes: 65 additions & 0 deletions __test__/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import platform
import subprocess

from pytest import fixture, mark
from pathlib import Path
from handshake.services.DBService.shared import db_path as shared_db_path
from tortoise.connection import connections
from handshake.services.DBService.models.enums import ConfigKeys

pytestmark = mark.asyncio

testNames = "pyTestForOurProject"


@fixture()
def root_dir():
return Path(__file__).parent.parent / "TestResults"


@fixture()
def db_path(root_dir):
return shared_db_path(root_dir)


@fixture()
def dist(root_dir):
return root_dir.parent / "dist"


@fixture()
def dist_name():
return (
f"handshake-{platform.system()}.exe"
if platform.system() == "Windows"
else f"handshake-{platform.system()}"
)


@fixture()
def init_db(root_dir):
return lambda: subprocess.call(f'handshake config "{root_dir}"', shell=True)


@fixture
async def get_v3_connection(scripts):
connection = connections.get("default")

# assuming we are at v4
await connection.execute_script((scripts / "revert-v4.sql").read_text())
await connection.execute_query(
"UPDATE CONFIGBASE set value = '3' where key = ?", (ConfigKeys.version,)
)

return connection


@fixture
def scripts():
return (
Path(__file__).parent.parent
/ "handshake"
/ "services"
/ "DBService"
/ "scripts"
)
36 changes: 5 additions & 31 deletions __test__/test_regression/conftest.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
from pytest import fixture, mark
from pathlib import Path
from graspit.services.DBService.shared import db_path as shared_db_path
from graspit.services.DBService.lifecycle import init_tortoise_orm, close_connection
from graspit.services.DBService.models import RunBase, SessionBase
from pytest import fixture
from handshake.services.DBService.lifecycle import init_tortoise_orm, close_connection
from handshake.services.DBService.models import RunBase, SessionBase
from datetime import datetime, timedelta
from subprocess import call
from sanic_testing.testing import SanicASGITestClient
from graspit.services.Endpoints.core import service_provider

pytestmark = mark.asyncio

testNames = "pyTestForOurProject"


@fixture()
def root_dir():
return Path(__file__).parent.parent.parent / "TestResults"


@fixture()
def db_path(root_dir):
return shared_db_path(root_dir)


@fixture()
def patch(root_dir):
return lambda: call(f'graspit patch "{root_dir}"', shell=True)


@fixture()
def init_db(root_dir):
return lambda: call(f'graspit config "{root_dir}"', shell=True)
from handshake.services.Endpoints.core import service_provider
from __test__.conftest import testNames


@fixture(autouse=True)
Expand Down
9 changes: 5 additions & 4 deletions __test__/test_regression/test_patch_jobs/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pytest import fixture
from graspit.services.DBService.models import SuiteBase, TestConfigBase, SessionBase
from graspit.services.DBService.models.enums import SuiteType, Status, AttachmentType
from graspit.services.SchedularService.register import register_patch_suite
from handshake.services.DBService.models import SuiteBase, TestConfigBase, SessionBase
from handshake.services.DBService.models.enums import SuiteType, Status, AttachmentType
from handshake.services.SchedularService.register import register_patch_suite
import datetime
from asyncio import sleep

Expand Down Expand Up @@ -97,11 +97,12 @@ async def helper_create_test_config(
)


async def helper_create_session(test_id: str):
async def helper_create_session(test_id: str, entityName="sample"):
await sleep(0.0025)
started = datetime.datetime.utcnow()
return await SessionBase.create(
started=started,
entityName=entityName,
test_id=test_id,
ended=started + datetime.timedelta(milliseconds=24),
)
Expand Down
File renamed without changes.
Loading

0 comments on commit df4658e

Please sign in to comment.