Skip to content

Commit 736b3ba

Browse files
Solve annotations tests
1 parent db109ba commit 736b3ba

File tree

1 file changed

+67
-61
lines changed

1 file changed

+67
-61
lines changed

ui-tests/tests/annotations.spec.ts

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,78 @@ import { expect } from '@playwright/test';
33
import path from 'path';
44

55
test.describe('#annotations', () => {
6-
test.beforeAll(async ({ request }) => {
7-
const content = galata.newContentsHelper(request);
8-
await content.deleteDirectory('/testDir');
9-
await content.uploadDirectory(
10-
path.resolve(__dirname, './gis-files'),
11-
'/testDir',
12-
);
13-
});
14-
test.beforeEach(async ({ page }) => {
15-
await page.filebrowser.open('testDir/annotation-test.jGIS');
16-
});
6+
test.beforeAll(async ({ request }) => {
7+
const content = galata.newContentsHelper(request);
8+
await content.deleteDirectory('/testDir');
9+
await content.uploadDirectory(
10+
path.resolve(__dirname, './gis-files'),
11+
'/testDir',
12+
);
13+
});
14+
test.beforeEach(async ({ page }) => {
15+
await page.filebrowser.open('testDir/annotation-test.jGIS');
16+
});
1717

18-
test.afterEach(async ({ page }) => {
19-
await page.activity.closeAll();
20-
});
18+
test.afterEach(async ({ page }) => {
19+
await page.activity.closeAll();
20+
});
2121

22-
test('Should be able to add an annotation', async ({ page }) => {
23-
const main = page.locator('.jGIS-Mainview');
24-
await expect(main).toBeVisible();
22+
test('Should be able to add an annotation', async ({ page }) => {
23+
const main = page.locator('.jGIS-Mainview');
24+
await expect(main).toBeVisible();
2525

26-
await page.locator('canvas').click({
27-
button: 'right',
28-
position: {
29-
x: 253,
30-
y: 194,
31-
},
32-
});
33-
await page.getByText('Add annotation').click();
34-
await page
35-
.getByLabel('annotation-test.jGIS')
36-
.getByPlaceholder('Ctrl+Enter to submit')
37-
.click();
38-
await page
39-
.getByLabel('annotation-test.jGIS')
40-
.getByPlaceholder('Ctrl+Enter to submit')
41-
.fill('this is a test');
42-
await page
43-
.getByRole('region', { name: 'notebook content' })
44-
.getByRole('button')
45-
.nth(1)
46-
.click();
26+
await page.locator('canvas').click({
27+
button: 'right',
28+
position: {
29+
x: 253,
30+
y: 194,
31+
},
32+
});
4733

48-
// Check map
49-
await expect(
50-
page.getByLabel('annotation-test.jGIS').getByRole('paragraph'),
51-
).toContainText('this is a test');
34+
await page.getByText('Annotations').click();
35+
await page.getByText('Add annotation').click();
36+
await page
37+
.getByLabel('annotation-test.jGIS')
38+
.getByPlaceholder('Ctrl+Enter to submit')
39+
.click();
40+
await page
41+
.getByLabel('annotation-test.jGIS')
42+
.getByPlaceholder('Ctrl+Enter to submit')
43+
.fill('this is a test');
44+
await page
45+
.getByRole('region', { name: 'notebook content' })
46+
.getByRole('button')
47+
.nth(1)
48+
.click();
5249

53-
// Check side panel
54-
await expect(
55-
page.getByLabel('Annotations', { exact: true }).getByRole('paragraph'),
56-
).toContainText('this is a test');
50+
// Check map
51+
await expect(
52+
page
53+
.getByLabel('annotation-test.jGIS')
54+
.getByRole('paragraph'),
55+
).toContainText('this is a test');
5756

58-
// Delete
59-
await page
60-
.getByRole('region', { name: 'notebook content' })
61-
.getByRole('button')
62-
.first()
63-
.click();
64-
await page.getByRole('button', { name: 'Delete' }).click();
57+
// Check side panel
58+
await expect(
59+
page
60+
.getByLabel('Annotations', { exact: true })
61+
.getByRole('paragraph'),
62+
).toContainText('this is a test');
6563

66-
await expect(
67-
page
68-
.getByLabel('annotation-test.jGIS')
69-
.locator('div')
70-
.filter({ hasText: /^AHthis is a test$/ })
71-
.nth(2),
72-
).not.toBeVisible();
73-
});
64+
// Delete
65+
await page
66+
.getByRole('region', { name: 'notebook content' })
67+
.getByRole('button')
68+
.first()
69+
.click();
70+
await page.getByRole('button', { name: 'Delete' }).click();
71+
72+
await expect(
73+
page
74+
.getByLabel('annotation-test.jGIS')
75+
.locator('div')
76+
.filter({ hasText: /^AHthis is a test$/ })
77+
.nth(2),
78+
).not.toBeVisible();
79+
});
7480
});

0 commit comments

Comments
 (0)