Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c9cc9e4
e2e with playwright
meumar-osec Mar 24, 2025
232fec0
feat: e2e
meumar-osec Mar 26, 2025
d51aaa4
Merge branch 'main' of https://github.com/otter-sec/rctf into feat/e2e
meumar-osec Mar 28, 2025
c553493
Merge branch 'main' of https://github.com/otter-sec/rctf into feat/e2e
meumar-osec Mar 28, 2025
730b9c1
add: tests for admin challenges
meumar-osec Apr 2, 2025
c40f716
update: test config file added
meumar-osec Apr 2, 2025
0925315
admin page access control
meumar-osec Apr 7, 2025
b158a79
admin page UI updates & access control issue fix
meumar-osec Apr 10, 2025
5597fbb
revert admin access check
meumar-osec Oct 29, 2025
99b11af
chore: update to node 22 and yarn v4
trixter-osec Jul 15, 2025
32bcf55
feat(docs): clarify smtp, gcs upload provider, and ctftime sections
trixter-osec Jul 16, 2025
b0db294
feat(ci): switch to ghcr
trixter-osec Jul 16, 2025
abfa0e1
fix(ci): run on main
trixter-osec Jul 17, 2025
bdc06db
refactor(ci): update deprecated actions
trixter-osec Jul 17, 2025
a3d0ab5
chore: change URLs to use osec.io
trixter-osec Jul 17, 2025
f42e739
fix(install): use the correct config directory and docker image
trixter-osec Jul 17, 2025
438bace
chore(docs): update README to osec
trixter-osec Jul 17, 2025
8e79a6e
chore: update yarn.lock with playwright dependencies
meumar-osec Oct 29, 2025
4175f8e
Merge branch 'main' into feat/e2e
meumar-osec Oct 29, 2025
bcdcaf8
fix: code format
meumar-osec Oct 29, 2025
f7e3f3e
Merge branch 'main' into feat/e2e
meumar-osec Oct 31, 2025
d1abbd3
fix: resolved PR comments
meumar-osec Oct 31, 2025
8d1f171
fix: eslint fixes
es3n1n Nov 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BASE_URL=http://localhost:8080
NAME=OsecCTF
HOME_CONTENT=This is
LOGIN_TOKEN=test_team_token
DIVISIONS={"hs":"High School","college":"College", "other":"Other"}

TEST_CHAL=High school/1. Can you find root user?
TEST_CHAL_ANSWER=flag(1m_r0Ot_us3r)

TEST_REG_EMAIL=test_user@gmail.com
TEST_REG_NAME=test_user@gmail.com


TEST_UPDATE_EMAIL=test_user@gmail.com
TEST_UPDATE_NAME=test_user@gmail.com

TEST_NEW_MEMBER=test_user@gmail.com

TEST_NEW_CHAL_NAME=Challenge-test
TEST_NEW_CHAL_AUTHOR=luffy
TEST_NEW_CHAL_DES=This is one piece challenge
TEST_NEW_CHAL_FLAG=flag(on3_p1e5c3_f0und)

REGULAR_USER_TOKEN=admin_team_token
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = {
overrides: [
{
files: ['*.ts', '*.tsx'],
excludedFiles: ['**/playwright.config.ts'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
Expand Down
25 changes: 25 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,28 @@ fix/bug-description
refactor/some-component
docs/some-component
```

## E2E Tests

rCTF uses [Playwright](https://playwright.dev/) for end-to-end testing. The `.env.test` file in the repository root contains the test configuration variables. See `packages/client/testConfig.ts` for the complete list.

### Running E2E Tests

1. **Install Playwright browsers** (first time only):

```bash
cd packages/client
npx playwright install
```

2. **Run all E2E tests**:

```bash
npx playwright test
```

3. **Run a specific test file**:

```bash
npx playwright test tests/auth.spec.ts
```
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ $RECYCLE.BIN

# coverage
coverage

test-results
2 changes: 1 addition & 1 deletion packages/client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
project: ['./tsconfig.json', './tsconfig.playwright.json'],
},
overrides: [
{
Expand Down
8 changes: 8 additions & 0 deletions packages/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
*.env
2 changes: 2 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@babel/preset-react": "7.16.0",
"@babel/preset-typescript": "7.16.0",
"@emotion/jest": "11.5.0",
"@playwright/test": "1.50.1",
"@prefresh/babel-plugin": "0.4.1",
"@prefresh/webpack": "3.3.2",
"@reach/auto-id": "0.16.0",
Expand All @@ -39,6 +40,7 @@
"@testing-library/preact": "2.0.1",
"@testing-library/user-event": "13.5.0",
"@theme-ui/preset-base": "0.9.1",
"@types/node": "16.11.6",
"@types/react": "17.0.33",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.2.3",
Expand Down
35 changes: 35 additions & 0 deletions packages/client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
trace: 'on-first-retry',

baseURL: 'http://localhost:8080',
headless: true,
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true,
},
projects: [
Comment thread
meumar-osec marked this conversation as resolved.
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
],

timeout: 30000,
})
Loading
Loading