Skip to content

Commit f447c85

Browse files
authored
feat: test e2e improvements (#1883)
Signed-off-by: shankar <shankar@layerzerolabs.org>
1 parent cd8af7b commit f447c85

3 files changed

Lines changed: 62 additions & 28 deletions

File tree

.changeset/good-ears-refuse.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@layerzerolabs/devtools-move": patch
3+
---
4+
5+
fix e2e test

.github/workflows/reusable-test.yaml

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ jobs:
162162
- name: Setup build cache
163163
uses: ./.github/workflows/actions/setup-build-cache
164164

165-
- name: E2E Test Notice
166-
run: |
167-
echo "::notice::🧪 E2E tests are non-blocking and run against live networks"
168-
echo "::notice::These tests validate real blockchain interactions but may fail due to:"
169-
echo "::notice:: - Network connectivity issues"
170-
echo "::notice:: - RPC rate limiting"
171-
echo "::notice:: - External service downtime"
172-
echo "::notice:: - Gas price fluctuations"
173-
echo "::notice::E2E test failures do NOT block the main CI pipeline"
174-
175165
# There is a small bug in docker compose that will cause 401 if we don't pull the base image manually
176166
#
177167
# See more here https://github.com/docker/compose-cli/issues/1545
@@ -217,34 +207,74 @@ jobs:
217207
with:
218208
path: ./logs
219209

220-
# Post comment on E2E test failure
221-
- name: Comment on E2E failure
222-
if: steps.test-e2e.outcome == 'failure'
210+
# Post comment on E2E test completion (success or failure)
211+
- name: Comment on E2E results
212+
if: always() && steps.test-e2e.outcome != 'skipped' && steps.test-e2e.outcome != 'cancelled'
223213
uses: actions/github-script@v7
224214
with:
225215
script: |
216+
const outcome = '${{ steps.test-e2e.outcome }}';
217+
const emoji = outcome === 'success' ? '✅' : '❌';
218+
const status = outcome === 'success' ? 'Passed' : 'Failed';
219+
const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 16) + ' (UTC)';
220+
const runNumber = context.runNumber;
226221
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
227222
const prNumber = context.payload.pull_request?.number;
223+
const header = "## 🧪 E2E Test Status";
224+
225+
const newEntry = `- ${emoji} [Run #${runNumber}](${runUrl}) - ${status} - ${timestamp}`;
228226
229227
if (prNumber) {
230-
const comment = "## 🚨 E2E Tests Failed\n\n" +
231-
"The E2E tests failed during CI. These tests validate real blockchain interactions and may fail due to:\n" +
232-
"- Network connectivity issues\n" +
233-
"- RPC rate limiting\n" +
234-
"- External service downtime\n" +
235-
"**Action Run:** " + runUrl + "\n\n" +
236-
"This is **non-blocking** and does not prevent merging. Check the action logs above for detailed failure information.";
237-
238228
try {
239-
await github.rest.issues.createComment({
240-
issue_number: prNumber,
229+
const { data: comments } = await github.rest.issues.listComments({
241230
owner: context.repo.owner,
242231
repo: context.repo.repo,
243-
body: comment
232+
issue_number: prNumber,
244233
});
234+
235+
const botComment = comments.find(comment =>
236+
comment.user.type === 'Bot' &&
237+
comment.body.includes(header)
238+
);
239+
240+
if (botComment) {
241+
// Extract existing entries
242+
const bodyLines = botComment.body.split('\n');
243+
const runsStartIndex = bodyLines.findIndex(line => line.trim() === '**Test Runs (Newest First):**');
244+
245+
let newBody;
246+
if (runsStartIndex !== -1) {
247+
// Prepend new entry to existing runs (newest first)
248+
const beforeRuns = bodyLines.slice(0, runsStartIndex + 1).join('\n');
249+
const existingRuns = bodyLines.slice(runsStartIndex + 1).join('\n');
250+
newBody = beforeRuns + '\n' + newEntry + '\n' + existingRuns;
251+
} else {
252+
// Shouldn't happen, but handle gracefully
253+
newBody = botComment.body + '\n\n**Test Runs (Newest First):**\n' + newEntry;
254+
}
255+
256+
await github.rest.issues.updateComment({
257+
owner: context.repo.owner,
258+
repo: context.repo.repo,
259+
comment_id: botComment.id,
260+
body: newBody
261+
});
262+
} else {
263+
// Create new comment
264+
const comment = header + "\n\n" +
265+
"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" +
266+
"**Test Runs (Newest First):**\n" +
267+
newEntry;
268+
269+
await github.rest.issues.createComment({
270+
issue_number: prNumber,
271+
owner: context.repo.owner,
272+
repo: context.repo.repo,
273+
body: comment
274+
});
275+
}
245276
} catch (error) {
246-
// Silently fail if we don't have permission to comment (e.g., on forks)
247-
console.log('Could not post comment to PR:', error.message);
277+
console.log('Error managing PR comments:', error.message);
248278
}
249279
}
250280

packages/devtools-move/jest/e2e/initiaOFT.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('InitiaOFT View Methods', () => {
4646
restClient = getConnection('initia', 'testnet') as RESTClient
4747

4848
// Initialize with local config - using path relative to workspace root
49-
const configPath = '../test.layerzero.config.ts'
49+
const configPath = './jest/test.layerzero.config.ts'
5050
const context = await initializeTaskContext(configPath)
5151
oft = context.oft as InitiaOFT
5252
// Use the real REST client
@@ -122,7 +122,6 @@ describe('InitiaOFT View Methods', () => {
122122

123123
describe('getEnforcedOptions', () => {
124124
test('should return enforced options as string', async () => {
125-
console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
126125
const result = await oft.getEnforcedOptions(EndpointId.BSC_V2_TESTNET, 1)
127126
expect(typeof result).toBe('string')
128127
})

0 commit comments

Comments
 (0)