Skip to content

Commit 95a5b8d

Browse files
committed
test: e2e: client: improve
1 parent ca061bb commit 95a5b8d

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

‎.putout.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"package-json/add-type": "off"
1212
},
1313
"match": {
14+
"test-e2e": {
15+
"tape": "on"
16+
},
1417
".filesystem.json": {
1518
"nodejs/rename-file-cjs-to-js": "off"
1619
},
Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,53 +18,66 @@ test('Insert moves the cursor to the next file', async ({page}) => {
1818
await page.goto('/');
1919

2020
const rows = getRows(page);
21-
const first = rows.nth(1);
22-
const second = rows.nth(2);
21+
const first = rows.nth(0);
22+
const second = rows.nth(1);
2323

2424
await first.click();
2525
await page.keyboard.press('Insert');
2626

2727
await expect(second).toHaveClass(/current-file/);
2828
});
2929

30-
test('Insert does not leave the cursor on the first file', async ({page}) => {
30+
test('Insert does not leave the cursor on the last file', async ({page}) => {
3131
await page.goto('/');
3232

3333
const rows = getRows(page);
34-
const first = rows.nth(1);
34+
const first = rows.nth(0);
3535

3636
await first.click();
3737
await page.keyboard.press('Insert');
3838

3939
await expect(first).not.toHaveClass(/current-file/);
4040
});
4141

42-
test('pressing Insert twice selects two consecutive files', async ({page}) => {
42+
test('pressing Insert twice selects two consecutive files: first selected', async ({page}) => {
4343
await page.goto('/');
4444

4545
const rows = getRows(page);
46-
const first = rows.nth(1);
47-
const second = rows.nth(2);
46+
const first = rows.nth(0);
4847

4948
await first.click();
5049
await page.keyboard.press('Insert');
5150
await page.keyboard.press('Insert');
5251

5352
await expect(first).toHaveClass(/selected-file/);
53+
});
54+
55+
test('pressing Insert twice selects two consecutive files: second selected', async ({page}) => {
56+
await page.goto('/');
57+
58+
const rows = getRows(page);
59+
const first = rows.nth(0);
60+
const second = rows.nth(1);
61+
62+
await first.click();
63+
await page.keyboard.press('Insert');
64+
await page.keyboard.press('Insert');
65+
5466
await expect(second).toHaveClass(/selected-file/);
5567
});
5668

57-
test('pressing Insert twice leaves cursor on the third file', async ({page}) => {
69+
test('pressing Insert twice leaves cursor on the second file', async ({page}) => {
5870
await page.goto('/');
5971

6072
const rows = getRows(page);
61-
const third = rows.nth(3);
73+
const second = rows.nth(1);
6274

6375
await rows
6476
.nth(1)
6577
.click();
78+
6679
await page.keyboard.press('Insert');
6780
await page.keyboard.press('Insert');
6881

69-
await expect(third).toHaveClass(/current-file/);
82+
await expect(second).toHaveClass(/current-file/);
7083
});

0 commit comments

Comments
 (0)