Skip to content

Commit f891a2d

Browse files
Merge pull request #14 from monikakonieczna/Task-9-Create-GitHub-Workflow-To-Run-In-Scheduled-Manner
Task 9: Create GitHub Workflow To Run Tests In Scheduled Manner
2 parents 8fd0ce1 + 211351e commit f891a2d

File tree

3 files changed

+91
-11
lines changed

3 files changed

+91
-11
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Nightly Workflow
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *'
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
19+
- name: Install dependencies
20+
run: npm install
21+
22+
- name: Run Sanity Tests
23+
run: |
24+
npm run test:sanity
25+
env:
26+
CI: true
27+
28+
- name: Upload test results
29+
uses: actions/upload-artifact@v4
30+
if: always()
31+
with:
32+
name: test-results
33+
path: test-report.html

README.md

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,40 @@ This project uses Supertest to test the API endpoints. Supertest is a popular li
4545

4646
## Getting Started
4747

48-
## Project Structure
48+
## Prerequisites
49+
This guide will help you set up the project and run the tests locally.
50+
- Node.js (v18.x or higher recommended)
51+
- npm (comes with Node.js)
4952

50-
### Prerequisites
53+
## Setup Instructions
54+
1. Clone the repository
55+
```
56+
git clone https://github.com/monikakonieczna/api-testing-framework-typescript.git
57+
cd api-testing-framework-typescript
58+
```
59+
2. Install dependencies
60+
```
61+
npm install
62+
```
63+
3. Run tests
64+
To run all tests:
65+
```
66+
npm test
67+
```
68+
To run specific group of tests, like sanity tests:
69+
```
70+
npm run test:sanity
71+
```
5172

52-
- Node.js
73+
## Project Structure
74+
- .github/workflows/: GitHub Actions workflow configurations
75+
- src/helpers/: Helper functions and utilities used throughout the project.
76+
- src/interfaces/: TypeScript interfaces for typing and structure definitions.
77+
- src/test_data/: Sample data for tests.
78+
- src/tests/: Contains all test files.
79+
- setupTests.ts: A setup file for Jest, which runs before each test to load environment variables from .env file.
80+
- jest.config.ts: Jest configuration file for test runner settings.
81+
- tsconfig.json: TypeScript configuration file that defines how the TypeScript compiler should behave.
5382

5483
## Third-Party Libraries
5584
### Jest Runner Groups
@@ -105,4 +134,29 @@ describe.each([
105134
});
106135
}
107136
);
108-
```
137+
```
138+
139+
## GitHub Actions
140+
### GitHub Actions - Nightly Workflow
141+
This repository includes a GitHub Actions workflow that runs every night at midnight (UTC). The workflow is triggered using a cron schedule and is designed to automate tasks like testing on a daily basis.
142+
143+
#### Workflow Details:
144+
- **Trigger Time:** Midnight (00:00 UTC) every day.
145+
- **Workflow File:** [`.github/workflows/nightly-workflow.yml`](.github/workflows/nightly-workflow.yml)
146+
- **Key Tasks:**
147+
- Automatically checks out the repository.
148+
- Executes sanity tests
149+
150+
### GitHub Actions - Run Tests By Group
151+
This repository includes a GitHub Actions workflow that allows you to run specific groups of tests on demand. The workflow can be manually triggered via the GitHub interface using `workflow_dispatch`, where you can select a test group to run.
152+
153+
### Workflow Details:
154+
- **Trigger:** Manually using the `Run workflow` button from the GitHub Actions tab.
155+
- **Workflow File:** [`.github/workflows/run-tests-by-group.yml`](.github/workflows/run-tests-by-group.yml)
156+
- **Test Group Options:**
157+
- `all`: Runs the full test suite.
158+
- `sanity`: Runs a sanity check with a smaller set of key tests.
159+
- `single_character`: Runs tests related to a single character.
160+
- `all_characters`: Runs tests for all characters.
161+
- `multiple_characters`: Runs tests involving multiple characters.
162+
- `filter_characters`: Runs tests that filter characters.

src/config.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)