Skip to content

Commit e70ef85

Browse files
Merge pull request #2157 from RedisInsight/e2e/fe/feature/RI-4541_subscribe_command_error_message
E2e/fe/feature/ri 4541 subscribe command error message
2 parents 3984feb + 0e01467 commit e70ef85

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

tests/e2e/pageObjects/components/bottom-panel/cli.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,14 @@ export class Cli {
160160

161161
await this.sendCommandsInCli(scripts);
162162
}
163+
164+
/**
165+
* Get warning message text by command
166+
* @param command command name
167+
*/
168+
async getWarningMessageText(command: string): Promise<string> {
169+
170+
const executedCommand = await this.cliCommandExecuted.withExactText(command);
171+
return await executedCommand.nextSibling(0).textContent;
172+
}
163173
}

tests/e2e/tests/critical-path/pub-sub/subscribe-unsubscribe.e2e.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { acceptLicenseTermsAndAddDatabaseApi, acceptLicenseTerms } from '../../../helpers/database';
2-
import { MyRedisDatabasePage, PubSubPage } from '../../../pageObjects';
2+
import { MyRedisDatabasePage, PubSubPage, WorkbenchPage } from '../../../pageObjects';
33
import { commonUrl, ossStandaloneConfig, ossStandaloneV5Config } from '../../../helpers/conf';
44
import { env, rte } from '../../../helpers/constants';
55
import { verifyMessageDisplayingInPubSub } from '../../../helpers/pub-sub';
66
import { addNewStandaloneDatabaseApi, deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
77

88
const myRedisDatabasePage = new MyRedisDatabasePage();
99
const pubSubPage = new PubSubPage();
10+
const workbenchPage = new WorkbenchPage();
1011

1112
fixture `Subscribe/Unsubscribe from a channel`
1213
.meta({ env: env.web, rte: rte.standalone, type: 'critical_path' })
@@ -90,17 +91,38 @@ test
9091
await verifyMessageDisplayingInPubSub('message', false);
9192
await t.expect(pubSubPage.totalMessagesCount.exists).notOk('Total counter is still displayed');
9293
});
93-
test('Verify that user can see a internal link to pubsub window under word “Pub/Sub” when he try to run PSUBSCRIBE command in CLI or Workbench', async t => {
94+
test('Verify that user can see a internal link to pubsub window under word “Pub/Sub” when he tries to run PSUBSCRIBE or SUBSCRIBE commands in CLI or Workbench', async t => {
95+
const commandFirst = 'PSUBSCRIBE';
96+
const commandSecond = 'SUBSCRIBE';
97+
9498
// Go to Browser Page
9599
await t.click(myRedisDatabasePage.NavigationPanel.browserButton);
96-
// Verify that user can see a custom message when he try to run PSUBSCRIBE command in CLI or Workbench: “Use Pub/Sub to see the messages published to all channels in your database”
97-
await pubSubPage.Cli.sendCommandInCli('PSUBSCRIBE');
100+
// Verify that user can see a custom message when he tries to run PSUBSCRIBE command in CLI or Workbench: “Use Pub/Sub to see the messages published to all channels in your database”
101+
await pubSubPage.Cli.sendCommandInCli(commandFirst);
98102
await t.click(pubSubPage.Cli.cliExpandButton);
99-
await t.expect(pubSubPage.Cli.cliWarningMessage.textContent).eql('Use Pub/Sub to see the messages published to all channels in your database.', 'Message is not displayed', { timeout: 10000 });
103+
await t.expect(await pubSubPage.Cli.getWarningMessageText(commandFirst)).eql('Use Pub/Sub to see the messages published to all channels in your database.', 'Message is not displayed', { timeout: 10000 });
104+
100105
// Verify internal link to pubsub page in CLI
101106
await t.expect(pubSubPage.Cli.cliLinkToPubSub.exists).ok('Link to pubsub page is not displayed');
102107
await t.click(pubSubPage.Cli.cliLinkToPubSub);
103108
await t.expect(pubSubPage.pubSubPageContainer.exists).ok('Pubsub page is opened');
109+
110+
// Verify that user can see a custom message when he tries to run SUBSCRIBE command in CLI: “Use Pub/Sub tool to subscribe to channels.”
111+
await t.click(pubSubPage.Cli.cliCollapseButton);
112+
await pubSubPage.Cli.sendCommandInCli(commandSecond);
113+
await t.click(pubSubPage.Cli.cliExpandButton);
114+
await t.expect(await pubSubPage.Cli.getWarningMessageText(commandSecond)).eql('Use Pub/Sub tool to subscribe to channels.', 'Message is not displayed', { timeout: 10000 });
115+
116+
// Verify internal link to pubsub page in CLI
117+
await t.expect(pubSubPage.Cli.cliLinkToPubSub.exists).ok('Link to pubsub page is not displayed');
118+
await t.click(pubSubPage.Cli.cliLinkToPubSub);
119+
await t.expect(pubSubPage.pubSubPageContainer.exists).ok('Pubsub page is opened');
120+
121+
// Verify that user can see a custom message when he tries to run SUBSCRIBE command in Workbench: “Use Pub/Sub tool to subscribe to channels.”
122+
await t.click(pubSubPage.NavigationPanel.workbenchButton);
123+
await workbenchPage.sendCommandInWorkbench(commandSecond);
124+
await t.expect(await workbenchPage.commandExecutionResult.textContent).eql('Use Pub/Sub tool to subscribe to channels.', 'Message is not displayed', { timeout: 10000 });
125+
104126
});
105127
test('Verify that the Message field input is preserved until user Publish a message', async t => {
106128
// Fill in Channel and Message inputs

0 commit comments

Comments
 (0)