Skip to content

Commit 0baed0a

Browse files
authored
Packages/api and wdio testplanit reporter (#25)
* feat(translations): add project ID display and enhance SDK documentation - Introduced a new translation key for displaying project IDs in English, Spanish, and French. - Updated the ProjectHeader component to show the project ID. - Added a new SDK & Integrations category in the documentation sidebar, linking to relevant SDK pages for better user guidance. - Updated pnpm workspace configuration to include all packages for better management. * feat(api): enhance JUnit test result handling and improve SDK documentation - Introduced new interfaces for JUnit test results and updated existing types to support JUnit integration. - Enhanced the TestPlanItClient to include methods for retrieving JUnit test results and suites. - Updated the WebdriverIO reporter to reflect changes in test run URLs and improve reporting accuracy. - Added requirements for creating test cases and improved caching mechanisms for folder paths during test runs. - Updated documentation to clarify configuration options and usage of new features. * feat(scheduler): enhance automated test result handling - Introduced a utility function to identify automated test case sources, improving the filtering of test results. - Updated the forecast service to utilize the new function for retrieving JUnit test case IDs. - Modified user feedback messages to reflect the change from JUnit-specific results to a broader automated test results context in English, Spanish, and French. * feat(repository): filter out deleted items in AddCase, AddCaseRow, AddFolder, and EditFolder components - Updated queries in AddCaseModal, AddCaseRow, AddFolderModal, and EditFolderModal to exclude items marked as deleted by adding `isDeleted: false` to the where clause. * fix(api): standardize string quotes and improve error handling in TestPlanItClient - Updated string quotes in the LookupRequest interface for consistency. - Enhanced error handling in the TestPlanItClient class to improve readability and maintainability by formatting multi-line strings and adding try/catch blocks for better error management. - Refactored several method calls to improve code clarity and structure. * feat(select-all): implement SelectAllCheckbox component with shift-key functionality and tooltip support - Added a new SelectAllCheckbox component to enhance the selection experience in the Cases view. - Implemented shift-key detection for selecting/deselecting all cases across pages. - Updated tooltips to provide user guidance on selection actions, including translations for English, Spanish, and French. - Refactored related components to integrate the new checkbox functionality and improve overall user interaction. * feat(api): enhance findOrCreateTestCase method to handle deleted folders - Updated the findOrCreateTestCase method in TestPlanItClient to first search for active test cases in active folders and move any found in deleted folders to the specified folder. - Improved handling of test case creation by ensuring that cases can be restored and moved to new folders when necessary. - Enhanced the importTestResults method to correctly process and handle incoming SSE events, including managing incomplete data and error scenarios. - Added comprehensive tests for importTestResults to ensure robust error handling and correct event processing. * refactor(api): simplify importTestResults tests by using a mock file - Replaced direct File instantiation with a mockFile variable in the importTestResults tests to improve readability and maintainability. - Updated test cases to utilize the new mockFile structure for consistency across all test scenarios. * feat(treeview): optimize folder selection and expand behavior - Introduced a reference to track the previously selected folder ID to prevent unnecessary updates when the selection remains unchanged. - Enhanced the folder expansion logic to automatically select the folder when it is expanded for the first time, improving user experience. - Updated the API authentication handling to utilize AsyncLocalStorage for thread-safe context management, ensuring consistent access to user authentication data across requests. * feat(treeview): add expand/collapse all descendants functionality - Implemented recursive functions to expand and collapse all descendants of a node in the TreeView component. - Enhanced user interaction by allowing users to expand or collapse all child nodes using the Alt key (Windows) or Option key (Mac) during folder selection. - Improved overall folder management experience in the TreeView by streamlining node expansion behavior. * feat(testcase): integrate TestCaseNameDisplay for improved case representation - Replaced direct case name rendering with the TestCaseNameDisplay component across multiple files to enhance the display of test cases. - Added handling for deleted cases, ensuring proper representation and interaction in the UI. - Updated related components to support the new structure, improving maintainability and user experience. * feat(reporter): enhance folder resolution logic with optional hierarchy creation - Updated the folder resolution process to allow for the creation of a parent folder if it does not exist and the `createFolderHierarchy` option is enabled. - Improved logging to provide feedback when a folder is created, enhancing user experience and clarity in folder management. - Ensured that error handling remains intact for cases where folder creation is not permitted. * feat(release): improve version extraction for cross-platform compatibility in semantic release workflows - Updated the version extraction logic in both cli-semantic-release.yml and semantic-release.yml to use sed for better compatibility across Linux and macOS. - Enhanced comments to clarify the purpose of version extraction and ensure portability. - Adjusted the handling of version checks to ensure proper formatting before outputting to GitHub Actions. * chore(lockfile): remove pnpm-lock.yaml file - Deleted the pnpm-lock.yaml file to streamline dependency management. - This change may be part of a transition to a different package manager or a restructuring of the project dependencies. * feat(reporter): add specFile and commandOutput to TrackedTestResult interface - Enhanced the TrackedTestResult interface to include optional properties for specFile and commandOutput, allowing for better tracking of test execution context and output logs. - Updated the reporter logic to populate these new fields, improving the detail and usability of test results. - Adjusted related components to ensure compatibility with the new data structure, enhancing overall reporting capabilities. * feat(reporter): update screenshot upload functionality and documentation - Enhanced the `uploadScreenshots` option to clarify that screenshots are intercepted from the `afterTest` hook rather than automatically captured by the reporter. - Updated documentation to reflect the new behavior and configuration requirements for capturing screenshots on test failure. - Removed the `includeConsoleLogs` option from the reporter interface and related files to streamline functionality. - Improved overall clarity in the README and type definitions regarding screenshot handling and reporting behavior. * feat(reporter): add junitResultId to TrackedTestResult for deferred screenshot uploads - Introduced a new optional property `junitResultId` in the `TrackedTestResult` interface to facilitate the deferred upload of screenshots after test results are reported. - Updated the reporter logic to store the JUnit result ID upon creation, allowing for proper association of screenshots with their respective test results during the upload process. - Enhanced the screenshot upload functionality to ensure that screenshots taken in the `afterTest` hook can be uploaded correctly, improving overall reporting accuracy and usability. * feat(reporter): enhance screenshot handling and upload logging - Updated screenshot command detection to include 'saveScreenshot' and improved logging for better traceability. - Enhanced result handling to differentiate between base64 data and file paths, ensuring accurate screenshot processing. - Added detailed logging for screenshot uploads, including file size and error stack traces on upload failure, improving debugging capabilities. - Refactored the screenshot capture logic to ensure proper association with current test UID, enhancing reporting accuracy. * feat(reporter): improve screenshot upload handling and logging - Refactored screenshot upload logic to utilize promises for concurrent uploads, enhancing performance and reliability. - Added detailed logging for each upload attempt, including success and failure messages, to improve traceability. - Ensured that all pending screenshots are cleared only after all uploads are completed, maintaining accurate reporting. - Updated related documentation to reflect changes in screenshot handling and upload behavior. * fix(api): update file size calculation to use BigInt for compatibility with database schema - Changed the file size calculation in the TestPlanItClient class to use BigInt, ensuring compatibility with the database schema that requires BigInt for size values. - Updated related files to reflect this change in both JavaScript and module formats. * fix(api): update file size calculation to string for JSON compatibility - Changed the file size calculation in the TestPlanItClient class to convert the size to a string, ensuring compatibility with JSON serialization, as BigInt cannot be serialized directly. - Updated related files to reflect this change in both JavaScript and module formats. * refactor(api): update attachment handling to use dedicated endpoint for file uploads - Refactored the attachment creation logic in the TestPlanItClient class to utilize a dedicated API endpoint for uploading attachments, improving compatibility with BigInt size handling. - Removed the previous method of constructing the attachment data object and replaced it with a direct request to the new endpoint, streamlining the process. - Updated related files to reflect these changes in both JavaScript and module formats. * fix(api): update URL validation in attachment schema to allow relative paths - Modified the attachment schema to accept both full URLs and relative paths for the URL field, enhancing flexibility in attachment handling. - Updated validation to ensure the URL is a non-empty string, improving data integrity for attachment uploads. * refactor(attachments): update download link handling and enhance test result data structure - Replaced the Link component with an anchor tag in the AttachmentsCarousel for improved URL handling, utilizing a utility function to generate storage URLs. - Enhanced the TestResultHistory component by refining the selection of JUnit results and attachments, ensuring only relevant fields are included and improving data integrity. - Updated the attachments query to filter out deleted items and include additional fields for better context in test results. * feat(api): enhance findOrCreateTestCase method to return detailed results - Introduced a new interface, FindOrCreateTestCaseResult, to encapsulate the result of the findOrCreateTestCase method, providing metadata about the test case resolution. - Updated the findOrCreateTestCase method to return an object containing the test case and an action indicating whether it was 'found', 'created', or 'moved'. - Enhanced documentation for the method to clarify the return structure and its implications for test case management. - Adjusted related files to ensure consistency with the new return type across JavaScript and TypeScript implementations. * feat(delete): enhance delete functionality for test runs and sessions - Added `onBeforeDelete` callback to `DeleteTestRunModal` and `DeleteSessionModal` to signal the start of the delete process, preventing race conditions during navigation. - Implemented query cache removal for related test runs and sessions before deletion to avoid UI inconsistencies and 404 errors. - Updated navigation logic to ensure smooth transitions during deletion, including immediate dialog closure and toast notifications for user feedback. - Enhanced error handling to redirect back to the appropriate page if deletion fails, maintaining user experience. - Updated localization files to provide clearer messaging regarding the deletion process and its implications. * fix(TestRunPage): ensure loading state for missing testRunData - Added a check for the existence of testRunData to handle loading state appropriately, preventing potential null reference errors. - Updated TypeScript null analysis to ensure robust handling of automated test run types. * feat(api): enhance uploadJUnitAttachment method to include note parameter - Updated the uploadJUnitAttachment method in the TestPlanItClient class to accept an optional note parameter, allowing users to attach additional context to JUnit test results. - Modified related TypeScript definitions and JavaScript implementations to accommodate the new parameter, ensuring consistency across the API. - Enhanced documentation for the method to clarify the purpose and usage of the note parameter, improving usability for developers. * feat(api): enhance TestPlanIt API types and shared state management - Updated API types to reflect changes in the TestPlanIt schema, including new fields such as isDeleted, createdAt, and createdById across various interfaces. - Introduced UploadAttachmentOptions interface for better attachment handling. - Enhanced shared state management in the TestPlanItReporter to track active workers, ensuring proper handling of concurrent test runs. - Improved documentation and comments for clarity on new functionalities and their implications. * feat(api): enhance UpdateTestRunOptions and improve TestPlanItClient logic - Added `completedAt` field to the `UpdateTestRunOptions` interface to track completion timestamps. - Updated the `TestPlanItClient` to automatically set `completedAt` when `isCompleted` is marked true, ensuring accurate tracking of test run completion. - Refactored related TypeScript definitions and JavaScript implementations for consistency. - Improved formatting in the `TestPlanItClient` for better readability and maintainability. * docs(webdriverio-reporter): add behavior details for missing case IDs based on autoCreateTestCases setting - Documented the behavior when no case ID is found in test titles, specifying the effects of the `autoCreateTestCases` setting. - Clarified that tests without valid case IDs will not appear in TestPlanIt results if auto-creation is not enabled. - Enhanced the documentation to improve understanding of test case management in the context of the reporter. * refactor(pagination): standardize page size options across components - Replaced hardcoded page size options with `defaultPageSizeOptions` in multiple components to ensure consistency in pagination settings. - Updated relevant imports and removed redundant page size definitions, enhancing maintainability and reducing code duplication. * feat(reporter): enhance test run summary and workflow tracking - Updated the WebdriverIO reporter documentation to include detailed results summary and additional statistics when `autoCreateTestCases` is enabled. - Modified the API to return the `workflowType` for test runs, allowing better tracking of test run states. - Enhanced the TestRunCasesSummary component to display a loading spinner during automated test runs and updated completion percentage display logic. - Added new localization messages for "Importing..." and "Adding test cases..." in English, Spanish, and French to improve user feedback during test case processing. * chore(dependencies): update package versions in pnpm-lock.yaml and package.json - Updated various package versions to their latest compatible releases, including `@types/node`, `ai`, `next-intl`, `simple-icons`, and others for improved stability and features. - Adjusted dependency specifications for `eslint`, `autoprefixer`, and `baseline-browser-mapping` to reflect the latest versions. - Ensured consistency in dependency versions across the project to maintain compatibility and reduce potential issues. * chore(dependencies): update @testplanit/api version in package.json - Changed the dependency for `@testplanit/api` from a workspace reference to a specific version `^0.1.0` to ensure consistent installations across environments. * chore(dependencies): update @testplanit/api dependency specification to use workspace:^ - Changed the dependency for `@testplanit/api` in both package.json and pnpm-lock.yaml from a specific version to a workspace reference, ensuring compatibility with local development environments.
1 parent 2b4afe4 commit 0baed0a

107 files changed

Lines changed: 21988 additions & 14825 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Changesets
2+
3+
This directory contains changesets for the `@testplanit/*` packages.
4+
5+
## What are Changesets?
6+
7+
Changesets are a way to manage versioning and changelogs for packages in this monorepo. When you make changes to a package, you create a changeset that describes what changed and what kind of version bump is needed.
8+
9+
## Packages Managed by Changesets
10+
11+
- `@testplanit/api` - API client for TestPlanIt
12+
- `@testplanit/wdio-reporter` - WebdriverIO reporter for TestPlanIt
13+
14+
## How to Create a Changeset
15+
16+
After making changes to a package, run:
17+
18+
```bash
19+
pnpm changeset
20+
```
21+
22+
This will prompt you to:
23+
1. Select which packages have changed
24+
2. Choose the type of version bump (major, minor, patch)
25+
3. Write a summary of your changes
26+
27+
## Version Types
28+
29+
- **patch** (0.0.x): Bug fixes, documentation updates, dependency updates
30+
- **minor** (0.x.0): New features that are backwards compatible
31+
- **major** (x.0.0): Breaking changes
32+
33+
## Release Process
34+
35+
1. Make your changes and create a changeset
36+
2. Open a PR with your changes and the changeset
37+
3. When merged, a "Version Packages" PR will be automatically created
38+
4. Merging the "Version Packages" PR will:
39+
- Update package versions
40+
- Update CHANGELOGs
41+
- Publish packages to npm
42+
43+
## Manual Commands
44+
45+
```bash
46+
# Create a new changeset
47+
pnpm changeset
48+
49+
# See what changes are pending
50+
pnpm changeset status
51+
52+
# Bump versions based on changesets (CI does this)
53+
pnpm changeset version
54+
55+
# Publish packages (CI does this)
56+
pnpm changeset publish
57+
```
58+
59+
## More Information
60+
61+
See the [Changesets documentation](https://github.com/changesets/changesets) for more details.

.changeset/config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "testplanit/testplanit" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": ["testplanit", "docs", "forge-app", "cli"],
14+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
15+
"onlyUpdatePeerDependentsWhenOutOfRange": true
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@testplanit/api": minor
3+
"@testplanit/wdio-reporter": minor
4+
---
5+
6+
Initial release of TestPlanIt npm packages
7+
8+
- `@testplanit/api`: Official JavaScript/TypeScript API client for TestPlanIt
9+
- `@testplanit/wdio-reporter`: WebdriverIO reporter for TestPlanIt test management

.github/workflows/cli-semantic-release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ jobs:
5959
run: |
6060
cd cli
6161
npx semantic-release 2>&1 | tee release-output.txt
62-
# Extract the version if a release was made
62+
# Extract the version if a release was made (portable across Linux/macOS)
6363
if grep -q "Published release" release-output.txt; then
64-
VERSION=$(grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+" release-output.txt || echo "")
65-
if [ -n "$VERSION" ]; then
64+
# Use sed instead of grep -oP for cross-platform compatibility
65+
VERSION=$(grep "Published release" release-output.txt | sed -E 's/.*Published release ([0-9]+\.[0-9]+\.[0-9]+).*/\1/' | head -1)
66+
if [ -n "$VERSION" ] && [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6667
echo "version=cli-v${VERSION}" >> $GITHUB_OUTPUT
6768
echo "released=true" >> $GITHUB_OUTPUT
6869
else
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Package Release Workflow
2+
#
3+
# This workflow handles versioning and publishing of @testplanit/* packages to npm.
4+
# It uses Changesets to manage versions and changelogs.
5+
#
6+
# How it works:
7+
# 1. When PRs with changesets are merged to main, this workflow runs
8+
# 2. It creates/updates a "Version Packages" PR with version bumps and changelog updates
9+
# 3. When the "Version Packages" PR is merged, packages are published to npm
10+
#
11+
# To release:
12+
# 1. Create a changeset: pnpm changeset
13+
# 2. Commit and merge to main
14+
# 3. Review and merge the auto-created "Version Packages" PR
15+
#
16+
name: Package Release
17+
18+
on:
19+
push:
20+
branches:
21+
- main
22+
paths:
23+
- 'packages/**'
24+
- '.changeset/**'
25+
- '.github/workflows/packages-release.yml'
26+
workflow_dispatch:
27+
28+
concurrency: ${{ github.workflow }}-${{ github.ref }}
29+
30+
jobs:
31+
release:
32+
name: Release
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: write
36+
pull-requests: write
37+
id-token: write
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Setup pnpm
46+
uses: pnpm/action-setup@v4
47+
with:
48+
version: 9
49+
50+
- name: Setup Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: '20'
54+
cache: 'pnpm'
55+
registry-url: 'https://registry.npmjs.org'
56+
57+
- name: Install dependencies
58+
run: pnpm install --frozen-lockfile
59+
60+
- name: Build packages
61+
run: |
62+
pnpm --filter "@testplanit/api" build
63+
pnpm --filter "@testplanit/wdio-reporter" build
64+
65+
- name: Create Release Pull Request or Publish
66+
id: changesets
67+
uses: changesets/action@v1
68+
with:
69+
publish: pnpm changeset publish
70+
version: pnpm changeset version
71+
title: 'chore(packages): version packages'
72+
commit: 'chore(packages): version packages'
73+
createGithubReleases: true
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78+
79+
- name: Summary
80+
if: steps.changesets.outputs.published == 'true'
81+
run: |
82+
echo "## Published Packages" >> $GITHUB_STEP_SUMMARY
83+
echo "" >> $GITHUB_STEP_SUMMARY
84+
echo "The following packages were published:" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | "- \(.name)@\(.version)"' >> $GITHUB_STEP_SUMMARY

.github/workflows/semantic-release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ jobs:
5454
run: |
5555
cd testplanit
5656
npx semantic-release 2>&1 | tee release-output.txt
57-
# Extract the version if a release was made
57+
# Extract the version if a release was made (macOS-compatible)
5858
if grep -q "Published release" release-output.txt; then
59-
VERSION=$(grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+" release-output.txt || echo "")
60-
if [ -n "$VERSION" ]; then
59+
# Use sed instead of grep -oP for macOS compatibility
60+
VERSION=$(grep "Published release" release-output.txt | sed -E 's/.*Published release ([0-9]+\.[0-9]+\.[0-9]+).*/\1/' | head -1)
61+
if [ -n "$VERSION" ] && [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6162
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
6263
echo "released=true" >> $GITHUB_OUTPUT
6364
else

0 commit comments

Comments
 (0)