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: 3 additions & 3 deletions .github/workflows/trigger-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ "9.2.4", "9.1.10", "8.19.10", "7.17.29" ]
version: ["9.3.0", "9.2.5", "8.19.11", "7.17.29"]
env: [docker, eck-2.16.1, eck-3.1.0]
steps:
- name: Checkout code
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["9.2.0", "9.1.0", "9.0.0", "8.19.0", "8.18.0", "8.17.0", "8.16.0", "8.15.0", "8.14.0", "8.13.0", "8.12.0", "8.11.0", "8.10.1", "8.9.0", "8.8.0", "8.7.0", "8.6.0", "8.5.0", "8.4.0", "8.3.0", "8.2.0", "8.1.0", "8.0.0", "7.17.0", "7.16.0", "7.15.0", "7.14.0", "7.13.0", "7.12.0", "7.11.2", "7.10.0", "7.9.0"]
version: ["9.3.0", "9.2.0", "9.1.0", "9.0.0", "8.19.0", "8.18.0", "8.17.0", "8.16.0", "8.15.0", "8.14.0", "8.13.0", "8.12.0", "8.11.0", "8.10.1", "8.9.0", "8.8.0", "8.7.0", "8.6.0", "8.5.0", "8.4.0", "8.3.0", "8.2.0", "8.1.0", "8.0.0", "7.17.0", "7.16.0", "7.15.0", "7.14.0", "7.13.0", "7.12.0", "7.11.2", "7.10.0", "7.9.0"]
env: [docker, eck-3.1.0]
steps:
- name: Checkout code
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["9.2.4", "9.1.10", "8.19.10", "7.17.29"]
version: ["9.3.0", "9.2.5", "8.19.11", "7.17.29"]
env: [docker, eck-2.16.1, eck-3.1.0]
env:
ROR_ES_VERSION: "latest"
Expand Down
35 changes: 24 additions & 11 deletions e2e-tests/cypress/e2e/Discover.cy.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import semver from 'semver';
import { Login } from '../support/page-objects/Login';
import { Loader } from '../support/page-objects/Loader';
import { kbnApiClient } from '../support/helpers/KbnApiClient';
import { Home } from '../support/page-objects/Home';
import { KibanaNavigation } from '../support/page-objects/KibanaNavigation';
import { Discover } from '../support/page-objects/Discover';
import semver from 'semver/preload';
import { getKibanaVersion } from '../support/helpers';
import { esApiAdvancedClient } from '../support/helpers/EsApiAdvancedClient';
import { SearchSessions } from '../support/page-objects/SearchSessions';

const userCredentials = 'user4:dev';
const tenantIndex = '.kibana_admins_group';
const indexWithSearchSessions = semver.lt(getKibanaVersion(), '8.0.0')
? `${tenantIndex}_${getKibanaVersion()}_001`
: `${tenantIndex}_analytics_${getKibanaVersion()}_001`;

