-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-navigation-issue.js
More file actions
67 lines (55 loc) · 2.1 KB
/
test-navigation-issue.js
File metadata and controls
67 lines (55 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const puppeteer = require('puppeteer');
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
try {
console.log('Testing navigation issue...');
const browser = await puppeteer.launch({ headless: false, slowMo: 200 });
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
// 1. Visit home page
await page.goto('http://localhost:5174');
await delay(2000);
console.log('1. Home page:', page.url());
// 2. Go directly to email verification
await page.goto('http://localhost:5174/auth/verify');
await delay(2000);
console.log('2. Email verification page:', page.url());
// 3. Check if we can see the button
const buttonText = await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('button'));
return buttons.map(btn => btn.textContent.trim());
});
console.log('3. Available buttons:', buttonText);
// 4. Try clicking the button
const buttonFound = await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('button'));
const continueButton = buttons.find(btn =>
btn.textContent.trim() === 'Continue without authentication'
);
if (continueButton) {
console.log('Found button, clicking...');
continueButton.click();
return true;
} else {
console.log('Button not found');
return false;
}
});
if (!buttonFound) {
throw new Error('Button not found on email verification page');
}
await delay(3000);
console.log('4. After clicking button:', page.url());
// 5. Check localStorage
const token = await page.evaluate(() => localStorage.getItem('token'));
const isAuthenticated = await page.evaluate(() => {
return localStorage.getItem('token') !== null;
});
console.log('5. Token present:', token !== null);
console.log('6. Token value:', token);
console.log('7. Is authenticated:', isAuthenticated);
await browser.close();
} catch (error) {
console.error('Error:', error);
}
})();