diff --git a/.changeset/good-ears-refuse.md b/.changeset/good-ears-refuse.md new file mode 100644 index 000000000..55f6cff13 --- /dev/null +++ b/.changeset/good-ears-refuse.md @@ -0,0 +1,5 @@ +--- +"@layerzerolabs/devtools-move": patch +--- + +fix e2e test diff --git a/.github/workflows/reusable-test.yaml b/.github/workflows/reusable-test.yaml index 7b2e16a3f..27a54e4a3 100644 --- a/.github/workflows/reusable-test.yaml +++ b/.github/workflows/reusable-test.yaml @@ -162,16 +162,6 @@ jobs: - name: Setup build cache uses: ./.github/workflows/actions/setup-build-cache - - name: E2E Test Notice - run: | - echo "::notice::๐Ÿงช E2E tests are non-blocking and run against live networks" - echo "::notice::These tests validate real blockchain interactions but may fail due to:" - echo "::notice:: - Network connectivity issues" - echo "::notice:: - RPC rate limiting" - echo "::notice:: - External service downtime" - echo "::notice:: - Gas price fluctuations" - echo "::notice::E2E test failures do NOT block the main CI pipeline" - # There is a small bug in docker compose that will cause 401 if we don't pull the base image manually # # See more here https://github.com/docker/compose-cli/issues/1545 @@ -217,34 +207,74 @@ jobs: with: path: ./logs - # Post comment on E2E test failure - - name: Comment on E2E failure - if: steps.test-e2e.outcome == 'failure' + # Post comment on E2E test completion (success or failure) + - name: Comment on E2E results + if: always() && steps.test-e2e.outcome != 'skipped' && steps.test-e2e.outcome != 'cancelled' uses: actions/github-script@v7 with: script: | + const outcome = '${{ steps.test-e2e.outcome }}'; + const emoji = outcome === 'success' ? 'โœ…' : 'โŒ'; + const status = outcome === 'success' ? 'Passed' : 'Failed'; + const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 16) + ' (UTC)'; + const runNumber = context.runNumber; const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; const prNumber = context.payload.pull_request?.number; + const header = "## ๐Ÿงช E2E Test Status"; + + const newEntry = `- ${emoji} [Run #${runNumber}](${runUrl}) - ${status} - ${timestamp}`; if (prNumber) { - const comment = "## ๐Ÿšจ E2E Tests Failed\n\n" + - "The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:\n" + - "- Network connectivity issues\n" + - "- RPC rate limiting\n" + - "- External service downtime\n" + - "**Action Run:** " + runUrl + "\n\n" + - "This is **non-blocking** and does not prevent merging. Check the action logs above for detailed failure information."; - try { - await github.rest.issues.createComment({ - issue_number: prNumber, + const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, - body: comment + issue_number: prNumber, }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes(header) + ); + + if (botComment) { + // Extract existing entries + const bodyLines = botComment.body.split('\n'); + const runsStartIndex = bodyLines.findIndex(line => line.trim() === '**Test Runs (Newest First):**'); + + let newBody; + if (runsStartIndex !== -1) { + // Prepend new entry to existing runs (newest first) + const beforeRuns = bodyLines.slice(0, runsStartIndex + 1).join('\n'); + const existingRuns = bodyLines.slice(runsStartIndex + 1).join('\n'); + newBody = beforeRuns + '\n' + newEntry + '\n' + existingRuns; + } else { + // Shouldn't happen, but handle gracefully + newBody = botComment.body + '\n\n**Test Runs (Newest First):**\n' + newEntry; + } + + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: newBody + }); + } else { + // Create new comment + const comment = header + "\n\n" + + "E2E tests are non-blocking and validate real blockchain interactions. Failures may occur due to network issues, RPC rate limits, or external service downtime.\n\n" + + "**Test Runs (Newest First):**\n" + + newEntry; + + await github.rest.issues.createComment({ + issue_number: prNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); + } } catch (error) { - // Silently fail if we don't have permission to comment (e.g., on forks) - console.log('Could not post comment to PR:', error.message); + console.log('Error managing PR comments:', error.message); } } diff --git a/packages/devtools-move/jest/e2e/initiaOFT.test.ts b/packages/devtools-move/jest/e2e/initiaOFT.test.ts index 0e329be3a..1af180d5f 100644 --- a/packages/devtools-move/jest/e2e/initiaOFT.test.ts +++ b/packages/devtools-move/jest/e2e/initiaOFT.test.ts @@ -46,7 +46,7 @@ describe('InitiaOFT View Methods', () => { restClient = getConnection('initia', 'testnet') as RESTClient // Initialize with local config - using path relative to workspace root - const configPath = '../test.layerzero.config.ts' + const configPath = './jest/test.layerzero.config.ts' const context = await initializeTaskContext(configPath) oft = context.oft as InitiaOFT // Use the real REST client @@ -122,7 +122,6 @@ describe('InitiaOFT View Methods', () => { describe('getEnforcedOptions', () => { test('should return enforced options as string', async () => { - console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') const result = await oft.getEnforcedOptions(EndpointId.BSC_V2_TESTNET, 1) expect(typeof result).toBe('string') })