Skip to content

Commit

Permalink
Adds linter rules for license and import. Fixes linting
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
  • Loading branch information
ashwin-pc committed Oct 6, 2022
1 parent 4617754 commit e1c41f6
Show file tree
Hide file tree
Showing 15 changed files with 689 additions and 81 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{
"env": {
"node": true
"node": true
},
"extends": [
"eslint:recommended",
"plugin:cypress/recommended",
"plugin:import/recommended",
"prettier"
],
"plugins": [
"cypress",
"header",
"import",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"header/header": [2, "block", ["", " * Copyright OpenSearch Contributors", " * SPDX-License-Identifier: Apache-2.0", " "]],
// turn off no-unnecessary-waiting for now due to the issue: https://github.com/cypress-io/eslint-plugin-cypress/issues/43
"cypress/no-unnecessary-waiting": "off"
}
},
"ignorePatterns": ["**/*.d.ts"]
}
5 changes: 5 additions & 0 deletions cypress/integration/common/dashboard_sample_data_spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
CommonUI,
MiscUtils,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { dashboardSanityTests } from '../../common/dashboard_sample_data_spec.js';

dashboardSanityTests();
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
TestFixtureHandler,
CommonUI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/// <reference types="cypress" />

import {
delay,
BASE_PATH,
NOTIFICATIONS_DELAY,
NOTIFICATIONS_PLUGIN_NAME,
} from '../../../utils/plugins/notifications-dashboards/constants';
import { BASE_PATH } from '../../../utils/base_constants';
} from '../../../utils/constants';

