Skip to content

Commit 39a938d

Browse files
committed
updates for e2e
1 parent ee3965b commit 39a938d

File tree

12 files changed

+132
-82
lines changed

12 files changed

+132
-82
lines changed

tests/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
API_URL=http://127.0.0.1:5544/api
1+
API_URL=http://127.0.0.1:5541/api
22
RI_TEST=true
33
OSS_SENTINEL_PASSWORD=password
44
RI_APP_FOLDER_NAME=.redis-insight-vsc-stage

tests/e2e/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"name": "redis-insight-vsc-plugin",
3+
"version": "0.0.1",
4+
"description": "End-to-end tests",
25
"scripts": {
36
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
47
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx",
@@ -38,7 +41,7 @@
3841
"ts-node": "10.9.1",
3942
"tsc-alias": "^1.8.8",
4043
"typescript": "^5.1.3",
41-
"vscode-extension-tester": "^8.3.1"
44+
"vscode-extension-tester": "^8.5.0"
4245
},
4346
"dependencies": {
4447
"clone-deep": "^4.0.1",

tests/e2e/src/helpers/common-actions/TreeViewActions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export class TreeViewActions extends CommonDriverExtension {
6868
delimiter,
6969
)
7070
const node = treeView.getFolderSelectorByName(nodeName)
71-
const nodeElement = await treeView.getElement(node)
72-
const fullTestIdSelector = await nodeElement.getAttribute('data-testid')
71+
const fullTestIdSelector = await treeView.getElementAttribute(node, 'data-testid')
7372
if (!fullTestIdSelector?.includes('expanded')) {
7473
await ButtonActions.clickElement(node)
7574
}

tests/e2e/src/helpers/common-actions/actions/CommonElementActions.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Locator, VSBrowser, WebDriver } from 'vscode-extension-tester'
1+
import { Locator, until, VSBrowser, WebDriver } from 'vscode-extension-tester'
22

