playwright-windows-wrapper 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,4 +20,48 @@ Because Windows desktop automation requires access to OS-level accessibility tre
|
|
|
20
20
|
Go to **Settings > Update & Security > For developers** and toggle **Developer Mode** to **On**.
|
|
21
21
|
2. **Install Appium Globally:**
|
|
22
22
|
```bash
|
|
23
|
-
npm install -g appium
|
|
23
|
+
npm install -g appium
|
|
24
|
+
|
|
25
|
+
Getting Started -
|
|
26
|
+
|
|
27
|
+
Step 1: Install Playwright Test
|
|
28
|
+
If you haven't already initialized Playwright's testing framework in your test project (D:\test111), run:
|
|
29
|
+
|
|
30
|
+
Bash
|
|
31
|
+
npm i -D @playwright/test
|
|
32
|
+
|
|
33
|
+
Step 2: Create test.spec.ts
|
|
34
|
+
Create your test file using Playwright's test and expect syntax. You can import your custom wrapper directly into it.
|
|
35
|
+
|
|
36
|
+
TypeScript
|
|
37
|
+
// test.spec.ts
|
|
38
|
+
import { test, expect } from '@playwright/test';
|
|
39
|
+
import { UltimateAutomationWrapper } from 'playwright-windows-wrapper';
|
|
40
|
+
|
|
41
|
+
test('Hybrid Web and Windows Desktop Test', async ({ page }) => {
|
|
42
|
+
const driver = new UltimateAutomationWrapper();
|
|
43
|
+
|
|
44
|
+
// 1. Test the Desktop App (Notepad)
|
|
45
|
+
console.log('Launching Notepad...');
|
|
46
|
+
await driver.initDesktop('notepad.exe');
|
|
47
|
+
|
|
48
|
+
await driver.typeText('//*[@Name="Text Editor"]', 'Hello from Playwright Spec!');
|
|
49
|
+
|
|
50
|
+
// Assert using standard Playwright expect mechanics
|
|
51
|
+
const isVisible = await driver.isElementDisplayed('//*[@Name="Text Editor"]');
|
|
52
|
+
expect(isVisible).toBe(true);
|
|
53
|
+
|
|
54
|
+
// 2. Test the Web App (using Playwright's built-in page fixture)
|
|
55
|
+
console.log('Navigating to Web portal...');
|
|
56
|
+
await page.goto('https://duckduckgo.com');
|
|
57
|
+
await page.fill('#searchbox_input', 'Playwright automation');
|
|
58
|
+
|
|
59
|
+
// 3. Cleanup both layers
|
|
60
|
+
await driver.closeAll();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
Step 3: Run the Spec File
|
|
64
|
+
Make sure your background Appium server is running (npx appium), then run your spec file using the Playwright CLI:
|
|
65
|
+
|
|
66
|
+
Bash
|
|
67
|
+
npx playwright test test.spec.ts --headed
|
package/package.json
CHANGED