Skip to content

Commit

Permalink
fix: interactive cli
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahschwartz committed Aug 7, 2024
1 parent a046b50 commit 3ef0f15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
tutorial:
- "tests/erc20-paymaster.spec.ts"
- "tests/how-to-test-contracts.spec.ts"
- "tests/how-to-test-contracts.spec.ts"

steps:
- uses: actions/checkout@v4
Expand All @@ -22,4 +22,9 @@ jobs:
- name: Install Playwright Browsers
run: bun playwright install chromium --with-deps
- name: Run test for ${{ matrix.tutorial }}
run: bun test:github ${{ matrix.tutorial }}
run: |
export TERM=xterm-256color
export COLUMNS=80
export LINES=24
script -q -c "bun test:github ${{ matrix.tutorial }}"
6 changes: 4 additions & 2 deletions tests/utils/runCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,19 @@ export async function runWithPrompts(page: Page, command: string, prompts: strin
});

ptyProcess.onData((data) => {
process.stdout.write(data);
console.log('DATA:', data);

for (let index = 0; index < promptsArray.length; index++) {
const promptObject = promptsArray[index];
if (data.includes(promptObject.prompt)) {
console.log('FOUND PROMPT:', promptObject.prompt);
ptyProcess.write(promptObject.answer + '\r');
}
}
});

ptyProcess.write(command + '\r');

await page.waitForTimeout(5000);
await page.waitForTimeout(35000);
console.log('waited 35 seconds');
}

0 comments on commit 3ef0f15

Please sign in to comment.