Playwright start
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
const { chromium } = require('playwright');
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('http://localhost:5111/build-calculator', { timeout: 30000, waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(10000);
|
||||
|
||||
const selects = page.locator('select');
|
||||
await selects.nth(0).selectOption("Q'Rath");
|
||||
await page.waitForTimeout(500);
|
||||
await selects.nth(1).selectOption('Orzum');
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check entity view before adding
|
||||
let evCount = await page.locator('.entityClickView #entityName').count();
|
||||
console.log('entityName count before add:', evCount);
|
||||
if (evCount > 0) console.log('entityName text:', (await page.locator('.entityClickView #entityName').textContent() || '').trim());
|
||||
|
||||
// Check timeline intervals before
|
||||
let intervals = page.locator('[class*="interval"], .timelineInterval');
|
||||
console.log('interval count before add:', await intervals.count());
|
||||
if ((await intervals.count()) > 0) {
|
||||
console.log('first interval text:', ((await intervals.first().textContent()) || '').trim().substring(0,100));
|
||||
}
|
||||
|
||||
// Click Q
|
||||
const buttons = page.locator('.keyContainer > div > div');
|
||||
const count = await buttons.count();
|
||||
for (let i = 0; i < count; i++) {
|
||||
const txt = (await buttons.nth(i).textContent()) || '';
|
||||
if (txt.trim().toUpperCase().startsWith('Q')) {
|
||||
await buttons.nth(i).click({ force: true });
|
||||
console.log('Clicked Q button at index', i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check entity view after adding
|
||||
evCount = await page.locator('.entityClickView #entityName').count();
|
||||
console.log('entityName count after add:', evCount);
|
||||
if (evCount > 0) console.log('entityName text:', ((await page.locator('.entityClickView #entityName').textContent()) || '').trim());
|
||||
|
||||
// Check timeline intervals after
|
||||
intervals = page.locator('[class*="interval"], .timelineInterval');
|
||||
console.log('interval count after add:', await intervals.count());
|
||||
if ((await intervals.count()) > 0) {
|
||||
const ic = await intervals.count();
|
||||
for (let i = 0; i < Math.min(ic, 3); i++) {
|
||||
console.log('interval', i, 'text:', ((await intervals.nth(i).textContent()) || '').trim().substring(0,120));
|
||||
}
|
||||
}
|
||||
|
||||
// Click Clear Build Order
|
||||
await page.locator('button').filter({ hasText: 'Clear Build Order' }).click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check entity view after clear
|
||||
evCount = await page.locator('.entityClickView #entityName').count();
|
||||
console.log('entityName count after clear:', evCount);
|
||||
if (evCount > 0) console.log('entityName text:', ((await page.locator('.entityClickView #entityName').textContent()) || '').trim());
|
||||
|
||||
// Check timeline intervals after clear
|
||||
intervals = page.locator('[class*="interval"], .timelineInterval');
|
||||
console.log('interval count after clear:', await intervals.count());
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
Reference in New Issue
Block a user