From 0cbb0559f0d0f141d74b0c75922da1d4d486c251 Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 20 Jul 2023 14:30:52 -0700 Subject: [PATCH 1/5] Improve date selection across versions of OUI (#778) Signed-off-by: Miki --- cypress/utils/commands.js | 19 +++++++++++++++++++ cypress/utils/dashboards/commands.js | 28 ++++++++++++++++++++++------ cypress/utils/index.d.ts | 20 +++++++++++++++++++- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/cypress/utils/commands.js b/cypress/utils/commands.js index ce28849bc..cab746dd3 100644 --- a/cypress/utils/commands.js +++ b/cypress/utils/commands.js @@ -202,6 +202,25 @@ Cypress.Commands.add('getElementByTestId', (testId, options = {}) => { return cy.get(`[data-test-subj="${testId}"]`, options); }); +Cypress.Commands.add('getElementsByTestIds', (testIds, options = {}) => { + const selectors = [testIds] + .flat(Infinity) + .map((testId) => `[data-test-subj="${testId}"]`); + return cy.get(selectors.join(','), options); +}); + +Cypress.Commands.add( + 'whenTestIdNotFound', + (testIds, callbackFn, options = {}) => { + const selectors = [testIds] + .flat(Infinity) + .map((testId) => `[data-test-subj="${testId}"]`); + cy.get('body', options).then(($body) => { + if ($body.find(selectors.join(',')).length === 0) callbackFn(); + }); + } +); + Cypress.Commands.add('createIndex', (index, policyID = null, settings = {}) => { cy.request('PUT', `${Cypress.env('openSearchUrl')}/${index}`, settings); if (policyID != null) { diff --git a/cypress/utils/dashboards/commands.js b/cypress/utils/dashboards/commands.js index 54615c999..1d2188c4f 100644 --- a/cypress/utils/dashboards/commands.js +++ b/cypress/utils/dashboards/commands.js @@ -47,13 +47,29 @@ Cypress.Commands.add('setTopNavDate', (start, end, submit = true) => { message: `Start: ${start} :: End: ${end}`, }); - // Click date picker - cy.getElementByTestId('superDatePickerShowDatesButton', opts).click(opts); - - // Click start date - cy.getElementByTestId('superDatePickerstartDatePopoverButton', opts).click( + /* Find any one of the two buttons that change/open the date picker: + * * if `superDatePickerShowDatesButton` is found, it will switch the mode to dates + * * in some versions of OUI, the switch will open the date selection dialog as well + * * if `superDatePickerstartDatePopoverButton` is found, it will open the date selection dialog + */ + cy.getElementsByTestIds( + ['superDatePickerstartDatePopoverButton', 'superDatePickerShowDatesButton'], opts - ); + ) + .should('be.visible') + .invoke('attr', 'data-test-subj') + .then((testId) => { + cy.getElementByTestId(testId, opts).should('be.visible').click(opts); + }); + + /* While we surely are in the date selection mode, we don't know if the date selection dialog + * is open or not. Looking for a tab and if it is missing, click on the dialog opener. + */ + cy.whenTestIdNotFound('superDatePickerAbsoluteTab', () => { + cy.getElementByTestId('superDatePickerstartDatePopoverButton', opts) + .should('be.visible') + .click(opts); + }); // Click absolute tab cy.getElementByTestId('superDatePickerAbsoluteTab', opts).click(opts); diff --git a/cypress/utils/index.d.ts b/cypress/utils/index.d.ts index 4f436c3e0..d5daf9dfd 100644 --- a/cypress/utils/index.d.ts +++ b/cypress/utils/index.d.ts @@ -2,7 +2,25 @@ /// declare namespace Cypress { - interface Chainable { + interface Chainable { /** + * Call a function when an element with a test id cannot be found + * @example + * cy.whenTestIdNotFound(['query', 'puery'], () => {...}) + */ + whenTestIdNotFound( + testIds: string | string[], + callbackFn: void, + options?: Partial + ): Chainable; + /** + * Get elements by their test ids + * @example + * cy.getElementsByTestIds(['query', 'puery']) + */ + getElementsByTestIds( + testIds: string | string[], + options?: Partial + ): Chainable; /** * Get an element by its test id * @example From 62e9253ca4cfdce31aa434b61fdc71c14ae41eea Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Fri, 21 Jul 2023 11:28:01 +0800 Subject: [PATCH 2/5] feat: sync cypress test from notifications-dashboards (#776) (#784) * feat: sync cypress test from notifications-dashboards Signed-off-by: SuZhou-Joe * feat: rename commands Signed-off-by: SuZhou-Joe * feat: update Signed-off-by: SuZhou-Joe * feat: add larger wait time Signed-off-by: SuZhou-Joe * feat: update Signed-off-by: SuZhou-Joe * feat: update Signed-off-by: SuZhou-Joe * feat: update Signed-off-by: SuZhou-Joe * feat: add refresh before delete all notifications configs Signed-off-by: SuZhou-Joe --------- Signed-off-by: SuZhou-Joe (cherry picked from commit 81f70c37fde7b468915b173b0e81f4a609ecea84) --- .../test_chime_channel.json | 11 +++ .../test_email_recipient_group.json | 30 ++++++++ .../test_ses_sender.json | 13 ++++ .../test_slack_channel.json | 11 +++ .../test_smtp_email_channel.json | 17 +++++ .../test_sns_channel.json | 12 ++++ .../test_ssl_smtp_sender.json | 14 ++++ .../test_tls_smtp_sender.json | 15 ++++ .../test_webhook_channel.json | 12 ++++ .../1_email_senders_and_groups.spec.js | 69 ++++++++++++++++--- .../2_channels.spec.js | 32 ++++++++- cypress/support/index.js | 1 + .../notifications-dashboards/commands.js | 45 ++++++++++++ .../notifications-dashboards/constants.js | 4 ++ 14 files changed, 272 insertions(+), 14 deletions(-) create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_chime_channel.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_email_recipient_group.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_ses_sender.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_slack_channel.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_smtp_email_channel.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_sns_channel.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_ssl_smtp_sender.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json create mode 100644 cypress/fixtures/plugins/notifications-dashboards/test_webhook_channel.json create mode 100644 cypress/utils/plugins/notifications-dashboards/commands.js diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_chime_channel.json b/cypress/fixtures/plugins/notifications-dashboards/test_chime_channel.json new file mode 100644 index 000000000..feb56cc1f --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_chime_channel.json @@ -0,0 +1,11 @@ +{ + "config": { + "name": "Test chime channel", + "description": "A test chime channel", + "config_type": "chime", + "is_enabled": true, + "chime": { + "url": "https://sample-chime-webhook" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_email_recipient_group.json b/cypress/fixtures/plugins/notifications-dashboards/test_email_recipient_group.json new file mode 100644 index 000000000..6f043b7cb --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_email_recipient_group.json @@ -0,0 +1,30 @@ +{ + "config": { + "name": "Test recipient group", + "description": "A test email recipient group", + "config_type": "email_group", + "is_enabled": true, + "email_group": { + "recipient_list": [ + { + "recipient": "custom.email.1@test.com" + }, + { + "recipient": "custom.email.2@test.com" + }, + { + "recipient": "custom.email.3@test.com" + }, + { + "recipient": "custom.email.4@test.com" + }, + { + "recipient": "custom.email.5@test.com" + }, + { + "recipient": "custom.email.6@test.com" + } + ] + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_ses_sender.json b/cypress/fixtures/plugins/notifications-dashboards/test_ses_sender.json new file mode 100644 index 000000000..1395b9364 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_ses_sender.json @@ -0,0 +1,13 @@ +{ + "config": { + "name": "test-ses-sender", + "description": "A test SES sender", + "config_type": "ses_account", + "is_enabled": true, + "ses_account": { + "region": "us-east-1", + "role_arn": "arn:aws:iam::012345678912:role/NotificationsSESRole", + "from_address": "test@email.com" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_slack_channel.json b/cypress/fixtures/plugins/notifications-dashboards/test_slack_channel.json new file mode 100644 index 000000000..7643b2b0d --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_slack_channel.json @@ -0,0 +1,11 @@ +{ + "config": { + "name": "Test slack channel", + "description": "A test slack channel", + "config_type": "slack", + "is_enabled": true, + "slack": { + "url": "https://sample-slack-webhook" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_smtp_email_channel.json b/cypress/fixtures/plugins/notifications-dashboards/test_smtp_email_channel.json new file mode 100644 index 000000000..f6ddc82a9 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_smtp_email_channel.json @@ -0,0 +1,17 @@ +{ + "config": { + "name": "Test email channel", + "description": "A test SMTP email channel", + "config_type": "email", + "is_enabled": true, + "email": { + "email_account_id": "test_smtp_sender_id", + "recipient_list": [ + { + "recipient": "custom.email@test.com" + } + ], + "email_group_id_list": [] + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_sns_channel.json b/cypress/fixtures/plugins/notifications-dashboards/test_sns_channel.json new file mode 100644 index 000000000..579eabd61 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_sns_channel.json @@ -0,0 +1,12 @@ +{ + "config": { + "name": "test-sns-channel", + "description": "A test SNS channel", + "config_type": "sns", + "is_enabled": true, + "sns": { + "topic_arn": "arn:aws:sns:us-west-2:123456789012:notifications-test", + "role_arn": "arn:aws:iam::012345678901:role/NotificationsSNSRole" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_ssl_smtp_sender.json b/cypress/fixtures/plugins/notifications-dashboards/test_ssl_smtp_sender.json new file mode 100644 index 000000000..977369a03 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_ssl_smtp_sender.json @@ -0,0 +1,14 @@ +{ + "config": { + "name": "test-ssl-sender", + "description": "A test SSL SMTP sender", + "config_type": "smtp_account", + "is_enabled": true, + "smtp_account": { + "host": "test-host.com", + "port": 123, + "method": "ssl", + "from_address": "test@email.com" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json b/cypress/fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json new file mode 100644 index 000000000..cfa9870e4 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json @@ -0,0 +1,15 @@ +{ + "config_id": "test_smtp_sender_id", + "config": { + "name": "test-tls-sender", + "description": "A test TLS SMTP sender", + "config_type": "smtp_account", + "is_enabled": true, + "smtp_account": { + "host": "test-host.com", + "port": 123, + "method": "start_tls", + "from_address": "test@email.com" + } + } +} \ No newline at end of file diff --git a/cypress/fixtures/plugins/notifications-dashboards/test_webhook_channel.json b/cypress/fixtures/plugins/notifications-dashboards/test_webhook_channel.json new file mode 100644 index 000000000..86d6ec102 --- /dev/null +++ b/cypress/fixtures/plugins/notifications-dashboards/test_webhook_channel.json @@ -0,0 +1,12 @@ +{ + "config": { + "name": "Test webhook channel", + "description": "A test webhook channel", + "config_type": "webhook", + "is_enabled": true, + "webhook": { + "url": "https://custom-webhook-test-url.com:8888/test-path?params1=value1¶ms2=value2¶ms3=value3¶ms4=value4¶ms5=values5¶ms6=values6¶ms7=values7" + } + } +} + diff --git a/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js b/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js index 25c4e1adf..2bd28c9af 100644 --- a/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/1_email_senders_and_groups.spec.js @@ -11,10 +11,21 @@ import { NOTIFICATIONS_PLUGIN_NAME, } from '../../../utils/constants'; +import testSslSmtpSender from '../../../fixtures/plugins/notifications-dashboards/test_ssl_smtp_sender.json'; +import testTlsSmtpSender from '../../../fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json'; +import testSesSender from '../../../fixtures/plugins/notifications-dashboards/test_ses_sender.json'; +import testEmailRecipientGroup from '../../../fixtures/plugins/notifications-dashboards/test_email_recipient_group.json'; + describe('Test create email senders', () => { + before(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + }); + beforeEach(() => { cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`); - cy.wait(NOTIFICATIONS_DELAY * 3); + cy.reload(true); + cy.wait(NOTIFICATIONS_DELAY * 5); }); it('creates ssl sender', () => { @@ -62,7 +73,7 @@ describe('Test create email senders', () => { cy.get('.euiButton__text').contains('Create').click({ force: true }); cy.contains('successfully created.').should('exist'); - cy.contains('test-ssl-sender').should('exist'); + cy.contains('test-tls-sender').should('exist'); }); it('creates SES sender', () => { @@ -89,16 +100,26 @@ describe('Test create email senders', () => { }); describe('Test edit senders', () => { + before(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + + cy.createNotificationConfig(testSslSmtpSender); + cy.createNotificationConfig(testTlsSmtpSender); + cy.createNotificationConfig(testSesSender); + }); + beforeEach(() => { cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`); - cy.wait(NOTIFICATIONS_DELAY * 3); + cy.reload(true); + cy.wait(NOTIFICATIONS_DELAY * 5); }); it('edits sender email address', () => { cy.get('.euiCheckbox__input[aria-label="Select this row"]').eq(0).click(); // ssl sender cy.get('[data-test-subj="senders-table-edit-button"]').click(); cy.get('[data-test-subj="create-sender-form-email-input"]').type( - '{selectall}{backspace}edited.test@email.com' + '{selectall}{backspace}editedtest@email.com' ); cy.wait(NOTIFICATIONS_DELAY); @@ -120,14 +141,26 @@ describe('Test edit senders', () => { }); describe('Test delete senders', () => { + before(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + + cy.createNotificationConfig(testSslSmtpSender); + cy.createNotificationConfig(testTlsSmtpSender); + cy.createNotificationConfig(testSesSender); + }); + beforeEach(() => { cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`); - cy.wait(NOTIFICATIONS_DELAY * 3); + cy.reload(true); + cy.wait(NOTIFICATIONS_DELAY * 5); }); it('deletes smtp senders', () => { cy.get('.euiCheckbox__input[aria-label="Select this row"]').eq(0).click(); // ssl sender - cy.get('[data-test-subj="senders-table-delete-button"]').click(); + cy.get('[data-test-subj="senders-table-delete-button"]').click({ + force: true, + }); cy.get('input[placeholder="delete"]').type('delete'); cy.wait(NOTIFICATIONS_DELAY); cy.get('[data-test-subj="delete-sender-modal-delete-button"]').click(); @@ -136,7 +169,10 @@ describe('Test delete senders', () => { it('deletes ses senders', () => { cy.get('.euiCheckbox__input[aria-label="Select this row"]').last().click(); // ses sender - cy.get('[data-test-subj="ses-senders-table-delete-button"]').click(); + cy.wait(NOTIFICATIONS_DELAY); + cy.get('[data-test-subj="ses-senders-table-delete-button"]').click({ + force: true, + }); cy.get('input[placeholder="delete"]').type('delete'); cy.wait(NOTIFICATIONS_DELAY); cy.get('[data-test-subj="delete-sender-modal-delete-button"]').click(); @@ -148,10 +184,16 @@ describe('Test delete senders', () => { describe('Test create, edit and delete recipient group', () => { beforeEach(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + + cy.createNotificationConfig(testEmailRecipientGroup); + cy.visit( `${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-recipient-groups` ); - cy.wait(NOTIFICATIONS_DELAY * 3); + cy.reload(true); + cy.wait(NOTIFICATIONS_DELAY * 5); }); it('creates recipient group', () => { @@ -210,13 +252,18 @@ describe('Test create, edit and delete recipient group', () => { }); it('opens email addresses popup', () => { - cy.get('.euiLink').contains('1 more').click({ force: true }); + cy.get('.euiTableCellContent--overflowingContent .euiLink') + .contains('1 more') + .click({ force: true }); cy.contains('custom.email.6@test.com').should('exist'); }); it('deletes recipient groups', () => { - cy.get('[data-test-subj="checkboxSelectAll"]').last().click(); - cy.get('[data-test-subj="recipient-groups-table-delete-button"]').click(); + cy.get('[data-test-subj="checkboxSelectAll"]').click({ force: true }); + cy.wait(NOTIFICATIONS_DELAY); + cy.get('[data-test-subj="recipient-groups-table-delete-button"]').click({ + force: true, + }); cy.get('input[placeholder="delete"]').type('delete'); cy.wait(NOTIFICATIONS_DELAY); cy.get( diff --git a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js index 6e2dbad1f..bd5766e86 100644 --- a/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js +++ b/cypress/integration/plugins/notifications-dashboards/2_channels.spec.js @@ -11,7 +11,19 @@ import { NOTIFICATIONS_PLUGIN_NAME, } from '../../../utils/constants'; +import testSlackChannel from '../../../fixtures/plugins/notifications-dashboards/test_slack_channel.json'; +import testChimeChannel from '../../../fixtures/plugins/notifications-dashboards/test_chime_channel.json'; +import testWebhookChannel from '../../../fixtures/plugins/notifications-dashboards/test_webhook_channel.json'; +import testTlsSmtpSender from '../../../fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json'; + describe('Test create channels', () => { + before(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + + cy.createNotificationConfig(testTlsSmtpSender); + }); + beforeEach(() => { cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#create-channel`); cy.wait(NOTIFICATIONS_DELAY * 3); @@ -58,7 +70,7 @@ describe('Test create channels', () => { cy.contains('successfully created.').should('exist'); }); - it('creates a email channel', () => { + it('creates an email channel', () => { cy.get('[placeholder="Enter channel name"]').type('Test email channel'); cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); @@ -96,7 +108,7 @@ describe('Test create channels', () => { cy.contains('successfully created.').should('exist'); }); - it('creates a email channel with ses sender', () => { + it('creates an email channel with ses sender', () => { cy.get('[placeholder="Enter channel name"]').type( 'Test email channel with ses' ); @@ -156,7 +168,7 @@ describe('Test create channels', () => { cy.contains('successfully created.').should('exist'); }); - it('creates a sns channel', () => { + it('creates an sns channel', () => { cy.get('[placeholder="Enter channel name"]').type('test-sns-channel'); cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true }); @@ -179,6 +191,17 @@ describe('Test create channels', () => { }); describe('Test channels table', () => { + before(() => { + // Delete all Notification configs + cy.deleteAllNotificationConfigs(); + + // Create test channels + cy.createNotificationConfig(testSlackChannel); + cy.createNotificationConfig(testChimeChannel); + cy.createNotificationConfig(testWebhookChannel); + cy.createTestEmailChannel(); + }); + beforeEach(() => { cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#channels`); cy.wait(NOTIFICATIONS_DELAY * 3); @@ -260,6 +283,9 @@ describe('Test channel details', () => { // cy.get( // '[data-test-subj="create-channel-description-input"]' // ).type('{selectall}{backspace}Updated custom webhook description'); + cy.get('[data-test-subj="create-channel-description-input"]').type( + '{selectall}{backspace}Updated custom webhook description' + ); cy.get('.euiTextArea').type( '{selectall}{backspace}Updated custom webhook description' ); diff --git a/cypress/support/index.js b/cypress/support/index.js index f7ef56c70..6b13ed838 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -29,6 +29,7 @@ import '../utils/plugins/security-dashboards-plugin/commands'; import '../utils/plugins/alerting-dashboards-plugin/commands'; import '../utils/plugins/ml-commons-dashboards/commands'; import '../utils/plugins/security-analytics-dashboards-plugin/commands'; +import '../utils/plugins/notifications-dashboards/commands'; import 'cypress-real-events'; diff --git a/cypress/utils/plugins/notifications-dashboards/commands.js b/cypress/utils/plugins/notifications-dashboards/commands.js new file mode 100644 index 000000000..f5cfae36e --- /dev/null +++ b/cypress/utils/plugins/notifications-dashboards/commands.js @@ -0,0 +1,45 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ +import testTlsSmtpSender from '../../../fixtures/plugins/notifications-dashboards/test_tls_smtp_sender.json'; +import testSmtpEmailChannel from '../../../fixtures/plugins/notifications-dashboards/test_smtp_email_channel.json'; +import { API } from './constants'; + +Cypress.Commands.add('deleteAllNotificationConfigs', () => { + cy.request({ + method: 'POST', + url: `${Cypress.env('openSearchUrl')}/_refresh`, + }); + + cy.request({ + method: 'GET', + url: `${Cypress.env('openSearchUrl')}${API.CONFIGS_BASE}`, + }).then((response) => { + if (response.status === 200) { + for (let i = 0; i < response.body.total_hits; i++) { + cy.request( + 'DELETE', + `${Cypress.env('openSearchUrl')}${API.CONFIGS_BASE}/${ + response.body.config_list[i].config_id + }` + ); + } + } else { + cy.log('Failed to get configs.', response); + } + }); +}); + +Cypress.Commands.add('createNotificationConfig', (notificationConfigJSON) => { + cy.request( + 'POST', + `${Cypress.env('openSearchUrl')}${API.CONFIGS_BASE}`, + notificationConfigJSON + ); +}); + +Cypress.Commands.add('createTestEmailChannel', () => { + cy.createNotificationConfig(testTlsSmtpSender); + cy.createNotificationConfig(testSmtpEmailChannel); +}); diff --git a/cypress/utils/plugins/notifications-dashboards/constants.js b/cypress/utils/plugins/notifications-dashboards/constants.js index fd6258f70..76da025b8 100644 --- a/cypress/utils/plugins/notifications-dashboards/constants.js +++ b/cypress/utils/plugins/notifications-dashboards/constants.js @@ -5,3 +5,7 @@ export const NOTIFICATIONS_PLUGIN_NAME = 'notifications-dashboards'; export const NOTIFICATIONS_DELAY = 1000; +export const NOTIFICATIONS_API_ROUTE_PREFIX = '/_plugins/_notifications'; +export const API = { + CONFIGS_BASE: `${NOTIFICATIONS_API_ROUTE_PREFIX}/configs`, +}; From 57f934cc6d8bae2b8559ce1c182935eace57fbee Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Fri, 21 Jul 2023 23:13:51 +0600 Subject: [PATCH 3/5] [Table Visualizations] Tests cleanup (#785) Signed-off-by: Sirazh Gabdullin --- .../apps/vis_builder/vis_types/table.spec.js | 2 +- .../opensearch-dashboards/apps/vis_type_table/split.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js index d04accb72..786ddb5b0 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js @@ -87,7 +87,7 @@ export const removeBucket = (bucket) => { export const testSplitTables = (num) => { cy.getElementByTestId('visTable') - .should('have.class', `visTable`) + .should('have.class', 'visTable') .find('[class="visTable__group"]') .should(($tables) => { // should have found specified number of tables diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_type_table/split.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_type_table/split.spec.js index 41717a39f..ec4c10dc8 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_type_table/split.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_type_table/split.spec.js @@ -311,7 +311,7 @@ describe.skip('Split table', () => { cy.tbSplitTablesInColumns(); cy.tbSetupTermsAggregation('age', 'Descending', '2', 2); cy.waitForLoader(); - cy.get('[class="visTable visTable__groupInColumns"]').should('exist'); + cy.get('[class="visTable"]').should('exist'); cy.tbGetAllTableDataFromVisualization(2).then((data) => { expect(data).to.deep.eq(expectData); }); From f73d3f0ae42d1a8e1301df2552ca3b456d46e6d4 Mon Sep 17 00:00:00 2001 From: Miki Date: Mon, 24 Jul 2023 19:51:19 -0700 Subject: [PATCH 4/5] Bump dependency on opensearch-dashboards-test-library (#790) Signed-off-by: Miki --- package-lock.json | 12 ++++++------ package.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73a89e5ec..03919ea9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@cypress/skip-test": "^2.6.1", - "@opensearch-dashboards-test/opensearch-dashboards-test-library": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.4.tar.gz", + "@opensearch-dashboards-test/opensearch-dashboards-test-library": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.5.tar.gz", "brace": "^0.11.1", "prettier": "^2.5.1" }, @@ -273,9 +273,9 @@ "dev": true }, "node_modules/@opensearch-dashboards-test/opensearch-dashboards-test-library": { - "version": "1.0.4", - "resolved": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.4.tar.gz", - "integrity": "sha512-IGxw7GVFRyKgjVs+ubTDynrOEvqlI7gTua+Lf2LbDL9g+f6qQ64gnCyMQWeu3mr+w38r+rvN6Uq0AGCcbQ9mlA==", + "version": "1.0.5", + "resolved": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.5.tar.gz", + "integrity": "sha512-1TIUBDKuAlhBUQg1XqYvsOs0x4R02r/437bDRQxEV21Bz3kP5djPG6hHDtuB7lbJkPE2zTgNO+VeQd50uUr9rQ==", "license": "ISC" }, "node_modules/@types/json5": { @@ -4261,8 +4261,8 @@ "dev": true }, "@opensearch-dashboards-test/opensearch-dashboards-test-library": { - "version": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.4.tar.gz", - "integrity": "sha512-IGxw7GVFRyKgjVs+ubTDynrOEvqlI7gTua+Lf2LbDL9g+f6qQ64gnCyMQWeu3mr+w38r+rvN6Uq0AGCcbQ9mlA==" + "version": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.5.tar.gz", + "integrity": "sha512-1TIUBDKuAlhBUQg1XqYvsOs0x4R02r/437bDRQxEV21Bz3kP5djPG6hHDtuB7lbJkPE2zTgNO+VeQd50uUr9rQ==" }, "@types/json5": { "version": "0.0.29", diff --git a/package.json b/package.json index 92fbf3cbc..4dae0d436 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "homepage": "https://github.com/opensearch-project/opensearch-dashboards-functional-test", "dependencies": { "@cypress/skip-test": "^2.6.1", - "@opensearch-dashboards-test/opensearch-dashboards-test-library": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.4.tar.gz", + "@opensearch-dashboards-test/opensearch-dashboards-test-library": "https://github.com/opensearch-project/opensearch-dashboards-test-library/archive/refs/tags/1.0.5.tar.gz", "brace": "^0.11.1", "prettier": "^2.5.1" }, @@ -62,4 +62,4 @@ "tough-cookie": "^4.1.3", "optionator": "^0.9.3" } -} +} \ No newline at end of file From 14892a0659fac5b08ada63901241665649d1fabd Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Tue, 25 Jul 2023 22:47:28 +0600 Subject: [PATCH 5/5] [Table Visualizations] Test Update (#787) * fix-test * simplify selector --------- Signed-off-by: Sirazh Gabdullin --- .../apps/vis_builder/vis_types/table.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js index 786ddb5b0..4abc9d100 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/vis_types/table.spec.js @@ -88,7 +88,7 @@ export const removeBucket = (bucket) => { export const testSplitTables = (num) => { cy.getElementByTestId('visTable') .should('have.class', 'visTable') - .find('[class="visTable__group"]') + .find('.visTable__group') .should(($tables) => { // should have found specified number of tables expect($tables).to.have.length(num);