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

stage -> master #3892

Merged
merged 5 commits into from
Oct 15, 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
30 changes: 17 additions & 13 deletions .github/await_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

def wait_for_deployment(timeout):
branch_name = os.getenv('BRANCH_NAME')
print(f"Wait for a deployment for a branch name: {branch_name}")
time.sleep(30)
print(f"Wait for a deployment for a branch name: {branch_name} to start.")
time.sleep(20)
bearer_token = os.getenv('VERCEL_TOKEN')
project_id = os.getenv('VERCEL_PROJECT')
target = os.getenv('VERCEL_TARGET', 'preview')
Expand All @@ -16,22 +16,26 @@ def wait_for_deployment(timeout):
url = f"https://api.vercel.com/v6/deployments?projectId={project_id}&target={target}&state=BUILDING"
response = requests.get(url, headers=headers)
deployments = response.json()['deployments']
print(f"Found {len(deployments)} deployments.")
print(f"Found {len(deployments)} deployments in BUILDING state.")

if len(deployments) == 0:
raise Exception(f"No Vercel deployments in state=BUILDING for {branch_name}!")
vercel_uid = ""
vercel_url = ""
for deployment in deployments:
if deployment['meta']['githubCommitRef'] == branch_name:
vercel_uid = deployment['uid']
vercel_url = deployment['url']
# Check for the latest deployment
url = f"https://api.vercel.com/v6/deployments?projectId={project_id}&target={target}&limit=1"
response = requests.get(url, headers=headers)
deployments = response.json()['deployments']
if len(deployments) == 0:
raise Exception(f"No Vercel deployments found for {branch_name}!")
print("No deployments in BUILDING state. Using the latest deployment.")

vercel_uid = deployments[0]['uid']
vercel_url = deployments[0]['url']
gh_out = f"environment_url={vercel_url}"
os.system(f'echo "{gh_out}" >> $GITHUB_OUTPUT')
os.system(f'echo "{gh_out}" >> $GITHUB_ENV')
os.system(f'echo Vercel deployment: "{gh_out}" >> $GITHUB_STEP_SUMMARY')
for i in range(1, timeout):
print(f"Sleep for 15 seconds and get deployment uid {vercel_uid} and url: {vercel_url}")
time.sleep(15)
print(f"Sleep for 20 seconds and get deployment uid {vercel_uid} and url: {vercel_url}")
time.sleep(20)
current_url = f"https://api.vercel.com/v13/deployments/{vercel_uid}"
ui_url = f"https://vercel.com/osmo-labs/osmosis-frontend/{vercel_uid}"
current_response = requests.get(current_url, headers=headers)
Expand All @@ -45,4 +49,4 @@ def wait_for_deployment(timeout):
return f"environment_url={vercel_url}"


wait_for_deployment(80)
wait_for_deployment(30)
1 change: 0 additions & 1 deletion .github/workflows/frontend-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
VERCEL_PROJECT: ${{ secrets.VERCEL_PROJECT }}
run: |
echo "$BRANCH_NAME"
python -m pip install requests
cd .github && python await_deployment.py
- name: Echo GITHUB_OUTPUT environment_url
env:
Expand Down
67 changes: 10 additions & 57 deletions .github/workflows/monitoring-limit-geo-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,6 @@ jobs:
with:
name: eu-trade-test-results
path: packages/web/playwright-report
- name: Send Slack alert if test fails
id: slack
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 Synthetic EU Prod Trade Monitoring Tests Failure Alert 🚨"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Click here to view the run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub Actions Run>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SERVER_E2E_TESTS_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

fe-trade-sg-tests:
timeout-minutes: 12
Expand Down Expand Up @@ -112,33 +85,6 @@ jobs:
with:
name: sg-trade-test-results
path: packages/web/playwright-report
- name: Send Slack alert if test fails
id: slack
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 Synthetic SG Prod Trade Monitoring Tests Failure Alert 🚨"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Click here to view the run: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GitHub Actions Run>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SERVER_E2E_TESTS_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

fe-trade-us-tests:
timeout-minutes: 10
Expand All @@ -162,6 +108,7 @@ jobs:
run: |
yarn --cwd packages/web install --frozen-lockfile && npx playwright install --with-deps chromium
- name: Run Swap tests in US
id: run-us
env:
BASE_URL: "https://app.osmosis.zone"
PRIVATE_KEY: ${{ secrets.TEST_PRIVATE_KEY_3 }}
Expand All @@ -175,9 +122,14 @@ jobs:
with:
name: us-trade-test-results
path: packages/web/playwright-report

