Skip to content

Commit 4fe09e1

Browse files
committed
add test scripts Trading token when connect wallet by Encrypted Key
1 parent 9efc90a commit 4fe09e1

7 files changed

Lines changed: 143 additions & 20 deletions

tests/ConnectWallets/ConnectByViewOnlyMode.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test.beforeAll('Launch browser context with permission', async () => {
1717

1818
})
1919

20-
test('Connect wallet by View Only Mode', async () => {
20+
test.skip('Connect wallet by View Only Mode', async () => {
2121
test.setTimeout(90_000)
2222
const homePage = new HomePage(page)
2323
await homePage.goToHomePage()

tests/ConnectWallets/ConnectKeplrWallet.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test.beforeAll('Add extension: Keplr', async () => {
4545
await page.bringToFront()
4646

4747
})
48-
test('Connect Keplr wallet', async () => {
48+
test.skip('Connect Keplr wallet', async () => {
4949
test.setTimeout(120_000)
5050
const homePage = new HomePage(page)
5151
await homePage.goToHomePage()

tests/ConnectWallets/ConnectMetaMaskWallet.spec.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.beforeAll('Add extension: MetaMask', async () => {
5050
})
5151

5252
test.describe.serial('Connect MetaMask wallet & Verify deposit', () => {
53-
test('Connect MetaMask wallet', async () => {
53+
test.skip('Connect MetaMask wallet', async () => {
5454
test.setTimeout(200_000)
5555
const homePage = new HomePage(page)
5656
await homePage.goToHomePage()
@@ -103,18 +103,7 @@ test.describe.serial('Connect MetaMask wallet & Verify deposit', () => {
103103

104104
})
105105

106-
test.skip('Verify that the validation form is presented when user performed deposit amount = 0', async () => {
107-
const depositPage = new DepositPage(page)
108-
await depositPage.depositBtn.click()
109-
await depositPage.myBrowerWallet.click()
110-
await depositPage.selectNetworkBtn.click()
111-
await depositPage.networkOption('Ethereum').click()
112-
await depositPage.amountTextbox.fill('0')
113-
await depositPage.metaMaskDepositBtn.click()
114-
await expect(depositPage.errorAmountMsg).toBeVisible()
115-
})
116-
117-
test('Verify that the withdraw can be executed with other wallets address', async () => {
106+
test.skip('Verify that the withdraw can be executed with other wallets address', async () => {
118107
const depositPage = new DepositPage(page)
119108
await depositPage.depositBtn.click()
120109
//await depositPage.myBrowerWallet.click()

tests/ConnectWallets/ConnectPhantomWallet.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { TradeTradePage } from '../../pages/TradeTradePage.page';
55
import { ConnectWalletPage } from '../../pages/ConnectWalletPage';
66
import { PhantomPage } from '../../pages/PhantomPage';
77
import { DepositPage } from '../../pages/DepositPage';
8-
import { WithdrawPage } from '../../pages/WithdrawPage';
98

109
let page: Page
1110
let browserContext: BrowserContext
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import { test, expect, Page, BrowserContext, chromium } from '@playwright/test'
2+
import { HomePage } from '../../pages/HomePage.page';
3+
import { TradeTradePage } from '../../pages/TradeTradePage.page';
4+
import { ConnectWalletPage } from '../../pages/ConnectWalletPage';
5+
import { EncryptedKeyPage } from '../../pages/EncryptedKeyPage';
6+
7+
let page: Page
8+
let browserContext: BrowserContext
9+
const encryptedLeapKey = "2SrrmLXhu2W3rX4jcELNY4GLoo6wGRVB2U7bG7uN58vokMEw8xugKW7ZdzMog2zmEGeqRx6EYfGfPEjeSGWPaebR6sECyX4Yfuo8rc1v773M3yowpKNRqJ3M5QoNbHQqCmqk59sYHVrJM8wqpZe5hvA2cak7M5oLMsLAs1rbBndsLw6fQ7FJUe3quawE8hts77aBv9RLSTRsHeLGuQcQxL15Ukgw2YxbvpGfYpheSGKDfdCJRjW9iZuw4AQwvLec9etS4a5WAZ6LkHC8kcovvaogUwyfHcKDf8w1Bz9pxZwniVvqDn6zaMF7bknJFjbPA69T7aJPQbeTqp9VEApN1r2nJYX3dCyqFJF6NcD2h2JJz"
10+
const passworld = 'Abc123456789'
11+
12+
test.beforeAll('Launch browser context with permission', async () => {
13+
const browser = await chromium.launch()
14+
browserContext = await browser.newContext({
15+
permissions: ['clipboard-read', 'clipboard-write']
16+
});
17+
page = await browserContext.newPage()
18+
19+
const homePage = new HomePage(page)
20+
await homePage.goToHomePage()
21+
expect(homePage.spotHistory).toBeTruthy();
22+
//await homePage.carbonTestnet.click();
23+
//await homePage.mantle.click()
24+
await page.waitForTimeout(10_000)
25+
26+
const tradePage = new TradeTradePage(page);
27+
await tradePage.headerConnectWallet.click();
28+
29+
const connectWalletPage = new ConnectWalletPage(page)
30+
await connectWalletPage.selectWallet.isVisible()
31+
32+
await connectWalletPage.encryptedKeyBtn.click({ delay: 2000 })
33+
const encryptedKeyPage = new EncryptedKeyPage(page)
34+
35+
await encryptedKeyPage.encryptedKeyTextbox.waitFor({ state: 'visible' })
36+
await encryptedKeyPage.encryptedKeyTextbox.click()
37+
await encryptedKeyPage.encryptedKeyTextbox.fill(encryptedLeapKey)
38+
await encryptedKeyPage.encryptedKeyTextbox.press('Tab')
39+
await encryptedKeyPage.passwordTextbox.fill(passworld)
40+
await encryptedKeyPage.passwordTextbox.press('Tab')
41+
await encryptedKeyPage.connectBtn.waitFor({ state: 'visible' })
42+
await encryptedKeyPage.connectBtn.click({ delay: 2000 })
43+
await encryptedKeyPage.connectBtn.waitFor({ state: 'detached' })
44+
45+
await homePage.addressDropBtn.waitFor({ state: 'visible' })
46+
47+
})
48+
49+
test.describe('Trading Token by Encrypted Key', () => {
50+
test('TC_DEMEX_TO_1: Place a buy order, verify appearance in order book', async () => {
51+
const homePage = new HomePage(page)
52+
await homePage.goToHomePage()
53+
await page.waitForLoadState()
54+
55+
const tradePage = new TradeTradePage(page)
56+
await tradePage.opTokenOption.click()
57+
await tradePage.spotTab.click()
58+
await tradePage.searchToken.fill('SWTH / USD')
59+
await tradePage.swthUSDOption.click()
60+
await tradePage.amountToken.fill('1000')
61+
await tradePage.buyBtn.click()
62+
await tradePage.confirmBtn.click()
63+
64+
await expect(tradePage.orderPlacedPopup).toBeVisible({ timeout: 10_000 })
65+
66+
const expectedTableData = [
67+
{
68+
'Market': 'SWTH / USD',
69+
'Type': 'Limit|Buy',
70+
'Filled': '0 SWTH$0.00',
71+
}
72+
]
73+
await tradePage.verifyTableData(expectedTableData)
74+
75+
})
76+
77+
test('TC_DEMEX_TO_4: Cancel an active order and confirm removal', async () => {
78+
await page.reload()
79+
await page.waitForLoadState()
80+
const tradePage = new TradeTradePage(page)
81+
await tradePage.cancelBtn.click()
82+
83+
await expect(tradePage.orderedCancelledPopup).toBeVisible({ timeout: 10_000 })
84+
})
85+
86+
test('TC_DEMEX_TO_2: Place a sell order, verify appearance in order book', async () => {
87+
await page.reload()
88+
await page.waitForLoadState()
89+
const tradePage = new TradeTradePage(page)
90+
await tradePage.amountToken.fill('1000')
91+
await tradePage.switchingBtn.click()
92+
await tradePage.sellBtn.click()
93+
await tradePage.confirmBtn.click()
94+
95+
await expect(tradePage.orderPlacedPopup).toBeVisible({ timeout: 10_000 })
96+
97+
const expectedTableData = [
98+
{
99+
'Market': 'SWTH / USD',
100+
'Type': 'Limit|Sell',
101+
'Filled': '0 SWTH$0.00',
102+
}
103+
]
104+
await tradePage.verifyTableData(expectedTableData)
105+
106+
await tradePage.cancelBtn.click()
107+
await expect(tradePage.orderedCancelledPopup).toBeVisible({ timeout: 10_000 })
108+
109+
})
110+
111+
test('TC_DEMEX_TO_3: Test limit and market orders for a range of assets', async () => {
112+
await page.reload()
113+
await page.waitForLoadState()
114+
const tradePage = new TradeTradePage(page)
115+
await tradePage.marketBtn.click()
116+
await tradePage.buyBtn.waitFor({ state: 'visible' })
117+
await tradePage.amountOnMarket.fill('1000')
118+
await tradePage.buyBtn.click()
119+
await tradePage.confirmBtn.click()
120+
121+
await expect(tradePage.tradeExecutedPopup).toBeVisible({ timeout: 10_000 })
122+
123+
})
124+
})
125+
126+
test.afterAll('Reset data', async () => {
127+
const homePage = new HomePage(page)
128+
await homePage.goToHomePage()
129+
await page.waitForLoadState()
130+
131+
const tradePage = new TradeTradePage(page)
132+
try {
133+
await tradePage.cancelAllBtn.click({ timeout: 10_000 })
134+
await tradePage.confirmBtn.click()
135+
await expect(tradePage.orderedCancelledPopup).toBeVisible({ timeout: 10_000 })
136+
} catch (e) { }
137+
138+
})

tests/TradingToken/TradingOnPhantom.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ import { HomePage } from '../../pages/HomePage.page';
44
import { TradeTradePage } from '../../pages/TradeTradePage.page';
55
import { ConnectWalletPage } from '../../pages/ConnectWalletPage';
66
import { PhantomPage } from '../../pages/PhantomPage';
7-
import { DepositPage } from '../../pages/DepositPage';
8-
import { WithdrawPage } from '../../pages/WithdrawPage';
97

108
let page: Page
119
let browserContext: BrowserContext
1210
const srpArr = ["doll", "injury", "material", "wise", "matrix", "pet", "debate", "asset", "forest", "online", "toss", "holiday"]
1311
const password = 'Abc123456789'
1412
const extensionName = "phantom"
15-
const leapSwthAddress = 'tswth1mw6zu5y7dxdhcrej4jqct95xxf7j5lgh6dyhfn'
1613

1714
test.beforeAll('Add extension: Phantom', async () => {
1815
test.setTimeout(90_000)

tests/WithdrawToken/WithdrawOnPhantom.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ test.describe(' Withdraw Token with Phantom wallet ', () => {
9696

9797
})
9898

99-
test('Verify that the withdraw can be executed with other wallets address', async () => {
99+
test('TC_WTD_MW_001: Verify that the withdraw can be executed with other wallets address', async () => {
100100
await page.reload()
101101
await page.waitForLoadState()
102102
const depositPage = new DepositPage(page)

0 commit comments

Comments
 (0)