Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions freebuff/e2e/tests/slash-commands.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { afterEach, describe, expect, test } from 'bun:test'
import { FreebuffSession, requireFreebuffBinary } from '../utils'

const TEST_TIMEOUT = 60_000
const SESSION_HEIGHT = 40

/**
* Commands that should be REMOVED in Freebuff.
Expand Down Expand Up @@ -51,11 +52,13 @@ describe('Freebuff: Slash Commands', () => {
'slash command menu does not show removed commands',
async () => {
const binary = requireFreebuffBinary()
session = await FreebuffSession.start(binary, { waitSeconds: 5 })
session = await FreebuffSession.start(binary, { waitSeconds: 5, height: SESSION_HEIGHT })

// Type "/" to trigger the slash command autocomplete menu
await session.send('/', { noEnter: true })
const output = await session.capture(2)
// Use sendKey instead of send to avoid C-u clearing keystroke that
// interferes with opentui's input handling in newer versions
await session.sendKey('/')
const output = await session.capture(4)

// Removed commands should NOT appear in the autocomplete menu
for (const cmd of REMOVED_COMMANDS) {
Expand All @@ -71,11 +74,11 @@ describe('Freebuff: Slash Commands', () => {
'slash command menu shows kept commands',
async () => {
const binary = requireFreebuffBinary()
session = await FreebuffSession.start(binary, { waitSeconds: 5 })
session = await FreebuffSession.start(binary, { waitSeconds: 5, height: SESSION_HEIGHT })

// Type "/" to trigger the slash command autocomplete menu
await session.send('/', { noEnter: true })
const output = await session.capture(2)
await session.sendKey('/')
const output = await session.capture(4)

// Kept commands SHOULD appear in the autocomplete menu
for (const cmd of KEPT_COMMANDS) {
Expand All @@ -90,11 +93,12 @@ describe('Freebuff: Slash Commands', () => {
'no mode-related slash commands are visible',
async () => {
const binary = requireFreebuffBinary()
session = await FreebuffSession.start(binary, { waitSeconds: 5 })
session = await FreebuffSession.start(binary, { waitSeconds: 5, height: SESSION_HEIGHT })

// Type "/mode" to check for mode commands
await session.send('/mode', { noEnter: true })
const output = await session.capture(2)
// Use sendKey for the full string to avoid C-u clearing the input
await session.sendKey('/mode')
const output = await session.capture(4)

// Mode commands should not exist in Freebuff
expect(output).not.toContain('mode:max')
Expand Down
2 changes: 1 addition & 1 deletion freebuff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"release": "bun cli/release.ts",
"build:binary": "bun cli/build.ts 0.0.0-dev",
"e2e": "bun test e2e/tests/",
"e2e": "bun run build:binary && bun test e2e/tests/",
"e2e:version": "bun test e2e/tests/version.e2e.test.ts",
"e2e:startup": "bun test e2e/tests/startup.e2e.test.ts",
"e2e:help": "bun test e2e/tests/help-command.e2e.test.ts",
Expand Down
Loading