describe('Test create email senders', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

it('creates ssl sender', () => {
Expand Down Expand Up @@ -56,9 +56,9 @@ describe('Test create email senders', () => {
cy.get('[data-test-subj="create-sender-form-encryption-input"]').click({
force: true,
});
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text').contains('TLS').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text').contains('Create').click({ force: true });
cy.contains('successfully created.').should('exist');
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Test create email senders', () => {
describe('Test edit senders', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

it('edits sender email address', () => {
Expand All @@ -100,7 +100,7 @@ describe('Test edit senders', () => {
cy.get('[data-test-subj="create-sender-form-email-input"]').type(
'{selectall}{backspace}edited.test@email.com'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text').contains('Save').click({ force: true });
cy.contains('successfully updated.').should('exist');
Expand All @@ -112,7 +112,7 @@ describe('Test edit senders', () => {
cy.get('[data-test-subj="create-ses-sender-form-aws-region-input"]').type(
'{selectall}{backspace}us-west-2'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text').contains('Save').click({ force: true });
cy.contains('successfully updated.').should('exist');
Expand All @@ -122,14 +122,14 @@ describe('Test edit senders', () => {
describe('Test delete senders', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-senders`);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

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('input[placeholder="delete"]').type('delete');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('[data-test-subj="delete-sender-modal-delete-button"]').click();
cy.contains('successfully deleted.').should('exist');
});
Expand All @@ -138,7 +138,7 @@ describe('Test delete 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.get('input[placeholder="delete"]').type('delete');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('[data-test-subj="delete-sender-modal-delete-button"]').click();
cy.contains('successfully deleted.').should('exist');

Expand All @@ -151,7 +151,7 @@ describe('Test create, edit and delete recipient group', () => {
cy.visit(
`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#email-recipient-groups`
);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

it('creates recipient group', () => {
Expand Down Expand Up @@ -185,12 +185,12 @@ describe('Test create, edit and delete recipient group', () => {
cy.get('[data-test-subj="comboBoxInput"]').type(
'custom.email.6@test.com{enter}'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text').contains('Create').click({ force: true });
cy.contains('successfully created.').should('exist');
cy.contains('Test recipient group').should('exist');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
});

it('edits recipient group description', () => {
Expand All @@ -203,7 +203,7 @@ describe('Test create, edit and delete recipient group', () => {
cy.get(
'[data-test-subj="create-recipient-group-form-description-input"]'
).type('{selectall}{backspace}Updated group description');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text').contains('Save').click({ force: true });
cy.contains('successfully updated.').should('exist');
Expand All @@ -218,7 +218,7 @@ describe('Test create, edit and delete recipient group', () => {
cy.get('[data-test-subj="checkboxSelectAll"]').last().click();
cy.get('[data-test-subj="recipient-groups-table-delete-button"]').click();
cy.get('input[placeholder="delete"]').type('delete');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get(
'[data-test-subj="delete-recipient-group-modal-delete-button"]'
).click({ force: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/// <reference types="cypress" />

import {
delay,
BASE_PATH,
NOTIFICATIONS_DELAY,
NOTIFICATIONS_PLUGIN_NAME,
} from '../../../utils/plugins/notifications-dashboards/constants';
import { BASE_PATH } from '../../../utils/base_constants';
} from '../../../utils/constants';

describe('Test create channels', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#create-channel`);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

it('creates a slack channel and send test message', () => {
Expand All @@ -25,11 +25,11 @@ describe('Test create channels', () => {
cy.get('[data-test-subj="create-channel-slack-webhook-input"]').type(
'https://sample-slack-webhook'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('[data-test-subj="create-channel-send-test-message-button"]').click({
force: true,
});
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
// This needs some time to appear as it will wait for backend call to timeout
cy.contains('test message.').should('exist');

Expand All @@ -43,16 +43,16 @@ describe('Test create channels', () => {
cy.get('[placeholder="Enter channel name"]').type('Test chime channel');

cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text')
.contains('Chime')
.click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('[data-test-subj="create-channel-chime-webhook-input"]').type(
'https://sample-chime-webhook'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('[data-test-subj="create-channel-create-button"]').click();
cy.contains('successfully created.').should('exist');
Expand All @@ -62,11 +62,11 @@ describe('Test create channels', () => {
cy.get('[placeholder="Enter channel name"]').type('Test email channel');

cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text')
.contains('Email')
.click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

// custom data-test-subj does not work on combo box
cy.get('[data-test-subj="comboBoxInput"]').eq(0).click({ force: true });
Expand All @@ -84,7 +84,7 @@ describe('Test create channels', () => {
cy.get('[data-test-subj="comboBoxInput"]')
.last()
.type('custom.email@test.com{enter}');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get(
'[data-test-subj="create-recipient-group-modal-create-button"]'
).click();
Expand All @@ -100,14 +100,14 @@ describe('Test create channels', () => {
);

cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text')
.contains('Email')
.click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('input.euiRadio__input#ses_account').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('.euiButton__text')
.contains('Create SES sender')
Expand All @@ -130,7 +130,7 @@ describe('Test create channels', () => {
// custom data-test-subj does not work on combo box
cy.get('[data-test-subj="comboBoxInput"]').eq(1).click({ force: true });
cy.contains('Test recipient group').click();
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('[data-test-subj="create-channel-create-button"]').click();
cy.contains('successfully created.').should('exist');
Expand All @@ -140,11 +140,11 @@ describe('Test create channels', () => {
cy.get('[placeholder="Enter channel name"]').type('Test webhook channel');

cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text')
.contains('Custom webhook')
.click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('[data-test-subj="custom-webhook-url-input"]').type(
'https://custom-webhook-test-url.com:8888/test-path?params1=value1&params2=value2&params3=value3&params4=value4&params5=values5&params6=values6&params7=values7'
Expand All @@ -158,11 +158,11 @@ describe('Test create channels', () => {
cy.get('[placeholder="Enter channel name"]').type('test-sns-channel');

cy.get('.euiSuperSelectControl').contains('Slack').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text')
.contains('Amazon SNS')
.click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);

cy.get('[data-test-subj="sns-settings-topic-arn-input"]').type(
'arn:aws:sns:us-west-2:123456789012:notifications-test'
Expand All @@ -179,7 +179,7 @@ describe('Test create channels', () => {
describe('Test channels table', () => {
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/${NOTIFICATIONS_PLUGIN_NAME}#channels`);
cy.wait(delay * 3);
cy.wait(NOTIFICATIONS_DELAY * 3);
});

it('displays channels', () => {
Expand All @@ -192,13 +192,13 @@ describe('Test channels table', () => {
it('mutes channels', () => {
cy.get('.euiCheckbox__input[aria-label="Select this row"]').eq(0).click(); // chime channel
cy.get('.euiButton__text').contains('Actions').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('.euiContextMenuItem__text').contains('Mute').click({ force: true });
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.get('[data-test-subj="mute-channel-modal-mute-button"]').click({
force: true,
});
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.contains('successfully muted.').should('exist');
cy.contains('Muted').should('exist');
});
Expand All @@ -207,7 +207,7 @@ describe('Test channels table', () => {
cy.get('input[placeholder="Search"]')
.type('chime{enter}')
.trigger('search');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.contains('Test chime channel').should('exist');
cy.contains('Test slack channel').should('not.exist');
cy.contains('Test email channel').should('not.exist');
Expand All @@ -216,7 +216,7 @@ describe('Test channels table', () => {
cy.get('input[placeholder="Search"]')
.type('Source{enter}')
.trigger('search');
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.contains('No channels to display').should('exist');
});
});
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('Test channel details', () => {
cy.get('.euiTextArea').type(
'{selectall}{backspace}Updated custom webhook description'
);
cy.wait(delay);
cy.wait(NOTIFICATIONS_DELAY);
cy.contains('Save').click({ force: true });

cy.contains('successfully updated.').should('exist');
Expand Down
Loading

0 comments on commit e1c41f6

Please sign in to comment.