describe('Discover tests', () => {
afterEach(() => {
kbnApiClient.deleteSampleData('ecommerce', userCredentials);
esApiAdvancedClient.deleteIndex(indexWithSearchSessions);
});

it('should allow to see discover page when user has access only for specific indices', () => {
cy.visit(Cypress.config().baseUrl);
cy.on('url:changed', () => {
sessionStorage.setItem('ror:ignoreTrialInfo', 'true');
localStorage.setItem('home:welcome:show', 'false');
});

const [username, password] = userCredentials.split(':');

Login.fillLoginPageWith(username, password);
Loader.loading();
Login.initialization({ username, password });
Home.loadSampleData();
KibanaNavigation.openPage('Discover');
if (semver.lt(getKibanaVersion(), '9.0.0')) {
Expand All @@ -33,4 +31,19 @@ describe('Discover tests', () => {
Discover.verifyDocumentWithTodayRange(0, 'kibana_sample_data_ecommerce');
Discover.toastErrorNotVisible('Error fetching fields for data view');
});

// Search sessions feature is removed for version 9.0.0 and above
if (semver.lt(getKibanaVersion(), '9.0.0'))
it('should allow to save and open discover session', () => {
Login.initialization();
Home.loadSampleData();
KibanaNavigation.openPage('Discover');
Discover.openSaveSessionPanel();
Discover.pressSaveSessionButton();
Discover.pressManageSessionsButton();

SearchSessions.numberOfVisibleSearchSessions(1);
SearchSessions.openSelectedSearchSession(0);
Discover.verifyDiscoverFromSearchSessionCorrectlyRestored();
});
});
2 changes: 1 addition & 1 deletion e2e-tests/cypress/e2e/Impersonate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('impersonate', () => {

cy.log('should return data when the user has access to the license');
rorApiInternalKbnClient.getLicense({ failOnStatusCode: false, credentials: admin }).then(result => {
expect(result).to.contains({ iss: 'https://api.beshu.tech' });
expect(['https://api.beshu.tech', 'https://portal.readonlyrest.com']).to.include(result.iss);
});
});
});
1 change: 1 addition & 0 deletions e2e-tests/cypress/e2e/Index-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('Index management', () => {
IndexManagement.searchIndices(testIndexName);
IndexManagement.openIndex(testIndexName);
IndexManagement.selectDeleteActionFromContextMenu();

IndexManagement.clickConfirmDeleteIndexButton();
IndexManagement.verifyIndexExists(testIndexName);
});
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/cypress/e2e/Observability.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Observability', () => {
}
Observability.openApmInstance('app1');
Observability.waitForApmData();
Observability.getApmCustomTransaction('MyCustomTransaction').should('be.visible');
Observability.getApmError('Something went wrong!').should('be.visible');
Observability.getApmCustomTransaction('MyCustomTransaction').should('exist').scrollIntoView().should('exist');
Observability.getApmError('Something went wrong!').should('exist').scrollIntoView().should('exist');
});
});
4 changes: 2 additions & 2 deletions e2e-tests/cypress/e2e/Reporting.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (semver.gte(getKibanaVersion(), '8.15.0')) {
kbnApiAdvancedClient.deleteSavedObjects(`${username}:${password}`);
esApiAdvancedClient.pruneAllReportingIndices();
esApiClient.deleteIndex(oldFormatReportingIndex);
kbnApiClient.deleteSampleData('ecommerce', `${username}:${password}`);
kbnApiClient.deleteSampleData('ecommerce', userCredentials);
});