33
export class CommonElementActions{
44

@@ -10,12 +10,17 @@ export class CommonElementActions{
1010
}
1111

1212
/**
13-
* verify that view has all expected links
13+
* Verify that view has all expected links
1414
* @param expectedLinks expected links
1515
* @param linksLocator locator of the links
16+
* @param timeout timeout to wait for element
1617
*/
17-
static async verifyConnectLinks(expectedLinks: string[], linksLocator: Locator): Promise<Boolean> {
18+
static async verifyConnectLinks(expectedLinks: string[], linksLocator: Locator, timeout: number = 3000): Promise<Boolean> {
1819
CommonElementActions.initializeDriver()
20+
await CommonElementActions.driver.wait(
21+
until.elementsLocated(linksLocator),
22+
timeout,
23+
)
1924
const links = await CommonElementActions.driver.findElements(linksLocator)
2025

2126
const results = await Promise.all(links.map(async (link) => {

tests/e2e/src/page-objects/components/BaseComponent.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ export class BaseComponent extends WebElement {
111111
return await (await this.getElement(locator)).getText()
112112
}
113113

114+
/**
115+
* Get attribute from element
116+
* @param locator locator to check
117+
* @param attribute attribute to get
118+
* @returns Promise resolving to element text
119+
*/
120+
async getElementAttribute(locator: Locator, attribute: string): Promise<string> {
121+
return await (await this.getElement(locator)).getAttribute(attribute)
122+
}
123+
114124
/**
115125
* Wait for the element to be visible or not visible
116126
* @param locator Webdriver locator to search by

tests/e2e/src/page-objects/components/editor-view/SortedSetKeyDetailsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class SortedSetKeyDetailsView extends DoubleColumnKeyDetailsView {
1212
`//*[contains(@data-testid, 'zset-member-value-')]`,
1313
)
1414
truncatedValue = By.xpath(
15-
`//*[contains(@data-testid, 'zset-member-value-')]//*[@class = 'truncate']`,
15+
`//*[contains(@data-testid, 'zset-member-value-')]//*[contains(@aria-describedby, 'popup')]`,
1616
)
1717
scoreSortedSetFieldsList = By.xpath(
1818
`//*[contains(@data-testid, 'zset-score-value-')]`,

tests/e2e/src/tests/browser/set-key.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ describe('Set Key fields verification', () => {
112112

113113
expect(
114114
await addSetKeyView.isElementDisabled(addSetKeyView.addButton, 'class'),
115-
).eql(true, 'add button is not disabled if name in not entered')
115+
).eql(true, 'add button is not disabled if name is not entered')
116116

117117
await InputActions.typeText(addSetKeyView.keyNameInput, keyName)
118118

119119
expect(
120120
await addSetKeyView.isElementDisabled(addSetKeyView.addButton, 'class'),
121-
).eql(false, 'add button is disabled if name in entered')
121+
).eql(false, 'add button is disabled if name is entered')
122122
})
123123
})

tests/e2e/src/tests/database/edit-db.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ describe('Edit Databases', () => {
3636

3737
it('Verify that user can edit DB alias of Standalone DB', async function () {
3838
// Verify that timeout input is displayed for edit db window with default value when it wasn't specified
39-
const timeoutValue = await (
40-
await editDatabaseView.getElement(editDatabaseView.timeoutInput)
41-
).getAttribute('value')
39+
const timeoutValue = await editDatabaseView.getElementAttribute(editDatabaseView.timeoutInput, 'value')
4240
expect(timeoutValue).eql('30', 'Timeout is not defaulted to 30')
4341

4442
await InputActions.typeText(editDatabaseView.aliasInput, newDatabaseName)
@@ -60,16 +58,16 @@ describe('Edit Databases', () => {
6058

6159
it('Verify that user can edit Standalone DB', async function () {
6260
const connectionTimeout = '20'
63-
const caCertFieldValue = await editDatabaseView.getElementText(
64-
editDatabaseView.caCertField,
61+
const caCertFieldValue = await editDatabaseView.getElementAttribute(
62+
editDatabaseView.caCertField, 'current-value'
6563
)
66-
const clientCertFieldValue = await editDatabaseView.getElementText(
67-
editDatabaseView.clientCertField,
64+
const clientCertFieldValue = await editDatabaseView.getElementAttribute(
65+
editDatabaseView.clientCertField, 'current-value'
6866
)
6967

70-
expect(caCertFieldValue).contains('ca', 'CA certificate is incorrect')
71-
expect(clientCertFieldValue).contains(
72-
'client',
68+
expect(caCertFieldValue).not.contains('NO_CA_CERT', 'CA certificate is incorrect')
69+
expect(clientCertFieldValue).not.contains(
70+
'ADD_NEW',
7371
'Client certificate is incorrect',
7472
)
7573

tests/e2e/src/tests/setup.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Agreements Verification', () => {
3636

3737
await ServerActions.waitForServerInitialized()
3838
await browser.waitForWorkbench(20_000)
39-
await new TitleBar().getWindowControls().maximize()
39+
await new TitleBar().getWindowControls().maximize()
4040
await (await new ActivityBar().getViewControl('Redis Insight'))?.openView()
4141
})
4242
beforeEach(async () => {
@@ -133,7 +133,10 @@ describe('Agreements Verification', () => {
133133
})
134134

135135
it('Verify that user can accept User Agreements', async () => {
136-
const expectedWelcomeLinks = ['https://redis.io/docs/install/install-stack/docker/?utm_source=redisinsight&utm_medium=main&utm_campaign=docker']
136+
const expectedWelcomeLinks = [
137+
'https://redis.io/docs/latest/develop/connect/insight/?utm_source=redisinsight&utm_medium=vscode&utm_campaign=empty_database',
138+
'https://hub.docker.com/r/redis/redis-stack-server',
139+
]
137140
await CheckboxActions.toggleCheckbox(eulaView.useRecommendedCheckbox, true)
138141
await CheckboxActions.toggleCheckbox(eulaView.eulaCheckbox, true)
139142
await ButtonActions.clickElement(eulaView.submitButton)
@@ -145,10 +148,14 @@ describe('Agreements Verification', () => {
145148
// Verify that user is able to add database after accepting EULA
146149
await eulaView.switchBack()
147150

148-
// Verify that user can see Welcome page with connect links
151+
// Verify that user can see Welcome page with connect links
149152
await eulaView.switchToInnerViewFrame(InnerViews.WelcomeInnerView)
150-
expect(await CommonElementActions.verifyConnectLinks(expectedWelcomeLinks, welcomeView.connectLinks)).eql(true,
151-
'Links are not expected on the Welcome page ')
153+
expect(
154+
await CommonElementActions.verifyConnectLinks(
155+
expectedWelcomeLinks,
156+
welcomeView.connectLinks,
157+
),
158+
).eql(true, 'Links are not expected on the Welcome page ')
152159
await welcomeView.switchBack()
153160

154161
expect(await treeView.isElementDisplayed(treeView.addDatabaseBtn)).eql(

tests/e2e/src/tests/tree-view/empty-db-list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Empty database', () => {
3131
})
3232

3333
it('Verify that form to add database can be opened from empty db page', async function () {
34-
const expectedWelcomeLinks = ['https://redis.io/docs/install/install-stack/docker/?utm_source=redisinsight&utm_medium=main&utm_campaign=docker']
34+
const expectedWelcomeLinks = ['https://redis.io/docs/latest/develop/connect/insight/?utm_source=redisinsight&utm_medium=vscode&utm_campaign=empty_database', 'https://hub.docker.com/r/redis/redis-stack-server']
3535

3636
await ButtonActions.clickElement(emptyView.connectDatabaseButton)
3737

0 commit comments

Comments
 (0)