-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.spec.ts
More file actions
61 lines (36 loc) · 1.6 KB
/
example.spec.ts
File metadata and controls
61 lines (36 loc) · 1.6 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
import { test, expect, Keyboard } from '@playwright/test';
import { setup_ide } from './ide_setup';
import { exec } from 'child_process';
test('Test example', async ({ page }) => {
// IDE Setup
test.setTimeout(60000)
const ideToSetup = process.env.IDE?.toLowerCase() ?? 'eclipse'
console.log(ideToSetup);
const example = await setup_ide(ideToSetup, page)
let vscodeIframe;
let vscode = ideToSetup === 'vscode';
if (vscode) {
vscodeIframe = example.frameLocator('iframe[class="webview ready"]').frameLocator('iframe[title="undefined"]')
}
let elementXpath = '//*[contains(@class, "heading sprotty-label") and text()="KeepTp"]';
let svgElement = vscode ? await vscodeIframe.locator(elementXpath).first() : example.locator(elementXpath).first();
let textbox = vscode ? vscodeIframe.getByRole('textbox') : example.getByRole('textbox');
await svgElement?.click()
await svgElement?.dblclick()
await textbox.fill('Test');
await textbox.press('Enter');
await example.waitForTimeout(2000)
let modifiedXpath = '//*[contains(@class, "heading sprotty-label") and text()="Test"]';
expect(vscode ? vscodeIframe.locator(modifiedXpath).first() : example.locator(modifiedXpath).first()).toBeTruthy();
await example.waitForTimeout(2000)
if (ideToSetup === 'theia') {
await example.keyboard.press('Control+Z');
await example.waitForTimeout(2000)
exec("kill -9 `lsof -t -i:3000`")
} else if (vscode) {
exec("kill -9 `lsof -t -i:8000`")
} else if (ideToSetup === 'eclipse') {
await example.keyboard.press('Control+Z');
await example.waitForTimeout(2000)
}
});