Skip to content

Commit 31df69e

Browse files
authored
feat: adapt tests for replacing Editor with VS Code Extension (#43)
* feat(remove-editor): adapt tests for replacing Editor with VS Code Extension - Add VS Code Extension button to portal headers and upload dialogs - Introduce tooltips and click actions for VS Code Extension button - Update tests to verify VS Code Extension functionality and tooltips * test(remove-editor): update tests for the VS Code Extension button * test(remove-editor): remove SSO Log in button * test(remove-editor): remove VS_CODE_EXTENSION_URL
1 parent 0662f0e commit 31df69e

File tree

7 files changed

+38
-6
lines changed

7 files changed

+38
-6
lines changed

src/packages/portal/pages/PortalPage/BaseVersionPage/MethodsForUploadDialog.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class MethodsForUploadDialog extends BaseCancelDialog {
66

77
readonly toPortalBtn = new Button(this.rootLocator.getByTestId('ToPortalButton'), 'Create a new version in the Portal')
88
readonly toAgentBtn = new Button(this.rootLocator.getByTestId('ToAgentButton'), 'Go to the Agent')
9+
readonly toVsCodeExtensionBtn = new Button(this.rootLocator.getByTestId('ToVsCodeExtensionButton'), 'Use APIHUB VS Code Extension')
910
readonly gotItBtn = new Button(this.rootLocator.getByTestId('GotItButton'), 'Got it')
1011

1112
constructor(page: Page) {

src/packages/shared/components/custom/headers/MainPageHeader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Page } from '@playwright/test'
2-
import { Avatar, Button } from '@shared/components/base'
2+
import { Avatar, BaseComponent, Button } from '@shared/components/base'
33
import { SystemInfoPopup } from '../popups/SystemInfoPopup'
44
import { MainUserMenu } from '../menus/MainUserMenu'
55

@@ -8,6 +8,8 @@ export class MainPageHeader {
88
private readonly rootLocator = this.page.getByTestId('AppHeader')
99
readonly portalBtn = new Button(this.rootLocator.getByTestId('PortalHeaderButton'), 'Portal')
1010
readonly agentBtn = new Button(this.rootLocator.getByTestId('AgentHeaderButton'), 'Agent')
11+
readonly vsCodeExtensionBtn = new Button(this.rootLocator.getByTestId('VsCodeExtensionButton'), 'VS Code Extension')
12+
readonly appHeaderDivider = new BaseComponent(this.rootLocator.getByTestId('AppHeaderDivider'), 'App Header', 'divider')
1113
readonly globalSearchBtn = new Button(this.rootLocator.getByTestId('GlobalSearchButton'), 'Global Search')
1214
readonly sysInfoBtn = new Button(this.rootLocator.getByTestId('SystemInfoButton'), 'System information')
1315
readonly userAvatar = new Avatar(this.rootLocator.getByTestId('AppUserAvatar'), 'User')

src/packages/shared/pages/LoginPage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export class LoginPage extends BasePage {
99
readonly loginTxtFld = new TextField(this.page.getByTestId('LoginTextInput'), 'Login')
1010
readonly passwordTxtFld = new TextField(this.page.getByTestId('PasswordTextInput'), 'Password')
1111
readonly signInBtn = new Button(this.page.getByTestId('SignInButton'), 'Log in')
12-
readonly ssoSignInBtn = new Button(this.page.getByTestId('SSOSignInButton'), 'SSO Log in')
1312
readonly errorAlert = this.page.getByRole('alert')
1413
readonly errorIcon = this.page.getByTestId('ErrorOutlineIcon')
1514

src/test-data/portal/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const CONFIG_PKG_VERSION_TOOLTIP = 'Drag and drop files onto the page or click Browse Files button'
22
export const CONFIG_PKG_RESTORE_FILE_TOOLTIP = 'This file has replaced one with the same name.You can restore previous file in place of the new one by clicking Restore icon.'
3+
export const VS_CODE_EXTENSION_TOOLTIP = 'Open APIHUB VS Code Extension on Visual Studio Marketplace'
34

45
export const RELEASE_PATTERN_MSG = 'Release version must match the following regular expression:'
56

src/test-data/portal/other.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ export const REV_METADATA = {
33
repositoryUrl: 'https://git.metagit.com/repository.git',
44
}
55

6-
export const PORTAL_TEST_ZIP_PATH = 'resources/portal/zip/'
7-
86
export const RV_PATTERN_DEF = '^[0-9]{4}[.]{1}[1-4]{1}$'
97
export const RV_PATTERN_NEW = '^[0-9]{2}[.]{1}[A-z]{4}$'
108

src/tests/portal/01-general/1.2-general.spec.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { AgentPage } from '@agent/pages'
55
import { PortalPage } from '@portal/pages'
66
import { MIDDLE_EXPECT, TICKET_BASE_URL } from '@test-setup'
77
import { isDevProxyMode } from '@services/utils'
8+
import { VS_CODE_EXTENSION_TOOLTIP } from '@test-data/portal'
9+
import { SYSADMIN } from '@test-data'
810

911
test.describe('General', () => {
1012

11-
test('[P-GEN-1] Opening Portal page',
13+
test('[P-GEN-1.1] Opening Portal page',
1214
{
1315
tag: '@smoke',
1416
annotation: { type: 'Test Case', description: `${TICKET_BASE_URL}TestCase-A-4277` },
@@ -22,6 +24,8 @@ test.describe('General', () => {
2224
await expect(portalPage.header.userMenu).toBeVisible()
2325
await expect.soft(portalPage.header.portalBtn).toBeVisible()
2426
await expect.soft(portalPage.header.agentBtn).toBeVisible()
27+
await expect.soft(portalPage.header.vsCodeExtensionBtn).toBeVisible()
28+
await expect.soft(portalPage.header.appHeaderDivider).toBeVisible()
2529
await expect.soft(portalPage.header.globalSearchBtn).toBeVisible()
2630
await expect.soft(portalPage.header.sysInfoBtn).toBeVisible()
2731
await expect.soft(portalPage.header.userAvatar).toBeVisible()
@@ -31,7 +35,27 @@ test.describe('General', () => {
3135
await expect.soft(portalPage.sidebar.workspacesBtn).toBeVisible()
3236
})
3337

34-
test('[P-GEN-3] Navigation to the Agent page',
38+
test('[P-GEN-1.2] Check tooltips on the Portal page header',
39+
{
40+
annotation: { type: 'Test Case', description: `${TICKET_BASE_URL}TestCase-A-4277` },
41+
},
42+
async ({ sysadminPage: page }) => {
43+
44+
const portalPage = new PortalPage(page)
45+
46+
await portalPage.goto()
47+
await portalPage.header.vsCodeExtensionBtn.hover()
48+
49+
await expect(portalPage.tooltip).toHaveCount(1)
50+
await expect(portalPage.tooltip).toHaveText(VS_CODE_EXTENSION_TOOLTIP)
51+
52+
await portalPage.header.userAvatar.hover()
53+
54+
await expect(portalPage.tooltip).toHaveCount(1)
55+
await expect(portalPage.tooltip).toHaveText(SYSADMIN.name)
56+
})
57+
58+
test('[P-GEN-2] Navigation to the Agent page',
3559
{
3660
tag: '@smoke',
3761
annotation: { type: 'Test Case', description: `${TICKET_BASE_URL}TestCase-A-4279` },

src/tests/portal/04-entity-actions/4.3.2-package-editing-publishing.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ test.describe('4.3.2 Package publishing via Portal', () => {
6161
})
6262
}
6363

64+
await test.step('VS Code Extension option', async () => {
65+
await portalPage.gotoPackage(testPackage)
66+
await versionPage.howToUploadBtn.click()
67+
68+
await expect(methodsForUploadDialog.toVsCodeExtensionBtn).toBeVisible()
69+
})
70+
6471
await test.step('Got it', async () => {
6572
await portalPage.gotoPackage(testPackage)
6673
await versionPage.howToUploadBtn.click()

0 commit comments

Comments
 (0)