Skip to content

Commit fee4fdd

Browse files
authored
Merge pull request #5 from nyaruka/test
Add test for signup
2 parents 6e9768b + 1d53326 commit fee4fdd

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,20 @@ jobs:
1010

1111
- name: Run docker compose
1212
run: docker compose up -d
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '18'
18+
19+
- name: Install dependencies
20+
run: npm install
21+
22+
- name: Run test
23+
run: node test/main.js
24+
25+
- name: Show logs on failure
26+
if: failure()
27+
run: |
28+
echo "=== Docker compose logs ==="
29+
docker compose logs --tail=50

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "rapidpro-docker-test",
3+
"version": "1.0.0",
4+
"description": "Test suite for RapidPro Docker setup",
5+
"main": "test/main.js",
6+
"scripts": {
7+
"test": "node test/main.js"
8+
},
9+
"dependencies": {
10+
"puppeteer": "^22.0.0"
11+
}
12+
}

test/main.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const puppeteer = require('puppeteer');
2+
3+
(async () => {
4+
console.log('Starting test...');
5+
6+
const browser = await puppeteer.launch({
7+
headless: true,
8+
args: ['--no-sandbox', '--disable-setuid-sandbox']
9+
});
10+
11+
try {
12+
const page = await browser.newPage();
13+
14+
console.log('Navigating to http://localhost:80/accounts/signup/...');
15+
await page.goto('http://localhost:80/accounts/signup/', {
16+
waitUntil: 'networkidle2',
17+
timeout: 30000
18+
});
19+
20+
console.log('Page loaded successfully!');
21+
22+
// Check if the page has the expected content
23+
const title = await page.title();
24+
console.log('Page title:', title);
25+
26+
// Check if signup form elements are present
27+
const signupForm = await page.$('form');
28+
if (signupForm) {
29+
console.log('✓ Signup form found');
30+
} else {
31+
throw new Error('Signup form not found');
32+
}
33+
34+
console.log('✓ Test passed successfully!');
35+
36+
} catch (error) {
37+
console.error('✗ Test failed:', error.message);
38+
process.exit(1);
39+
} finally {
40+
await browser.close();
41+
}
42+
})();

0 commit comments

Comments
 (0)