fe-bot-alert:
runs-on: ubuntu-latest
needs: [fe-trade-eu-tests, fe-trade-us-tests, fe-trade-sg-tests]
if: failure()
steps:
- name: Send Slack alert if test fails
id: slack
if: failure()
uses: slackapi/[email protected]
with:
payload: |
Expand All @@ -187,7 +139,7 @@ jobs:
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 Synthetic US Prod Trade Monitoring Tests Failure Alert 🚨"
"text": "🚨 Synthetic Prod Trade Monitoring Tests Failure Alert 🚨"
}
},
{
Expand All @@ -206,7 +158,8 @@ jobs:
delete-deployments:
runs-on: ubuntu-latest
if: always()
needs: [fe-trade-eu-tests, fe-trade-us-tests, fe-trade-sg-tests]
needs:
[fe-trade-eu-tests, fe-trade-us-tests, fe-trade-sg-tests, fe-bot-alert]
steps:
- name: Delete Previous deployments
uses: actions/github-script@v7
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/prod-frontend-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
VERCEL_TARGET: "production"
run: |
echo "$BRANCH_NAME"
python -m pip install requests
cd .github && python await_deployment.py
- name: Echo GITHUB_OUTPUT environment_url
env:
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface BridgeProviderContext {
chainId?: string;
destinationAddress?: string;
}): Promise<{
revisionNumber: string | undefined;
revisionNumber?: string;
revisionHeight: string;
}>;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/get-timeout-height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function getTimeoutHeight({
* Omit the revision_number if the chain's version is 0.
* Sending the value as 0 will cause the transaction to fail.
*/
revisionNumber: revisionNumber !== "0" ? revisionNumber : undefined,
...(revisionNumber !== "0" && { revisionNumber }),
revisionHeight: new Int(latestBlockHeight).add(new Int("150")).toString(),
};
}
19 changes: 11 additions & 8 deletions packages/stores/src/account/amino-converters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AminoMsgTransfer } from "@cosmjs/stargate";
import { MsgTransferAmino } from "@osmosis-labs/proto-codecs/build/codegen/ibc/applications/transfer/v1/tx";
import {
MsgBeginUnlocking,
MsgBeginUnlockingAmino,
Expand Down Expand Up @@ -79,7 +79,7 @@ export async function getAminoConverters() {
sender,
receiver,
timeoutHeight,
}: MsgTransfer) => ({
}: MsgTransfer): MsgTransferAmino => ({
source_port: sourcePort,
source_channel: sourceChannel,
token: {
Expand All @@ -91,7 +91,10 @@ export async function getAminoConverters() {
timeout_height: timeoutHeight
? {
revision_height: timeoutHeight.revisionHeight?.toString(),
revision_number: timeoutHeight.revisionNumber?.toString(),
revision_number:
timeoutHeight.revisionNumber?.toString() !== "0"
? timeoutHeight.revisionNumber?.toString()
: undefined,
}
: {},
}),
Expand All @@ -103,16 +106,16 @@ export async function getAminoConverters() {
receiver,
timeout_height,
timeout_timestamp,
}: AminoMsgTransfer["value"]): MsgTransfer => {
}: MsgTransferAmino): MsgTransfer => {
return {
sourcePort: source_port,
sourceChannel: source_channel,
sourcePort: source_port ?? "",
sourceChannel: source_channel ?? "",
token: {
denom: token?.denom ?? "",
amount: token?.amount ?? "",
},
sender,
receiver,
sender: sender ?? "",
receiver: receiver ?? "",
timeoutHeight: timeout_height
? {
revisionHeight: Long.fromString(
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/complex/portfolio/cypher-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const CypherCard = () => {
const { t } = useTranslation();
return (
<Link
href="https://osmosis.cyphercard.io"
href="https://pay.osmosis.zone?ref=osmosis"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
23 changes: 13 additions & 10 deletions packages/web/e2e/pages/trade-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export class TradePage extends BasePage {
async enterAmount(amount: string) {
// Just enter an amount for the swap and wait for a quote
await this.inputAmount.fill(amount, { timeout: 2000 });
await this.page.waitForTimeout(2000);
await expect(this.inputAmount).toHaveValue(amount, { timeout: 3000 });
await this.page.waitForTimeout(1000);
await expect(this.inputAmount).toHaveValue(amount, { timeout: 1000 });
const exchangeRate = await this.getExchangeRate();
console.log(`Swap ${amount} with rate: ${exchangeRate}`);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ export class TradePage extends BasePage {
async getTransactionUrl() {
const trxUrl = await this.trxLink.getAttribute("href");
console.log(`Trx url: ${trxUrl}`);
await this.page.waitForTimeout(4000);
await this.page.reload();
return trxUrl;
}

Expand All @@ -247,15 +247,22 @@ export class TradePage extends BasePage {
return await issufBalanceBtn.isVisible({ timeout: 2000 });
}

async isSufficientBalanceForTrade() {
// Make sure to have sufficient balance for a trade
expect(
await this.isInsufficientBalance(),
"Insufficient balance for the swap!"
).toBeFalsy();
}

async isError() {
const errorBtn = this.page.locator('//button[.="Error"]');
return await errorBtn.isVisible({ timeout: 2000 });
}

async showSwapInfo() {
const swapInfo = this.page.locator("//button//span[.='Show details']");
await swapInfo.click();
console.log(`Price Impact: ${await this.getPriceInpact()}`);
await swapInfo.click({ timeout: 2000 });
}

async getPriceInpact() {
Expand Down Expand Up @@ -320,11 +327,7 @@ export class TradePage extends BasePage {
}

async sellAndGetWalletMsg(context: BrowserContext, limit = false) {
// Make sure to have sufficient balance and swap button is enabled
expect(
await this.isInsufficientBalance(),
"Insufficient balance for the swap!"
).toBeFalsy();
// Make sure Sell button is enabled
await expect(this.sellBtn, "Sell button is disabled!").toBeEnabled({
timeout: 7000,
});
Expand Down
43 changes: 28 additions & 15 deletions packages/web/e2e/tests/monitoring.wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ test.describe("Test Filled Limit Order feature", () => {
await tradePage.goto();
await tradePage.openBuyTab();
await tradePage.selectAsset(name);
await tradePage.enterAmount("0.25");
await tradePage.enterAmount("0.52");
const { msgContentAmount } = await tradePage.buyAndGetWalletMsg(context);
expect(msgContentAmount).toBeTruthy();
expect(msgContentAmount).toContain("type: osmosis/poolmanager/");
Expand All @@ -104,19 +104,32 @@ test.describe("Test Filled Limit Order feature", () => {
});
});

// does not work for WBTC.eth.axl https://linear.app/osmosis/issue/FE-1058
// biome-ignore lint/complexity/noForEach: <explanation>
[{ name: "WBTC" }, { name: "OSMO" }].forEach(({ name }) => {
test(`User should be able to Market Sell ${name}`, async () => {
await tradePage.goto();
await tradePage.openSellTab();
await tradePage.selectAsset(name);
await tradePage.enterAmount("0.24");
const { msgContentAmount } = await tradePage.sellAndGetWalletMsg(context);
expect(msgContentAmount).toBeTruthy();
expect(msgContentAmount).toContain("type: osmosis/poolmanager/");
await tradePage.isTransactionSuccesful(TRX_SUCCESS_TIMEOUT);
await tradePage.getTransactionUrl();
});
// unwrapped market sell tests just in case this affects anything.
test("User should be able to Market Sell WBTC", async () => {
await tradePage.goto();
await tradePage.openSellTab();
await tradePage.selectAsset("WBTC");
await tradePage.enterAmount("0.51");
await tradePage.isSufficientBalanceForTrade();
await tradePage.showSwapInfo();
const { msgContentAmount } = await tradePage.sellAndGetWalletMsg(context);
expect(msgContentAmount).toBeTruthy();
expect(msgContentAmount).toContain("type: osmosis/poolmanager/");
await tradePage.isTransactionSuccesful(TRX_SUCCESS_TIMEOUT);
await tradePage.getTransactionUrl();
});

test("User should be able to Market Sell OSMO", async () => {
await tradePage.goto();
await tradePage.openSellTab();
await tradePage.selectAsset("OSMO");
await tradePage.enterAmount("0.51");
await tradePage.isSufficientBalanceForTrade();
await tradePage.showSwapInfo();
const { msgContentAmount } = await tradePage.sellAndGetWalletMsg(context);
expect(msgContentAmount).toBeTruthy();
expect(msgContentAmount).toContain("type: osmosis/poolmanager/");
await tradePage.isTransactionSuccesful(TRX_SUCCESS_TIMEOUT);
await tradePage.getTransactionUrl();
});
});
Loading
Loading