Skip to content

Commit c285576

Browse files
committed
test: e2e tests for switching between mentions
1 parent 59411bc commit c285576

11 files changed

Lines changed: 102 additions & 7 deletions
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
appId: swmansion.enriched.example
2+
---
3+
# fix PR #637 - mention popups not closing when switching between mentions
4+
5+
- launchApp
6+
7+
- tapOn:
8+
id: "toggle-screen-button"
9+
10+
- tapOn:
11+
id: "editor-input"
12+
13+
- inputText: "mentions #gen @J"
14+
15+
# user popup visible
16+
- runFlow:
17+
file: "../subflows/capture_or_assert_fullscreen_screenshot.yaml"
18+
env:
19+
SCREENSHOT_NAME: "mention_popup_closing_on_cursor_travel_1"
20+
21+
- tapOn:
22+
id: "focus-button"
23+
24+
- tapOn:
25+
id: "editor-input"
26+
point: "30%, 50%"
27+
28+
# channel popup visible
29+
- runFlow:
30+
file: "../subflows/capture_or_assert_fullscreen_screenshot.yaml"
31+
env:
32+
SCREENSHOT_NAME: "mention_popup_closing_on_cursor_travel_2"
33+
34+
- tapOn:
35+
id: "focus-button"
36+
37+
- tapOn:
38+
id: "editor-input"
39+
point: "10%, 50%"
40+
41+
# no popup visible
42+
- runFlow:
43+
file: "../subflows/capture_or_assert_fullscreen_screenshot.yaml"
44+
env:
45+
SCREENSHOT_NAME: "mention_popup_closing_on_cursor_travel_3"
75.3 KB
Loading
69.8 KB
Loading
63.9 KB
Loading
89.9 KB
Loading
82.1 KB
Loading
74.3 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
appId: swmansion.enriched.example
2+
---
3+
- tapOn:
4+
id: 'blur-button'
5+
6+
- runFlow:
7+
file: '../../subflows/capture_or_assert_screenshot.yaml'
8+
env:
9+
ELEMENT_ID: 'full-screen'
10+
SCREENSHOT_PREFIX: 'enrichedInput'

.playwright/tests/mentions.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ test('switching to a different mention starts it and ends the previous one', asy
281281
await expect(eventType(page)).toHaveText('start');
282282
await expect(eventIndicator(page)).toHaveText('@');
283283
await expect(lastEndEvent(page)).toHaveText('#');
284+
await editor.press('ArrowLeft');
284285
await editor.press('ArrowLeft'); // back to the '#' mention
285286
await expect(eventType(page)).toHaveText('change');
286287
await expect(eventIndicator(page)).toHaveText('#');
@@ -291,3 +292,24 @@ test('switching to a different mention starts it and ends the previous one', asy
291292
await expect(eventType(page)).toHaveText('end');
292293
await expect(eventIndicator(page)).toHaveText('#');
293294
});
295+
296+
test("inserting a mention between text doesn't produce a double space", async ({
297+
page,
298+
}) => {
299+
await gotoMentionTest(page);
300+
const editor = mentionEditor(page);
301+
await editor.click();
302+
await editor.pressSequentially('example ', { delay: 80 });
303+
await editor.pressSequentially(' test', { delay: 80 });
304+
for (let i = 0; i < 5; i++) {
305+
await editor.press('ArrowLeft');
306+
}
307+
await editor.press('@');
308+
await page.locator(sel.setUserButton).click();
309+
await page.waitForTimeout(2000);
310+
await expect
311+
.poll(async () => await htmlOutput(page).textContent())
312+
.toEqual(
313+
'<html><p>example <mention text="Jane" indicator="@" id="1">Jane</mention> test</p></html>'
314+
);
315+
});

apps/example/metro.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,21 @@ const root = path.resolve(__dirname, '../..');
1010
*
1111
* @type {import('metro-config').MetroConfig}
1212
*/
13-
module.exports = withMetroConfig(getDefaultConfig(__dirname), {
13+
const config = withMetroConfig(getDefaultConfig(__dirname), {
1414
root,
1515
dirname: __dirname,
1616
});
17+
18+
config.resolver = {
19+
...config.resolver,
20+
blockList: [
21+
...(Array.isArray(config.resolver?.blockList)
22+
? config.resolver.blockList
23+
: config.resolver?.blockList
24+
? [config.resolver.blockList]
25+
: []),
26+
/.*\/\.maestro\/.*/,
27+
],
28+
};
29+
30+
module.exports = config;

0 commit comments

Comments
 (0)