-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathnativeAuth.spec.ts
More file actions
78 lines (65 loc) · 2.54 KB
/
nativeAuth.spec.ts
File metadata and controls
78 lines (65 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { test, expect } from '@playwright/test';
import * as TestActions from '../support';
import { TestDataEnums, SelectorsEnum } from '../support/testdata';
import { extractBalanceFromContainer } from '../support';
const keystoreConfig = {
keystore: TestDataEnums.keystoreFilePath,
password: TestDataEnums.keystoreFilePassword
};
test.describe('Native auth', () => {
test.beforeEach(async ({ page }) => {
await TestActions.navigateToConnectWallet(page);
await TestActions.connectWebWallet({ page, loginMethod: keystoreConfig });
await TestActions.checkConnectionToWallet(
page,
TestDataEnums.keystoreWalletAddress
);
});
test('should display native auth container when clicked', async ({
page
}) => {
// Click LeftPanel - Native auth
await page.getByText('Native auth').first().click();
// Wait for the native auth container to be visible
await page
.locator(SelectorsEnum.nativeAuthContainer)
.waitFor({ state: 'visible' });
// Verify native auth container is visible and in viewport
const container = page.locator(SelectorsEnum.nativeAuthContainer);
await expect(container).toBeVisible();
await expect(container).toBeInViewport();
});
test('should display correct wallet address and balance in native auth', async ({
page
}) => {
// Get account balance before any actions
const accountBalance = await TestActions.extractBalanceFromContainer({
page,
containerSelector: SelectorsEnum.topInfoContainer,
selectorType: 'testId'
});
// Navigate to native auth page
await page.getByText('Native auth').first().click();
await page.waitForLoadState('networkidle');
await page
.locator(SelectorsEnum.nativeAuthContainer)
.waitFor({ state: 'visible' });
// Verify container is in viewport
const container = page.locator(SelectorsEnum.nativeAuthContainer);
await expect(container).toBeInViewport();
// Check that the address is displayed and matches the account address
const nativeAuthAddress = page
.locator(SelectorsEnum.nativeAuthContainer)
.getByTestId(SelectorsEnum.trimFullAddress);
await expect(nativeAuthAddress).toHaveText(
TestDataEnums.keystoreWalletAddress
);
// Check that the balance is displayed and matches the account balance
const nativeAuthBalance = await extractBalanceFromContainer({
page,
containerSelector: SelectorsEnum.nativeAuthContainer,
selectorType: 'locator'
});
await expect(nativeAuthBalance).toBe(accountBalance);
});
});