test/monitor.js aktualisiert
This commit is contained in:
@@ -145,7 +145,7 @@ if (!PUSHGATEWAY_URL) {
|
||||
page.click('span:nth-child(2)'),
|
||||
page.waitForNavigation()
|
||||
]);
|
||||
await page.screenshot({ path: `${resultDir}/eiamselect-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}-eiamselect.png`, fullPage: true });
|
||||
await Promise.all([
|
||||
page.click('#social-eIAM'),
|
||||
page.waitForNavigation()
|
||||
@@ -157,7 +157,7 @@ if (!PUSHGATEWAY_URL) {
|
||||
await doStep(2, 'Benutzernamen eingeben', async () => {
|
||||
await page.click('#isiwebuserid');
|
||||
await page.fill('#isiwebuserid', USERNAME);
|
||||
await page.screenshot({ path: `${resultDir}/userid-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}-userid.png`, fullPage: true });
|
||||
await Promise.all([
|
||||
page.press('#isiwebuserid', 'Enter'),
|
||||
page.waitForNavigation()
|
||||
@@ -169,7 +169,7 @@ if (!PUSHGATEWAY_URL) {
|
||||
await doStep(3, 'Passwort eingeben', async () => {
|
||||
await page.click('#isiwebpasswd');
|
||||
await page.fill('#isiwebpasswd', PASSWORD);
|
||||
await page.screenshot({ path: `${resultDir}/pw-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}-pw.png`, fullPage: true });
|
||||
await Promise.all([
|
||||
page.press('#isiwebpasswd', 'Enter'),
|
||||
page.waitForNavigation()
|
||||
@@ -183,7 +183,7 @@ if (!PUSHGATEWAY_URL) {
|
||||
console.log(`✅ Login eIAM TOTP Code: ${totp}`);
|
||||
console.log('✅ Login eIAM TOTP eintragen');
|
||||
await page.fill('#code2FA', totp);
|
||||
await page.screenshot({ path: `${resultDir}/totp-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}totp.png`, fullPage: true });
|
||||
await Promise.all([
|
||||
page.press('#code2FA', 'Enter'),
|
||||
page.waitForNavigation()
|
||||
@@ -194,11 +194,11 @@ if (!PUSHGATEWAY_URL) {
|
||||
console.log('✅ WhoAmI Seite laden und prüfen');
|
||||
await doStep(5, 'Login-Erfolg prüfen', async () => {
|
||||
await page.waitForSelector(`text=${SUCCESS_TEXT}`, { timeout: 10000 });
|
||||
await page.screenshot({ path: `${resultDir}/result-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}-result.png`, fullPage: true });
|
||||
console.log(` Suche nach Benutzername: ${SUCCESS_TEXT}`);
|
||||
const pageText = await page.textContent('body');
|
||||
fs.writeFileSync(path.join(resultDir, `final-${timestamp}.html`), await page.content());
|
||||
fs.writeFileSync(path.join(resultDir, `final-${timestamp}.txt`), pageText);
|
||||
fs.writeFileSync(path.join(resultDir, `${timestamp}-final.html`), await page.content());
|
||||
fs.writeFileSync(path.join(resultDir, `${timestamp}-final.txt`), pageText);
|
||||
if (!pageText.includes(SUCCESS_TEXT)) {
|
||||
throw new Error('Benutzername nicht gefunden – Login möglicherweise fehlerhaft');
|
||||
}
|
||||
@@ -213,7 +213,7 @@ if (!PUSHGATEWAY_URL) {
|
||||
page.click('#kc-logout'),
|
||||
page.waitForNavigation()
|
||||
]);
|
||||
await page.screenshot({ path: `${resultDir}/logout-${timestamp}.png`, fullPage: true });
|
||||
await page.screenshot({ path: `${resultDir}/${timestamp}logout.png`, fullPage: true });
|
||||
console.log('✅ Logout erfolgreich');
|
||||
});
|
||||
|
||||
@@ -223,9 +223,9 @@ if (!PUSHGATEWAY_URL) {
|
||||
} catch (err) {
|
||||
console.error('❌ Fehler beim Login:', err.message);
|
||||
// Fehlerbehandlung und Ergebnisse sichern
|
||||
const screenshotPath = path.join(resultDir, `error_${timestamp}.png`);
|
||||
const htmlPath = path.join(resultDir, `page_${timestamp}.html`);
|
||||
const textPath = path.join(resultDir, `page-${timestamp}.txt`);
|
||||
const screenshotPath = path.join(resultDir, `${timestamp}-error.png`);
|
||||
const htmlPath = path.join(resultDir, `${timestamp}-page.html`);
|
||||
const textPath = path.join(resultDir, `${timestamp}-page.txt`);
|
||||
await page.screenshot({ path: screenshotPath });
|
||||
const pageText = await page.textContent('body');
|
||||
fs.writeFileSync(htmlPath, await page.content());
|
||||
|
||||
Reference in New Issue
Block a user