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

Use sparse checkout for e2e tests #3984

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .github/workflows/frontend-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: print environment_url and BRANCH_NAME
env:
BASE_URL: "https://${{ needs.wait-for-deployment.outputs.environment_url }}"
Expand Down Expand Up @@ -78,6 +81,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -115,6 +121,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -150,6 +159,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -188,6 +200,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/monitoring-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ jobs:
run: curl -L "https://ipinfo.io" -s
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/monitoring-limit-geo-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -49,6 +52,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -91,6 +97,9 @@ jobs:
run: curl -L "https://ipinfo.io" -s
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -132,6 +141,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -173,6 +185,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -214,6 +229,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -255,6 +273,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -293,6 +314,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prod-frontend-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
sparse-checkout: |
packages/e2e
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion packages/e2e/pages/trade-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ export class TradePage extends BasePage {
}

async gotoOrdersHistory(timeout = 1) {
console.log("Go to Order History page.");
await this.page.waitForTimeout(1000);
await this.orderHistoryLink.click();
await this.page.waitForTimeout(1000);
await this.page.waitForTimeout(4000);
await new Promise((f) => setTimeout(f, timeout * 1000));
const currentUrl = this.page.url();
console.log(`FE opened at: ${currentUrl}`);
Comment on lines +71 to 74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider addressing potential timing issues instead of increasing wait time

The timeout increase from 1000ms to 4000ms could be masking underlying timing issues. Additionally, there are multiple sequential waits that could be consolidated.

Consider these improvements:

  1. Use Playwright's built-in wait mechanisms instead of arbitrary timeouts:
-    await this.page.waitForTimeout(4000);
-    await new Promise((f) => setTimeout(f, timeout * 1000));
+    await this.page.waitForURL(/.*\/history/, { timeout: timeout * 1000 });
  1. If the increased timeout is needed due to flakiness, add a comment explaining why 4000ms is required

Committable suggestion skipped: line range outside the PR's diff.

Expand Down