Skip to content

Commit 0df29fd

Browse files
committed
Add sample CodeceptJS project
1 parent a631814 commit 0df29fd

8 files changed

Lines changed: 8624 additions & 0 deletions

File tree

.github/workflows/codeceptjs.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CodeceptJS
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- "codeceptjs/**"
8+
- ".github/workflows/codeceptjs.yml"
9+
pull_request:
10+
paths:
11+
- "codeceptjs/**"
12+
- ".github/workflows/codeceptjs.yml"
13+
14+
env:
15+
LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN_CODECEPTJS }}
16+
LAUNCHABLE_DEBUG: 1
17+
LAUNCHABLE_REPORT_ERROR: 1
18+
19+
jobs:
20+
tests:
21+
runs-on: ubuntu-22.04
22+
defaults:
23+
run:
24+
working-directory: codeceptjs
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
27+
with:
28+
fetch-depth: 0
29+
30+
# Set up Python for Launchable CLI
31+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #6.0.0
32+
with:
33+
python-version: "3.x"
34+
35+
# Set up Java for Launchable CLI
36+
- name: Set up JDK 1.8
37+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
38+
with:
39+
java-version: 8
40+
distribution: "temurin"
41+
42+
# Install Launchable CLI
43+
- name: Install launchable CLI
44+
run: |
45+
pip install launchable
46+
47+
# Set up Node.js
48+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 #v6.0.0
49+
with:
50+
node-version: 18
51+
cache: "npm"
52+
cache-dependency-path: codeceptjs/package-lock.json
53+
54+
# Install dependencies and Playwright browsers
55+
- name: Install dependencies
56+
run: |
57+
npm ci
58+
npx playwright install --with-deps chromium
59+
60+
# Record commits and build with Launchable
61+
- name: Record commits and build
62+
run: launchable record build --name "$GITHUB_RUN_ID"
63+
64+
# Run CodeceptJS tests
65+
- name: Run CodeceptJS tests
66+
run: npm run test:xml
67+
continue-on-error: true
68+
69+
# Record test results with Launchable
70+
- name: Record test results
71+
run: launchable record tests codeceptjs codeceptjs-result.xml
72+
if: always()

codeceptjs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
output
3+
codeceptjs-result.xml

codeceptjs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# CodeceptJS Example
2+
3+
Minimal CodeceptJS test automation with local server.
4+
5+
## Setup
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Run Tests
12+
13+
```bash
14+
npm test
15+
```

codeceptjs/codecept.conf.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @type {CodeceptJS.MainConfig} */
2+
exports.config = {
3+
tests: "./tests/*_test.js",
4+
output: "./output",
5+
helpers: {
6+
Playwright: {
7+
url: "http://localhost:3000",
8+
show: false,
9+
browser: "chromium",
10+
},
11+
},
12+
bootstrap: async () => {
13+
const { startServer } = require('./server');
14+
await startServer();
15+
},
16+
teardown: async () => {
17+
const { stopServer } = require('./server');
18+
await stopServer();
19+
},
20+
};

0 commit comments

Comments
 (0)