Skip to content

Commit 3aad4fe

Browse files
committed
chore: e2e: improve
1 parent 94fb9b3 commit 3aad4fe

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎test-e2e/client/fixture/a.txt‎

Whitespace-only changes.

‎test-e2e/client/keys/insert.js‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ test('Insert selects the current file', async ({page}) => {
66
await page.goto('/');
77

88
const rows = getRows(page);
9-
const dotdot = rows.nth(0);
10-
11-
await expect(dotdot).toHaveClass(/current-file/);
9+
const first = rows.nth(0);
1210

13-
const first = rows.nth(1);
11+
await expect(first).toHaveClass(/current-file/);
1412

1513
await first.click();
1614
await page.keyboard.press('Insert');
@@ -33,7 +31,7 @@ test('Insert moves the cursor to the next file', async ({page}) => {
3331
await expect(second).toHaveClass(/current-file/);
3432
});
3533

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

3937
const rows = getRows(page);
@@ -51,12 +49,14 @@ test('pressing Insert twice selects two consecutive files: first selected', asyn
5149
await page.goto('/');
5250

5351
const rows = getRows(page);
54-
const first = rows.nth(1);
55-
const second = rows.nth(2);
52+
const first = rows.nth(0);
53+
const second = rows.nth(1);
5654

5755
await first.click();
5856
await page.keyboard.press('Insert');
57+
5958
await expect(second).toHaveClass(/current-file/);
59+
6060
await page.keyboard.press('Insert');
6161

6262
await expect(first).toHaveClass(/selected-file/);
@@ -71,23 +71,28 @@ test('pressing Insert twice selects two consecutive files: second selected', asy
7171

7272
await first.click();
7373
await page.keyboard.press('Insert');
74+
75+
await expect(second).toHaveClass(/current-file/);
76+
7477
await page.keyboard.press('Insert');
7578

7679
await expect(second).toHaveClass(/selected-file/);
7780
});
7881

79-
test('pressing Insert twice leaves cursor on the second file', async ({page}) => {
82+
test('pressing Insert twice leaves cursor on the third file', async ({page}) => {
8083
await page.goto('/');
8184

8285
const rows = getRows(page);
86+
const first = rows.nth(0);
8387
const second = rows.nth(1);
88+
const third = rows.nth(2);
8489

85-
await rows
86-
.nth(1)
87-
.click();
88-
89-
await page.keyboard.press('Insert');
90+
await first.click();
9091
await page.keyboard.press('Insert');
9192

9293
await expect(second).toHaveClass(/current-file/);
94+
95+
await page.keyboard.press('Insert');
96+
97+
await expect(third).toHaveClass(/current-file/);
9398
});

‎test-e2e/client/view.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ test('F3 on a .png file does not open the text viewer', async ({page}) => {
2020
await page.keyboard.press('F3');
2121

2222
const modal = getModal(page);
23-
const modalText = await modal.textContent();
23+
await expect(modal).toBeVisible();
2424

25-
await expect(modalText).not.toContain('PNG');
25+
await expect(modal).not.toContainText('PNG');
2626
});
2727

2828
test('double-click on a .png file opens the image viewer', async ({page}) => {
@@ -38,9 +38,9 @@ test('double-click on a .png file does not open the text viewer', async ({page})
3838
await getFile(page, 'view.png').dblclick();
3939

4040
const modal = getModal(page);
41-
const modalText = await modal.textContent();
41+
await expect(modal).toBeVisible();
4242

43-
await expect(modalText).not.toContain('PNG');
43+
await expect(modal).not.toContainText('PNG');
4444
});
4545

4646
test('F3 on a .txt file opens the text viewer', async ({page}) => {
@@ -59,5 +59,6 @@ test('F3 on a .txt file shows file content', async ({page}) => {
5959

6060
const modal = getModal(page);
6161
await expect(modal).toBeVisible();
62+
6263
await expect(modal).not.toHaveText('');
6364
});

0 commit comments

Comments
 (0)