Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/e2e/pageObjects/base-overview-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import { RedisOverviewPage } from '../helpers/constants';
import { Toast } from './components/common/toast';
import { ShortcutsPanel } from './components/shortcuts-panel';
import { EditorButton } from './components/common/editorButton';
import { NavigationHeader } from './components/navigation/navigation-header';
import { Modal } from './components/common/modal';

export class BaseOverviewPage {
ShortcutsPanel = new ShortcutsPanel();
Toast = new Toast();
EditorButton = new EditorButton();
NavigationHeader = new NavigationHeader();
Modal = new Modal();

notification = Selector('[data-testid^=-notification]');
deleteRowButton = Selector('[data-testid^=delete-instance-]');
Expand All @@ -21,6 +26,7 @@ export class BaseOverviewPage {

databasePageLink = Selector('[data-testid=home-tab-databases]');
rdiPageLink = Selector('[data-testid=home-tab-rdi-instances]');
exploreRedisBtn = Selector('[data-testid=explore-redis-btn]');

/**
* Reload page
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/pageObjects/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NavigationPanel } from './components/navigation-panel';
import { Toast } from './components/common/toast';
import { ShortcutsPanel } from './components/shortcuts-panel';
import { EditorButton } from './components/common/editorButton';
import { Modal } from './components/common/modal';

export class BasePage {
notification = Selector('[data-testid^=-notification]');
Expand All @@ -11,6 +12,7 @@ export class BasePage {
ShortcutsPanel = new ShortcutsPanel();
Toast = new Toast();
EditorButton = new EditorButton();
Modal = new Modal();

/**
* Reload page
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/pageObjects/browser-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export class BrowserPage extends InstancePage {
loadAllBtn = Selector('[data-testid=load-all-value-btn]');
downloadAllValueBtn = Selector('[data-testid=download-all-value-btn]');
openTutorialsBtn = Selector('[data-testid=explore-msg-btn]');
exploreRedisBtn = Selector('[data-testid=explore-redis-btn]');
//CONTAINERS
streamGroupsContainer = Selector('[data-testid=stream-groups-container]');
streamConsumersContainer = Selector('[data-testid=stream-consumers-container]');
Expand Down Expand Up @@ -266,7 +265,6 @@ export class BrowserPage extends InstancePage {
keyListItem = Selector('[role=rowgroup] [role=row]');
// Dialog
noReadySearchDialogTitle = Selector('[data-testid=welcome-page-title]');
closeDialogButton = Selector('[class*=euiModal__closeIcon]');

//Get Hash key field ttl value
//for Redis databases 7.4 and higher
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/pageObjects/components/common/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Selector } from 'testcafe';

export class Modal {
closeModalButton = Selector('[class*=euiModal__closeIcon]');
}
15 changes: 1 addition & 14 deletions tests/e2e/pageObjects/components/insights-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ExploreTab } from './explore-tab';
export class InsightsPanel {
// CONTAINERS
sidePanel = Selector('[data-testid=side-panels-insights]');
explorePanelButton = Selector('[data-testid=insights-trigger]');
closeButton = Selector('[data-testid=close-insights-btn]');
activeTab = Selector('[class*=euiTab-isSelected]');

Expand All @@ -18,24 +17,13 @@ export class InsightsPanel {

activeTabMask = '[class*=euiTab-isSelected]';

/**
* Open/Close Panel
* @param state State of panel
*/
async togglePanel(state: boolean): Promise<void> {
const isPanelExists = await this.sidePanel.exists;

if (state !== isPanelExists) {
await t.click(this.explorePanelButton);
}
}

/**
* get active tab
*/
async getActiveTabName(): Promise<string> {
return (this.sidePanel.find(this.activeTabMask)).textContent;
}

/**
* Click on Panel tab
* @param type of the tab
Expand Down Expand Up @@ -64,5 +52,4 @@ export class InsightsPanel {
getInsightsPanel(): Selector {
return Selector('[class=euiButton__text]').withExactText(ExploreTabs.Tips);
}

}
19 changes: 19 additions & 0 deletions tests/e2e/pageObjects/components/navigation/navigation-header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { t, Selector } from 'testcafe';
import { InsightsPanel } from '../insights-panel';

export class NavigationHeader {
insightsTriggerButton = Selector('[data-testid=insights-trigger]');
cloudSignInButton = Selector('[data-testid=cloud-sign-in-btn]');

/**
* Open/Close Panel
* @param state State of panel
*/
async togglePanel(state: boolean): Promise<void> {
const isPanelExists = await (new InsightsPanel()).sidePanel.exists;

if (state !== isPanelExists) {
await t.click(this.insightsTriggerButton);
}
}
}
2 changes: 0 additions & 2 deletions tests/e2e/pageObjects/components/rdi/rdi-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export class RdiHeader {
importInput = Selector('[data-testid=import-file-modal-filepicker]');
confirmUploadingPipelineBatton = Selector('[data-testid=submit-btn]');

cloudSignInButton = Selector('[data-testid=cloud-sign-in-btn]');

/**
* Import pipeline
* @param filePath the name if the file
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/pageObjects/dialogs/authorization-dialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Selector } from 'testcafe';

export class AuthorizationDialog {
//COMPONENTS
authDialog = Selector('[data-testid=social-oauth-dialog]');
//BUTTONS
googleAuth = Selector('[data-testid=google-oauth]');
gitHubAuth = Selector('[data-testid=github-oauth]');
ssoAuth = Selector('[data-testid=sso-oauth]');
}
2 changes: 1 addition & 1 deletion tests/e2e/pageObjects/dialogs/user-agreement-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class UserAgreementDialog {
/**
* Get state of Recommended switcher
*/
async getRecommendedSwitcherValue(): Promise<string> {
async getRecommendedSwitcherValue(): Promise<string | null> {
return await this.recommendedSwitcher.getAttribute('aria-checked');
}
}
2 changes: 2 additions & 0 deletions tests/e2e/pageObjects/instance-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { Profiler, Cli, CommandHelper } from './components/bottom-panel';
import { OverviewPanel } from './components/overview-panel';
import { InsightsPanel } from './components/insights-panel';
import { MonacoEditor } from './components/monaco-editor';
import { NavigationHeader } from './components/navigation/navigation-header';
export class InstancePage extends BasePage {
Profiler = new Profiler();
Cli = new Cli();
CommandHelper = new CommandHelper();
OverviewPanel = new OverviewPanel();
InsightsPanel = new InsightsPanel();
MonacoEditor = new MonacoEditor();
NavigationHeader = new NavigationHeader();
}
9 changes: 6 additions & 3 deletions tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { InsightsPanel } from './components/insights-panel';
import { CompatibilityPromotion } from './components/compatibility-promotion';
import { BaseOverviewPage } from './base-overview-page';
import { NavigationPanel } from './components/navigation-panel';
import { NavigationHeader } from './components/navigation/navigation-header';
import { AuthorizationDialog } from './dialogs/authorization-dialog';

const databaseAPIRequests = new DatabaseAPIRequests();

Expand All @@ -14,6 +16,8 @@ export class MyRedisDatabasePage extends BaseOverviewPage {
AddRedisDatabase = new AddRedisDatabase();
InsightsPanel = new InsightsPanel();
CompatibilityPromotion = new CompatibilityPromotion();
NavigationHeader = new NavigationHeader();
AuthorizationDialog = new AuthorizationDialog();

//-------------------------------------------------------------------------------------------
//DECLARATION OF SELECTORS
Expand All @@ -39,12 +43,10 @@ export class MyRedisDatabasePage extends BaseOverviewPage {
sortByLastConnection = Selector('span').withAttribute('title', 'Last connection');
importDatabasesBtn = Selector('[data-testid=import-from-file-btn]');
submitImportBtn = Selector('[data-testid=submit-btn]');
closeDialogBtn = Selector('[aria-label="Closes this modal window"]');
okDialogBtn = Selector('[data-testid=ok-btn]');
removeImportedFileBtn = Selector('[aria-label="Clear selected files"]');
exportBtn = Selector('[data-testid=export-btn]');
exportSelectedDbsBtn = Selector('[data-testid=export-selected-dbs]');
exploreRedisBtn = Selector('[data-testid=explore-redis-btn]');
userProfileBtn = Selector('[data-testid=user-profile-btn]');
addDbFromEmptyListBtn = Selector('[data-testid=empty-rdi-instance-button]');
emptyDbCloudBtn = Selector('[data-testid=empty-database-cloud-button]');
Expand Down Expand Up @@ -90,7 +92,8 @@ export class MyRedisDatabasePage extends BaseOverviewPage {
connectionTypeTitle = Selector('[data-test-subj=tableHeaderCell_connectionType_2]');
signInAgreement = Selector('[class="euiCheckbox__square"]');
googleAuth = Selector('[data-testid=google-oauth]');
authDialog = Selector('[data-testid=social-oauth-dialog]');
gitHubAuth = Selector('[data-testid=github-oauth]');
ssoAuth = Selector('[data-testid=sso-oauth]');

/**
* Click on the database by name
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/pageObjects/workbench-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export class WorkbenchPage extends InstancePage {
groupMode = Selector('[data-testid=btn-change-group-mode]');
copyCommand = Selector('[data-testid=copy-command]');
clearResultsBtn = Selector('[data-testid=clear-history-btn]');
exploreRedisBtn = Selector('[data-testid=no-results-explore-btn]');
//ICONS
noCommandHistoryIcon = Selector('[data-testid=wb_no-results__icon]');
parametersAnchor = Selector('[data-testid=parameters-anchor]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (fs.existsSync(workingDirectory)) {
await t.click(myRedisDatabasePage.NavigationPanel.workbenchButton);

// Check Enablement area and validate that removed file is existed in Guides
await workbenchPage.InsightsPanel.togglePanel(true);
await workbenchPage.NavigationHeader.togglePanel(true);
const tab = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
await t.click(tab.guidesGraphAccordion);
await t.click(tab.guidesIntroductionGraphLink.nth(1));
Expand Down
49 changes: 23 additions & 26 deletions tests/e2e/tests/electron/regression/database/cloud-sso.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
import { modifyFeaturesConfigJson, updateControlNumber } from '../../../../helpers/insights';
import { processGoogleSSO } from '../../../../helpers/google-authorization';
import { openChromeWithUrl, saveOpenedChromeTabUrl } from '../../../../helpers/scripts/browser-scripts';
import { RdiInstancePage } from '../../../../pageObjects/rdi-instance-page';

const myRedisDatabasePage = new MyRedisDatabasePage();
const databaseHelper = new DatabaseHelper();
const databaseAPIRequests = new DatabaseAPIRequests();
const rdiInstancePage = new RdiInstancePage();

let urlToUse = '';
const pathes = {
defaultRemote: path.join('.', 'test-data', 'features-configs', 'insights-default-remote.json'),
dockerConfig: path.join('.', 'test-data', 'features-configs', 'sso-docker-build.json'),
electronConfig: path.join('.', 'test-data', 'features-configs', 'sso-electron-build.json')
};

Expand All @@ -28,44 +25,44 @@ fixture `Cloud SSO`
.beforeEach(async() => {
await databaseAPIRequests.deleteAllDatabasesApi();
await databaseHelper.acceptLicenseTerms();
// Update remote config .json to config with buildType filter including current app build
await modifyFeaturesConfigJson(pathes.electronConfig);
await updateControlNumber(48.2);
})
.afterEach(async() => {
// await databaseAPIRequests.deleteAllDatabasesApi();
// await myRedisDatabasePage.reloadPage();
// // Update remote config .json to default
// await modifyFeaturesConfigJson(pathes.defaultRemote);
// // Clear features config table
// await DatabaseScripts.deleteRowsFromTableInDB({ tableName: 'features_config' });
await databaseAPIRequests.deleteAllDatabasesApi();
});
test('Verify that user can see SSO feature if it is enabled in feature config', async t => {
//TODO should be updated when AI or sth other will be added

// Update remote config .json to config with buildType filter excluding current app build
// await modifyFeaturesConfigJson(pathes.dockerConfig);
// await updateControlNumber(48.2);
// // Verify that user can't see SSO feature if it is disabled in feature config
// await t.expect(myRedisDatabasePage.promoButton.exists).notOk('promo Cloud database button displayed when SSO feature disabled');
await t.expect(myRedisDatabasePage.NavigationHeader.cloudSignInButton.exists).ok('Cloud Sign in button not displayed when SSO feature enabled');

// Update remote config .json to config with buildType filter including current app build
await modifyFeaturesConfigJson(pathes.electronConfig);
await updateControlNumber(48.2);
await t.expect(myRedisDatabasePage.promoButton.exists).ok('Import Cloud database button not displayed when SSO feature enabled');
// TODO fix once Sign in modal will be available to testcafe https://redislabs.atlassian.net/browse/RI-6048
// Open Cloud Sign in dialog
// await t.click(myRedisDatabasePage.promoButton);
// Verify that Cloud Sign in dialog has authorization buttons for Electron app
// await t.expect(myRedisDatabasePage.AuthorizationDialog.authDialog.exists).ok('Cloud Sigh in modal not opened');
// await t.expect(myRedisDatabasePage.AuthorizationDialog.googleAuth.exists).ok('Google auth button not displayed in Sigh in modal');
// await t.expect(myRedisDatabasePage.AuthorizationDialog.gitHubAuth.exists).ok('Github auth button not displayed in Sigh in modal');
// await t.expect(myRedisDatabasePage.AuthorizationDialog.ssoAuth.exists).ok('SSO auth button not displayed in Sigh in modal');
// await t.click(myRedisDatabasePage.Modal.closeModalButton);

await t.click(
myRedisDatabasePage.AddRedisDatabase.addDatabaseButton);
await t.click(
myRedisDatabasePage.AddRedisDatabase.addAutoDiscoverDatabase);
await t.click(myRedisDatabasePage.AddRedisDatabase.addDatabaseButton);
await t.click(myRedisDatabasePage.AddRedisDatabase.addAutoDiscoverDatabase);
// Verify that RE Cloud auto-discovery options Use Cloud Account and Use Cloud API Keys are displayed on Welcome screen
await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudAccount.exists).ok('Use Cloud Account accordion not displayed when SSO feature enabled');
await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudKeys.exists).ok('Use Cloud Keys accordion not displayed when SSO feature enabled');
await t.click(myRedisDatabasePage.AddRedisDatabase.useCloudAccount);
// Verify that Auth buttons are displayed for auto-discovery panel on Electron app
await t.expect(myRedisDatabasePage.googleAuth.exists).ok('Google auth button not displayed when SSO feature enabled');
await t.expect(myRedisDatabasePage.gitHubAuth.exists).ok('Github auth button not displayed when SSO feature enabled');
await t.expect(myRedisDatabasePage.ssoAuth.exists).ok('SSO auth button not displayed when SSO feature enabled');
});
// skip until adding linux support
test.skip('Verify that user can sign in using SSO via Google authorization', async t => {
const logsFilename = 'chrome_logs.txt';
const logsFilePath = path.join('test-data', logsFilename);

await t.expect(myRedisDatabasePage.promoButton.exists).ok('Import Cloud database button not displayed when SSO feature enabled');
await t.click(rdiInstancePage.RdiHeader.cloudSignInButton);
await t.click(myRedisDatabasePage.NavigationHeader.cloudSignInButton);
// Navigate to Google Auth button
await t.pressKey('tab');
await t.pressKey('tab');
Expand All @@ -82,7 +79,7 @@ test.skip('Verify that user can sign in using SSO via Google authorization', asy

urlToUse = fs.readFileSync(logsFilePath, 'utf8');
await processGoogleSSO(urlToUse);
await t.expect(rdiInstancePage.RdiHeader.cloudSignInButton.exists).notOk('Sign in button still displayed', { timeout: 10000 });
await t.expect(myRedisDatabasePage.NavigationHeader.cloudSignInButton.exists).notOk('Sign in button still displayed', { timeout: 10000 });
await myRedisDatabasePage.reloadPage();
await t.expect(myRedisDatabasePage.userProfileBtn.exists).ok('User profile button not displayed');
await t.click(myRedisDatabasePage.userProfileBtn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ test.skip('Verify that Insights panel can be displayed for Electron app accordin
// Update remote config .json to config with buildType filter excluding current app build
await modifyFeaturesConfigJson(pathes.dockerConfig);
await updateControlNumber(48.2);
await t.expect(browserPage.InsightsPanel.explorePanelButton.exists).notOk('Insights panel displayed when filter excludes this buildType');
await t.expect(browserPage.NavigationHeader.insightsTriggerButton.exists).notOk('Insights panel displayed when filter excludes this buildType');

// Update remote config .json to config with buildType filter including current app build
await modifyFeaturesConfigJson(pathes.electronConfig);
await updateControlNumber(48.2);
await t.expect(browserPage.InsightsPanel.explorePanelButton.exists).ok('Insights panel not displayed when filter includes this buildType');
await t.expect(browserPage.NavigationHeader.insightsTriggerButton.exists).ok('Insights panel not displayed when filter includes this buildType');
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fixture `Redis Stack command in Workbench`
//skipped due the inaccessibility of the iframe
test.skip('Verify that user can switches between Graph and Text for GRAPH command and see results corresponding to their views', async t => {
// Send Graph command
await workbenchPage.InsightsPanel.togglePanel(true);
await workbenchPage.NavigationHeader.togglePanel(true);
const tutorials = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
await t.click(tutorials.redisStackTutorialsButton);
await t.click(tutorials.tutorialsWorkingWithGraphLink);
Expand All @@ -45,7 +45,7 @@ test.skip('Verify that user can switches between Graph and Text for GRAPH comman
//skipped due to Graph no longer displayed in tutorials
test.skip('Verify that user can see "No data to visualize" message for Graph command', async t => {
// Send Graph command
await workbenchPage.InsightsPanel.togglePanel(true);
await workbenchPage.NavigationHeader.togglePanel(true);
const tutorials = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
await t.click(tutorials.redisStackTutorialsButton);
await tutorials.runBlockCode('Show all sales per region');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test
await t.expect(clusterDetailsPage.tableRow.nth(nodes.indexOf(node)).textContent).contains(node, `Node ${node} is not displayed in table`);
}
//Run Create hash index command to load network and memory
await clusterDetailsPage.InsightsPanel.togglePanel(true);
await clusterDetailsPage.NavigationHeader.togglePanel(true);
const tutorials = await clusterDetailsPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);

await t.click(tutorials.dataStructureAccordionTutorialButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ test
await t.expect(browserPage.OverviewPanel.overviewCommandsSec.exists).ok('Commands/Sec is dispalyed in the Overview');
await t.expect(browserPage.OverviewPanel.overviewCpu.exists).ok('CPU (%) is dispalyed in the Overview');
//Run Create hash index command
await browserPage.InsightsPanel.togglePanel(true);
await browserPage.NavigationHeader.togglePanel(true);
const tutorials = await browserPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
await t.click(tutorials.dataStructureAccordionTutorialButton);
await t.click(tutorials.internalLinkWorkingWithHashes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test.before(async() => {
.expect(myRedisDatabasePage.failedImportMessage.textContent).contains(parseFailedMsg2);

// Verify that user can remove file from import input
await t.click(myRedisDatabasePage.closeDialogBtn);
await t.click(myRedisDatabasePage.Modal.closeModalButton);
await t.click(myRedisDatabasePage.importDatabasesBtn);
await t.setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [rdmData.path]);
// Unskip after updating testcafe with opening links support https://redislabs.atlassian.net/browse/RI-5565
Expand Down
Loading