-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(boxes): adding frontend test to vanilla-js box
Please read [contributing guidelines](CONTRIBUTING.md) and remove this line.
- Loading branch information
1 parent
86d6749
commit cd1ca2e
Showing
9 changed files
with
152 additions
and
14 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
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,37 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './tests', | ||
fullyParallel: true, | ||
retries: 3, | ||
workers: process.env.CI ? 1 : 3, | ||
reporter: 'list', | ||
use: { | ||
baseURL: 'http://127.0.0.1:5173', | ||
trace: 'on-first-retry', | ||
screenshot: 'only-on-failure', | ||
video: 'on-first-retry', | ||
}, | ||
expect: { | ||
timeout: 30000, | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
webServer: { | ||
command: 'yarn serve', | ||
port: 5173, | ||
}, | ||
}); |
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
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,38 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Deploying, setting, and getting a number', async ({ page }) => { | ||
test.slow(); | ||
await page.goto('/'); | ||
|
||
const handleDialog = (expectedMessage: string) => { | ||
return new Promise<void>(resolve => { | ||
page.once('dialog', async dialog => { | ||
expect(dialog.message()).toContain(expectedMessage); | ||
await dialog.accept(); | ||
resolve(); | ||
}); | ||
}); | ||
}; | ||
|
||
// Deploy contract | ||
const deployDialogPromise = handleDialog('Contract deployed at'); | ||
await page.getByRole('button', { name: 'Deploy' }).click(); | ||
await deployDialogPromise; | ||
await expect(page.locator('#number')).toHaveValue('0'); | ||
|
||
// Get number | ||
const getNumberDialogPromise = handleDialog('Number is:'); | ||
await page.getByRole('button', { name: 'Get Number' }).click(); | ||
await getNumberDialogPromise; | ||
|
||
// Set number | ||
await page.locator('#number').fill('1'); | ||
const setNumberDialogPromise = handleDialog('Number set!'); | ||
await page.getByRole('button', { name: 'Set Number' }).click(); | ||
await setNumberDialogPromise; | ||
|
||
// Verifying number | ||
const verifyNumberDialogPromise = handleDialog('Number is: 1'); | ||
await page.getByRole('button', { name: 'Get Number' }).click(); | ||
await verifyNumberDialogPromise; | ||
}); |
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