Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kibana 8.16.0 tests synchronization #15

Merged
merged 3 commits into from
Nov 24, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/trigger-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["8.15.4", "7.17.25"]
version: ["8.16.0", "7.17.25"]
env: [docker, eck]
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cypress/e2e/Dev-tools.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Dev tools', () => {

cy.log('should verify GET /_index_template successful with 403 status');
DevTools.sendRequest('GET /_index_template/');
DevTools.verifyIf403Status();
DevTools.verifyIf200Status();
coutoPL marked this conversation as resolved.
Show resolved Hide resolved

cy.log('should verify POST .kibana/_search successful with 200 status');
DevTools.sendRequest('POST .kibana/_search');
Expand Down
19 changes: 15 additions & 4 deletions e2e-tests/cypress/e2e/Spaces.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { Loader } from '../support/page-objects/Loader';
import { KibanaNavigation } from '../support/page-objects/KibanaNavigation';
import { getKibanaVersion, userCredentials } from '../support/helpers';
import { kbnApiAdvancedClient } from '../support/helpers/KbnApiAdvancedClient';
import { Spaces } from '../support/page-objects/Spaces';

const SPACE_NAME = 'Test space';

describe('Spaces', () => {
beforeEach(() => {
Expand All @@ -27,7 +30,10 @@ describe('Spaces', () => {
cy.contains('Default').click();

cy.log('Set feature visibility to hidden');
if (semver.gte(getKibanaVersion(), '8.4.0')) {
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.get('[data-test-subj="manageSpaces"]').click();
cy.get('[data-test-subj="default-hyperlink"]').click();
} else if (semver.gte(getKibanaVersion(), '8.4.0')) {
cy.get('[data-test-subj=Default-editSpace]').click();
}
cy.get('#featureCategoryCheckbox_kibana').uncheck();
Expand All @@ -49,7 +55,10 @@ describe('Spaces', () => {
cy.contains('Default').click();

cy.log('Clear all changes');
if (semver.gte(getKibanaVersion(), '8.4.0')) {
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.get('[data-test-subj="manageSpaces"]').click();
cy.get('[data-test-subj="default-hyperlink"]').click();
} else if (semver.gte(getKibanaVersion(), '8.4.0')) {
cy.get('[data-test-subj=Default-editSpace]').click();
}
cy.get('#featureCategoryCheckbox_kibana').check();
Expand All @@ -65,10 +74,10 @@ describe('Spaces', () => {
cy.get('[data-test-subj=spacesNavSelector]').click();
cy.get('[data-test-subj=manageSpaces]').click({ force: true });
cy.get('[data-test-subj=createSpace]').click();
cy.get('[data-test-subj=addSpaceName]').type('Test space');
cy.get('[data-test-subj=addSpaceName]').type(SPACE_NAME);
cy.get('#featureCategoryCheckbox_kibana').uncheck();
cy.get('[data-test-subj=save-space-button]').click();
cy.contains("Space 'Test space' was saved.");
cy.contains(`Space '${SPACE_NAME}' was saved.`);

cy.log('Switch to newly created space');
cy.get('[data-test-subj=spacesNavSelector]').click();
Expand All @@ -85,5 +94,7 @@ describe('Spaces', () => {
KibanaNavigation.openHomepage();
KibanaNavigation.openKibanaNavigation();
KibanaNavigation.checkIfNotExists('Analytics');

Spaces.removeSpace(SPACE_NAME);
});
});
8 changes: 7 additions & 1 deletion e2e-tests/cypress/e2e/User-settings.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as semver from 'semver';
import { Login } from '../support/page-objects/Login';
import { UserSettings } from '../support/page-objects/UserSettings';
import { SecuritySettings } from '../support/page-objects/SecuritySettings';
import { getKibanaVersion } from '../support/helpers';

describe('User settings', () => {
beforeEach(() => {
Expand All @@ -12,7 +14,11 @@ describe('User settings', () => {
cy.log('Change theme');
SecuritySettings.getIframeBody().find('[data-test-subj="dark"]').click({ force: true });
SecuritySettings.getIframeBody().find('button').contains('Reload page').click({ force: true });
cy.intercept('**/*dark.css').as('darkMode');
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.intercept('**/*legacy_dark_theme.min.css').as('darkMode');
} else {
cy.intercept('**/*dark.css').as('darkMode');
}

cy.reload();

Expand Down
14 changes: 7 additions & 7 deletions e2e-tests/cypress/support/helpers/KbnApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ export class KbnApiClient {
public getDataViews(credentials: string, group?: string): Cypress.Chainable<DataViews> {
return cy.kbnGet({
endpoint: 'api/data_views',
credentials: credentials,
credentials,
currentGroupHeader: group
});
}

public createDataView(dataView: object, credentials: string, group?: string): void {
cy.kbnPost({
endpoint: 'api/data_views/data_view',
credentials: credentials,
credentials,
currentGroupHeader: group,
payload: dataView
});
Expand All @@ -19,31 +19,31 @@ export class KbnApiClient {
public deleteDataView(dataViewId: string, credentials: string, group?: string): void {
cy.kbnDelete({
endpoint: `api/data_views/data_view/${dataViewId}`,
credentials: credentials,
credentials,
currentGroupHeader: group
});
}

public getSavedObjects(credentials: string, group?: string): Cypress.Chainable<GetObject> {
return cy.kbnGet({
endpoint: 'api/saved_objects/_find?type=index-pattern&type=search&type=visualization&type=dashboard&type=config',
credentials: credentials,
credentials,
currentGroupHeader: group
});
}

public deleteSavedObject(savedObject: SavedObject, credentials: string, group?: string): void {
cy.kbnDelete({
endpoint: `api/saved_objects/${savedObject.type}/${savedObject.id}`,
credentials: credentials,
credentials,
currentGroupHeader: group
});
}

public deleteSampleData(sampleDatasetName: string, credentials: string, group?: string): void {
cy.kbnDelete({
endpoint: `api/sample_data/${sampleDatasetName}`,
credentials: credentials,
credentials,
currentGroupHeader: group
});
}
Expand Down Expand Up @@ -91,4 +91,4 @@ interface Space {
color: string;
disabledFeatures: string[];
imageUrl: string;
}
}
14 changes: 12 additions & 2 deletions e2e-tests/cypress/support/page-objects/DevTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ export class DevTools {
cy.log('Open Dev tools');
KibanaNavigation.openKibanaNavigation();
cy.contains('Dev Tools').click();
cy.get('[data-test-subj="help-close-button"]').click();

if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.get("[data-test-subj='consoleSkipTourButton']").click();
} else {
cy.get('[data-test-subj="help-close-button"]').click();
}
}

static sendRequest(text: string) {
cy.log('Send request');
if (semver.lte(getKibanaVersion(), '7.9.0')) {
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.get('[data-test-subj="clearConsoleInput"]').click();
cy.get('[data-test-subj="consoleMonacoEditor"]').click().type(text);
cy.get('[data-test-subj="sendRequestButton"]').click();
} else if (semver.lte(getKibanaVersion(), '7.9.0')) {
// Select editor, delete, write
cy.get('#ConAppEditor').click();
cy.get('#ConAppInputTextarea').clear({ force: true });
Expand All @@ -26,6 +35,7 @@ export class DevTools {
cy.get('[data-test-subj=console-textarea]').type(text, { force: true });
cy.get('[data-test-subj=sendRequestButton]').click();
}
cy.contains('Request in progress');
}

static verifyIf200Status() {
Expand Down
8 changes: 6 additions & 2 deletions e2e-tests/cypress/support/page-objects/KibanaNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ export class KibanaNavigation {

static checkIfNotVisible(page: string) {
cy.log('checkIfNotVisible');
cy.get('[data-test-subj=collapsibleNav]').contains(page).should('not.be.visible');
cy.get('[data-test-subj=collapsibleNav]')
.contains(new RegExp(`^${page}$`))
.should('not.be.visible');
}

static checkIfNotExists(page: string) {
cy.log('checkIfNotExists');
cy.get('[data-test-subj=collapsibleNav]').contains(page).should('not.exist');
cy.get('[data-test-subj=collapsibleNav]')
.contains(new RegExp(`^${page}$`))
.should('not.exist');
}

static checkIfRouteNotReachable(pathname: string, spacePrefix = '/s/default') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class RoAndRoStrictKibanaAccessAssertions {

cy.log('Verify Canvas features');

if (semver.gte(getKibanaVersion(), '8.9.0')) {
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.intercept('/s/default/internal/canvas/fns').as('canvasResolve');
} else if (semver.gte(getKibanaVersion(), '8.9.0')) {
cy.intercept('/s/default/internal/canvas/fns?compress=true').as('canvasResolve');
} else if (semver.gte(getKibanaVersion(), '7.17.15')) {
cy.intercept('/s/default/api/canvas/fns?compress=true').as('canvasResolve');
Expand Down
16 changes: 15 additions & 1 deletion e2e-tests/cypress/support/page-objects/Spaces.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import * as semver from 'semver';
import { getKibanaVersion } from '../helpers';

export class Spaces {
static removeSpace(spaceName: string) {
cy.log('Remove space');
const spaceNameLowerCaseAndDash = spaceName.toLowerCase().replace(' ', '-');

cy.get('[data-test-subj=spacesNavSelector]').click();
cy.get('[data-test-subj=manageSpaces]').click({ force: true });
cy.get(`[data-test-subj="${spaceName} space-deleteSpace"]`).click({ force: true });
if (semver.gte(getKibanaVersion(), '8.16.0')) {
cy.get(`[id="${spaceNameLowerCaseAndDash}-actions"]`).click();
cy.get(`[data-test-subj="${spaceNameLowerCaseAndDash}-deleteSpace"]`).click();
} else {
cy.get(`[data-test-subj="${spaceName}-deleteSpace"]`).click();
}

cy.intercept(`s/${spaceNameLowerCaseAndDash}/api/spaces/space/${spaceNameLowerCaseAndDash}`).as('deleteSpace');
coutoPL marked this conversation as resolved.
Show resolved Hide resolved
cy.get('[data-test-subj=confirmModalConfirmButton]').click({ force: true });
cy.wait('@deleteSpace').then(({ response }) => {
expect([204]).to.include(response.statusCode);
});
}
}
5 changes: 2 additions & 3 deletions e2e-tests/cypress/support/page-objects/TestSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TestSettings {
}

static loadCurrentSettings() {
cy.log('Load current settings settings');
cy.log('Load current settings');
cy.intercept('GET', '/pkp/api/settings').as('loadCurrentSettings');
TestSettings.pressLoadCurrentSettingsButton();
cy.wait('@loadCurrentSettings').then(({ response }) => {
Expand Down Expand Up @@ -160,8 +160,7 @@ export class TestSettings {
cy.log('Set default data');
TestSettings.open();
TestSettings.changeTtlValue('50', 'Seconds');
// TODO: Uncomment it when es plugin fix issue with settings
// TestSettings.loadCurrentSettings();
TestSettings.loadCurrentSettings();
TestSettings.pressSaveTestSettingsButton();
}
}
Loading