-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8b1bf3
commit 67ba405
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import mesop as me | ||
import mesop.labs as mel | ||
|
||
|
||
@me.page( | ||
path="/testing/text_to_text", | ||
title="Text to Text Example", | ||
) | ||
def app(): | ||
mel.text_to_text( | ||
echo, | ||
title="Text to Text Example", | ||
) | ||
|
||
|
||
def echo(s: str): | ||
return "Echo: " + s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test('text to text', async ({page}) => { | ||
await page.goto('/testing/text_to_text'); | ||
const inputLocator = page.locator('#mat-input-0'); | ||
await inputLocator.click(); | ||
await inputLocator.fill('fly'); | ||
// Need to wait for the input state to be saved before clicking. | ||
await page.waitForTimeout(2000); | ||
await page.getByRole('button', {name: 'Generate'}).click(); | ||
await expect(page.getByText('Echo: fly')).toBeVisible(); | ||
|
||
await inputLocator.click(); | ||
await inputLocator.fill('abc'); | ||
// Need to wait for the input state to be saved before clicking. | ||
await page.waitForTimeout(2000); | ||
await page.getByRole('button', {name: 'Generate'}).click(); | ||
await expect(page.getByText('Echo: abc')).toBeVisible(); | ||
}); |