it(`should correctly display all reports from both the old reporting index and the new reporting data stream`, () => {
Expand Down Expand Up @@ -76,7 +76,7 @@ if (semver.gte(getKibanaVersion(), '8.15.0')) {
afterEach(() => {
kbnApiAdvancedClient.deleteSavedObjects(`${username}:${password}`);
esApiAdvancedClient.pruneAllReportingIndices();
kbnApiClient.deleteSampleData('ecommerce', `${username}:${password}`);
kbnApiClient.deleteSampleData('ecommerce', userCredentials);
});
describe(`Reporting tests for ${username}`, () => {
it('should correctly display all reporting data', () => {
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/cypress/fixtures/reportingSettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ helpers:

readonlyrest:
response_if_req_forbidden: Forbidden by ReadonlyREST ES plugin
prompt_for_basic_auth: false
audit:
enabled: true
outputs:
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests/cypress/fixtures/roSettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ helpers:

readonlyrest:
response_if_req_forbidden: Forbidden by ReadonlyREST ES plugin
prompt_for_basic_auth: false

audit:
enabled: true
outputs:
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/cypress/fixtures/roStrictSettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ helpers:

readonlyrest:
response_if_req_forbidden: Forbidden by ReadonlyREST ES plugin
prompt_for_basic_auth: false
audit:
enabled: true
outputs:
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests/cypress/fixtures/testSettings.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
readonlyrest:
prompt_for_basic_auth: false

audit:
enabled: true
outputs:
Expand Down
10 changes: 8 additions & 2 deletions e2e-tests/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@testing-library/cypress/add-commands';
import 'cypress-network-idle';

Cypress.Commands.add(
'kbnPost',
Expand Down Expand Up @@ -173,10 +174,15 @@ Cypress.Commands.add('shouldHaveStyle', { prevSubject: true }, (subject, propert
});
});

Cypress.Commands.add('getByDataTestSubj', (value, options?) => {
Cypress.Commands.add('getByDataTestSubj', (value: string, options?: any) => {
return cy.get(`[data-test-subj="${value}"]`, options);
});

Cypress.Commands.add('findByDataTestSubj', { prevSubject: 'element' }, (subject, value: string) => {
const el = subject.find(`[data-test-subj="${value}"]`);
return cy.wrap(el);
});

Cypress.on('uncaught:exception', (err, runnable) => {
/**
* Don't fail test when these specific errors from kibana platform
Expand All @@ -190,7 +196,7 @@ Cypress.on('uncaught:exception', (err, runnable) => {
err.message.includes("Cannot read properties of undefined (reading 'type')") || // kibana 7.x throws this error when run with ECK
err.message.includes('Markdown content is required in [readOnly] mode') || // kibana 8.13.0 throws this error on sample data canvas open
err.message.includes('e.toSorted is not a function') || // kibana 8.15.0 throws this error on report generation
err.message.includes('Not Found') // kibana 9.0.0-beta1 throws: Uncaught (in promise) http_fetch_error_HttpFetchError: Not Foun
err.message.includes('Not Found') // kibana 9.0.0-beta1 throws: Uncaught (in promise) http_fetch_error_HttpFetchError: Not Found
) {
return false;
}
Expand Down
16 changes: 4 additions & 12 deletions e2e-tests/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@ declare global {
payload?: Payload;
failOnStatusCode?: boolean;
}): Chainable<Subject>;
esGet({
endpoint,
credentials,
failOnStatusCode
}: {
endpoint: string;
credentials: string;
failOnStatusCode?: boolean;
}): Chainable<Subject>;
esGet({ endpoint, credentials }: { endpoint: string; credentials: string }): Chainable<Subject>;
esPost({
endpoint,
credentials,
Expand All @@ -141,15 +133,15 @@ declare global {
}): Chainable<Subject>;
esDelete({
endpoint,
credentials,
failOnStatusCode
credentials
}: {
endpoint: string;
credentials: string;
failOnStatusCode?: boolean;
}): Chainable<Subject>;
shouldHaveStyle(property: string, value: string): Chainable<Element>;
getByDataTestSubj(value: string, options?: any): Chainable<Subject>;
getByDataTestSubj(value: string, options?: any): Chainable<JQuery<HTMLElement>>;
findByDataTestSubj(value: string, options?: any): Chainable<JQuery<HTMLElement>>;
}

type Payload = string | object;
Expand Down
26 changes: 26 additions & 0 deletions e2e-tests/cypress/support/page-objects/Discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ export class Discover {
cy.contains(indexPatternName).should('be.visible');
}
};

static openSaveSessionPanel = () => {
cy.log('Open Save Session Panel');
cy.get('button[aria-label="Search session complete"]').click();
};

static pressSaveSessionButton = () => {
cy.log('Press Save Session Button');
cy.getByDataTestSubj('searchSessionIndicatorSaveBtn').click();
cy.getByDataTestSubj('searchSessionIndicatorSaveBtn').should('not.exist');
};

static pressManageSessionsButton = () => {
cy.log('Press Manage Sessions Button');
cy.getByDataTestSubj('searchSessionIndicatorViewSearchSessionsLink').click();
};

static verifyDiscoverFromSearchSessionCorrectlyRestored = () => {
cy.log('Verify Discover from search session');

if (semver.gte(getKibanaVersion(), '8.0.0')) {
cy.contains(/You are viewing cached data from a specific time range/i).should('be.visible');
} else {
cy.getByDataTestSubj('searchSessionIndicator').should('be.visible');
}
};
}

const createKibanaIndexPattern = (indexPatternName: string) => {
Expand Down
9 changes: 8 additions & 1 deletion e2e-tests/cypress/support/page-objects/Impersonate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { RorMenu } from './RorMenu';
import { SecuritySettings } from './SecuritySettings';
import { Loader } from './Loader';
import { rorApiClient } from '../helpers/RorApiClient';
import semver from 'semver';
import { getKibanaVersion } from '../helpers';

export class Impersonate {
static open() {
Expand Down Expand Up @@ -182,7 +184,12 @@ export class Impersonate {
cy.log('finish impersonation');
RorMenu.openRorMenu();
cy.contains('Finish impersonation').click();
Loader.loading();
if (semver.gte(getKibanaVersion(), '9.3.0')) {

} else {
Loader.loading();

}
}

static setTestSettingsData(): Cypress.Chainable<void> {
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cypress/support/page-objects/IndexManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class IndexManagement {
cy.get('[for="confirmDeleteIndicesCheckbox"]').click();
}

cy.get('[data-test-subj="confirmModalConfirmButton"]').click();
cy.get('[data-test-subj="confirmModalConfirmButton"]').click({ force: true });
}

static verifyIndexExists(indexName: string) {
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/cypress/support/page-objects/KibanaToast.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class KibanaToast {
public static closeToastMessage() {
cy.log('Close toast message');
cy.getByDataTestSubj('toastCloseButton').click();
}
}
4 changes: 4 additions & 0 deletions e2e-tests/cypress/support/page-objects/Reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RorMenu } from './RorMenu';
import { StackManagement } from './StackManagement';
import { getKibanaVersion } from '../helpers';
import { esApiAdvancedClient } from '../helpers/EsApiAdvancedClient';
import { KibanaToast } from './KibanaToast';

type OpenBy = 'rorMenu' | 'kibanaNavigation';

Expand Down Expand Up @@ -45,6 +46,9 @@ export class Reporting {
.closest('[data-test-subj=reportJobRow]')
.find('[type=checkbox]')
.click();
if (semver.gte(getKibanaVersion(), '9.3.0')) {
KibanaToast.closeToastMessage();
}
cy.get('[data-test-subj=deleteReportButton]').click();
cy.get('[data-test-subj=confirmModalConfirmButton]').click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class RoAndRoStrictKibanaAccessAssertions {
Home.loadSampleDataButtonHidden();

cy.log('Verify Dashboard features');
cy.intercept('*65024-65279.pbf').as('dashboardResolve');
if (semver.gte(getKibanaVersion(), '8.0.0')) {
Dashboard.openDashboards();
} else {
Expand All @@ -30,7 +29,9 @@ export class RoAndRoStrictKibanaAccessAssertions {
SubHeader.breadcrumbsLastItem('[eCommerce] Revenue Dashboard');
Dashboard.editButtonNotExist();
Dashboard.cloneButtonNotExist();
cy.wait('@dashboardResolve', { timeout: 30000 });
cy.waitForNetworkIdle('*.pbf', 3000, {
timeout: 30000
});

cy.log('Verify Discover features');
KibanaNavigation.openPage('Discover');
Expand Down
14 changes: 14 additions & 0 deletions e2e-tests/cypress/support/page-objects/SearchSessions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export class SearchSessions {
static numberOfVisibleSearchSessions(numberOfVisibleSessions: number) {
cy.log('Verify list of search sessions');

cy.getByDataTestSubj('searchSessionsRow').should('have.length', numberOfVisibleSessions);
}

static openSelectedSearchSession(sessionRow: number) {
cy.log('Open selected search session from the list');

cy.getByDataTestSubj('searchSessionsRow').eq(sessionRow).as('row');
cy.get('@row').findByDataTestSubj('sessionManagementNameCol').click();
}
}
5 changes: 5 additions & 0 deletions e2e-tests/cypress/support/page-objects/SecuritySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ export class SecuritySettings {
static checkActiveTab(tab: string) {
SecuritySettings.getIframeBody().findByRole('tab', { name: tab, selected: true }).should('be.visible');
}

static closeSecuritySettings() {
cy.log('close security settings');
SecuritySettings.getIframeBody().find('[aria-label="Close settings"]').click();
}
}
5 changes: 3 additions & 2 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"dependencies": {
"@testing-library/cypress": "^10.0.3",
"cypress": "15.6.0",
"form-data": "^4.0.0",
"js-yaml": "^4.1.0",
"cypress-network-idle": "^1.15.0",
"form-data": "^4.0.4",
"js-yaml": "^4.1.1",
"node-fetch": "2.6.7",
"semver": "7.5.2"
},
Expand Down
Loading
Loading