Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add integration test for the create fuels template #2278

Merged
merged 40 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1ba71c6
setup playwright
Dhaiwat10 May 9, 2024
57bb3c6
modify tests
Dhaiwat10 May 9, 2024
0f8cfcf
Update example.spec.ts
Dhaiwat10 May 9, 2024
72f0f47
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 10, 2024
284d1d3
update test logic
Dhaiwat10 May 14, 2024
bb01e46
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 14, 2024
dda70ad
use test-setup instead of ci-setup
Dhaiwat10 May 16, 2024
6b610a5
fix test logic
Dhaiwat10 May 20, 2024
dc0023f
add debug html
Dhaiwat10 May 20, 2024
1686636
more debug
Dhaiwat10 May 20, 2024
d1f84a3
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 20, 2024
7f62430
Update example.spec.ts
Dhaiwat10 May 20, 2024
ebf0753
Merge branch 'dp/create-fuels-template-e2e-tests' of https://github.c…
Dhaiwat10 May 20, 2024
2d439bf
create .env.local
Dhaiwat10 May 20, 2024
5d4ea49
cleanup and changeset
Dhaiwat10 May 20, 2024
c06fa51
update changeset
Dhaiwat10 May 20, 2024
42a105e
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 20, 2024
1159895
cleanup
Dhaiwat10 May 20, 2024
4968c10
Merge branch 'dp/create-fuels-template-e2e-tests' of https://github.c…
Dhaiwat10 May 20, 2024
a2beb72
remove `main` from branches list
Dhaiwat10 May 21, 2024
7b555d1
refactor into shell script & rename worflow file
Dhaiwat10 May 21, 2024
4087703
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 21, 2024
3752cf9
move e2e test to `test.yml` file
Dhaiwat10 May 21, 2024
e3f8a05
Merge branch 'dp/create-fuels-template-e2e-tests' of https://github.c…
Dhaiwat10 May 21, 2024
c71c4da
remove unnecessary `needs`
Dhaiwat10 May 21, 2024
8abf0d3
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Torres-ssf May 21, 2024
f04a9b1
change changeset to chore
Dhaiwat10 May 21, 2024
ffe3433
add #!/bin/bash to sh script
Dhaiwat10 May 22, 2024
3447bde
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 22, 2024
5a79945
Merge branch 'master' into dp/create-fuels-template-e2e-tests
petertonysmith94 May 23, 2024
4145ec9
Merge branch 'master' into dp/create-fuels-template-e2e-tests
petertonysmith94 May 23, 2024
0a2fbed
rename e2e -> integration
Dhaiwat10 May 24, 2024
ad7fb70
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 24, 2024
a41c16c
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 25, 2024
298f82d
increase timeout
Dhaiwat10 May 27, 2024
cf3d6df
use test-id to locate counter
Dhaiwat10 May 27, 2024
02c4388
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 27, 2024
d796365
Merge branch 'master' into dp/create-fuels-template-e2e-tests
arboleya May 28, 2024
fec2fb9
Merge branch 'master' into dp/create-fuels-template-e2e-tests
petertonysmith94 May 28, 2024
d27d357
Merge branch 'master' into dp/create-fuels-template-e2e-tests
Dhaiwat10 May 28, 2024
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
4 changes: 4 additions & 0 deletions .changeset/great-teachers-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: add integration test for the `create fuels` template
15 changes: 15 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ jobs:
FUEL_TESTNET_NETWORK_URL: ${{ secrets.FUEL_TESTNET_NETWORK_URL }}
PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }}

create-fuels-template-integration:
timeout-minutes: 10
runs-on: ubuntu-latest
nedsalk marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Test Setup
uses: ./.github/actions/test-setup

- name: Run UI tests
run: sh ./scripts/create-fuels-template-integration.sh

test:
if: github.base_ref == 'master' || github.ref_name == 'master'
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ Forc.lock
.fuel-core/configs/chainConfig.json
.fuel-core/configs/metadata.json
.fuel-core/configs/stateConfig.json
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@fuel-ts/utils": "workspace:*",
"@internal/tsup": "workspace:*",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@playwright/test": "^1.44.0",
"@types/node": "18.15.3",
"@types/node-fetch": "^2.6.2",
"@types/web": "^0.0.65",
Expand Down
27 changes: 27 additions & 0 deletions playwright-tests/create-fuels.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';

test('counter contract - increment function call works properly', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/', { waitUntil: 'networkidle' });

await page.waitForTimeout(2000);

const topUpWalletButton = page.getByText('Top-up Wallet');
await topUpWalletButton.click();

const welcomeToFuelText = page.getByText('Welcome to Fuel');
await expect(welcomeToFuelText).toBeVisible();

await page.waitForTimeout(2000);

await page.reload();

await page.waitForTimeout(5000);

const incrementButton = page.getByText('Increment Counter');
await incrementButton.click();

await page.waitForTimeout(2000);

const counter = page.getByTestId('counter');
await expect(counter).toBeVisible();
});
30 changes: 30 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfig, devices } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './playwright-tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});
Loading
Loading