basic tests
This commit is contained in:
parent
cd9c7678ee
commit
1a5ef88c55
4 changed files with 63 additions and 1 deletions
36
tests/invite.spec.js
Normal file
36
tests/invite.spec.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
const { test, expect } = require('@playwright/test');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
test('can create invite with CLI and access invite page', async ({ page }) => {
|
||||
// Create an invite using the CLI
|
||||
const inviterNpub = 'npub1test1234567890abcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
try {
|
||||
const output = execSync(`npm run cli createAppInvite ${inviterNpub}`, {
|
||||
encoding: 'utf8',
|
||||
cwd: process.cwd()
|
||||
});
|
||||
|
||||
// Extract the invite UUID from the CLI output
|
||||
const match = output.match(/http:\/\/localhost\/invite\/([a-f0-9-]+)/);
|
||||
if (!match) {
|
||||
throw new Error('Could not extract invite UUID from CLI output');
|
||||
}
|
||||
|
||||
const inviteUuid = match[1];
|
||||
console.log(`Created invite with UUID: ${inviteUuid}`);
|
||||
|
||||
// Navigate to the invite page
|
||||
await page.goto(`/invite/${inviteUuid}`);
|
||||
|
||||
// Check that the invite page loads correctly
|
||||
await expect(page).toHaveTitle('Invite Details');
|
||||
await expect(page.locator('h1')).toContainText('¡Has sido invitado a la seca!');
|
||||
await expect(page.locator('#laseca-logo')).toBeVisible();
|
||||
await expect(page.locator('#nostr-signup-button')).toBeVisible();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error creating invite or accessing page:', error);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue