-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-test.js
More file actions
41 lines (33 loc) · 1.18 KB
/
simple-test.js
File metadata and controls
41 lines (33 loc) · 1.18 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
const { chromium } = require('playwright');
(async () => {
try {
console.log('Starting simple test...');
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
// Navigate to login
await page.goto('http://localhost:8080/wp-admin/');
// Login
await page.fill('#user_login', 'admin');
await page.fill('#user_pass', '!3cTXkh)9iDHhV5o*N');
await page.click('#wp-submit');
await page.waitForSelector('.wrap', { timeout: 10000 });
console.log('Logged in, checking plugin status...');
// Go to plugins page to see if the plugin is active
await page.goto('http://localhost:8080/wp-admin/plugins.php');
await page.waitForSelector('.plugins');
const pluginRow = await page.$('tr[data-slug="wp-content-flow"]');
if (pluginRow) {
const isActive = await pluginRow.$('.activate');
if (isActive) {
console.log('Plugin is INACTIVE');
} else {
console.log('Plugin is ACTIVE');
}
} else {
console.log('Plugin not found');
}
await browser.close();
} catch (error) {
console.error('Error:', error.message);
}
})();