-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add tests for BurnerWalletConnector FE-411 (#400)
Co-authored-by: Luiz Gomes <[email protected]>
- Loading branch information
1 parent
9945f18
commit fe8ba63
Showing
7 changed files
with
132 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,18 @@ | |
"homepage": "https://github.com/FuelLabs/fuel-connectors", | ||
"type": "module", | ||
"scripts": { | ||
"test:react-app": "pnpm test:react-app:ci -- --ui", | ||
"test:react-app:ci": "playwright test e2e-tests/react-app --project=react-app" | ||
"test:e2e": "playwright test" | ||
}, | ||
"devDependencies": { | ||
"@fuels/connectors": "workspace:*", | ||
"@fuels/playwright-utils": "0.23.0", | ||
"@fuels/ts-config": "0.20.0", | ||
"@playwright/test": "1.46.1", | ||
"@types/node": "20.12.11", | ||
"@playwright/test": "1.48.1", | ||
"dotenv": "16.4.5", | ||
"fuels": "0.96.1" | ||
}, | ||
"engines": { | ||
"node": ">=18", | ||
"pnpm": ">=9" | ||
"node": ">=20.11.0", | ||
"pnpm": "9.x" | ||
}, | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"playwright": "1.46.1" | ||
} | ||
"packageManager": "[email protected]" | ||
} |
45 changes: 45 additions & 0 deletions
45
e2e-tests/react-app/connectors/BurnerWalletConnector/BurnerWalletConnector.test.ts
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,45 @@ | ||
import { getButtonByText, getByAriaLabel, test } from '@fuels/playwright-utils'; | ||
import { type Page, expect } from '@playwright/test'; | ||
|
||
const connectBurner = async (page: Page, walletName = 'Burner Wallet') => { | ||
await page.bringToFront(); | ||
const connectButton = getButtonByText(page, 'Connect'); | ||
await connectButton.click(); | ||
await getByAriaLabel(page, `Connect to ${walletName}`, true).click(); | ||
}; | ||
|
||
test.describe('BurnerWalletConnector', async () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/'); | ||
await page.bringToFront(); | ||
}); | ||
|
||
test('should connect and show fuel address', async ({ page }) => { | ||
await connectBurner(page); | ||
|
||
expect(await page.waitForSelector('text=/Your Fuel Address/')).toBeTruthy(); | ||
|
||
await test.step('should connect, disconnect, and reconnect', async () => { | ||
await page.click('text=Disconnect'); | ||
await page.waitForSelector('text=/Connect Wallet/'); | ||
|
||
await connectBurner(page); | ||
expect( | ||
await page.waitForSelector('text=/Your Fuel Address/'), | ||
).toBeTruthy(); | ||
}); | ||
|
||
await test.step('should connect, refresh and stay connected', async () => { | ||
await page.reload(); | ||
await page.waitForSelector('text=/Your Fuel Address/'); | ||
}); | ||
|
||
await test.step('should connect, disconnect, refresh and stay disconnected', async () => { | ||
await page.click('text=Disconnect'); | ||
await page.waitForSelector('text=/Connect Wallet/'); | ||
|
||
await page.reload(); | ||
await page.waitForSelector('text=/Connect Wallet/'); | ||
}); | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
packages: | ||
- 'examples/*' | ||
- 'packages/*' | ||
- 'e2e-tests' |
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 |
---|---|---|
|
@@ -23,6 +23,9 @@ | |
}, | ||
"test": { | ||
"dependsOn": ["^build"] | ||
}, | ||
"test:e2e": { | ||
"cache": false | ||
} | ||
} | ||
} |