Skip to content

Commit

Permalink
Release/0.3.29 (#111)
Browse files Browse the repository at this point in the history
* feat: new design

* chore: add bootstrap 4

* EPMDJ-5903: Update widget

* EPMDJ-5901: Update extension popup

* feat: options page new design

* chore: delete unnecessary files

* fix(bootstrap-import): add missing styles

* feat: split content-script and iframe widget styles

* feat: add latest uikit styles

* fix(widget): box shadow & top position gap

* fix: widget messing parent page layout & flickering

* fix: options page regex

* refactor(popup): minor conditional rendering fix

* chore: rename content-script-2 folder

* fix(options page): address form logic
Fix message on successful update
Fix needRestart logic

* fix(options page): url address regex
TODO: regex is still flawed, e.g.:
- :0123, :0000 ports will pass validation;
- any number will pass validation (as a whole url);
Replace it with JS validation function

* feat: Add logo to widget

* feat: Add different messages when agent is busy or offline

* fix(popup): layout + agent not registered message

* chore: bump version to 0.3.29

* fix: various text & layout issues

* fix: Options page placeholder and error message

* fix: Popup placeholders and error message

* fix: Start test error layout

* fix: Widget hints and messages

* fix: Remove line breaks

* fix: Update error messages and placeholders

* fix: "Hide Widget" button - uppercase "w"

Co-authored-by: RomanDavlyatshin <davlyatshinra@gmail.com>

* feat(EPMDJ-6320): new admin URL address validator

* feat: add validateBackedAdress rule

* feat: add format for backendAddress field

* feat: install and setup jest

* fix: error in the name validateBackendAdress

* feat: add protocol formatter

* fix: delete restart logic

* fix: update validation

* feat(validateBackendAdress): add tests cases

* fix: correct format to http protocol

* fix: update tests

* fix: update restart logic

* feat: add parse url function

* fix: update error message

* fix(connection-form): update validation

* fix: update layout and error message styles

* fix: error message optional port

Co-authored-by: RomanDavlyatshin <davlyatshinra@gmail.com>

Co-authored-by: Ilia_Solovev1 <49729985+IliaSolovev@users.noreply.github.com>
Co-authored-by: RomanAchilov <dakaktak95@gmail.com>
Co-authored-by: RomanAchilov <41574246+RomanAchilov@users.noreply.github.com>

* fix: SG session action error handling

* fix: popup layout

* fix: Layout

* feat: Move AgentNotFound component to App component

* chore: Sort imports

* fix: Remove the unnecessary block

* feat: Show n/a in coverage for js agent and service group

* fix: double n/a when JS agent is in service group

* fix: test finished - scope coverage n/a for SG

* fix: add  check isMounted before updating state

* feat: finish/abort failed - action-specific error message

* feat: Add specific message for cancel/finish test error

* feat: Add getSessiomErrorMessage function

Co-authored-by: Ilia_Solovev1 <49729985+IliaSolovev@users.noreply.github.com>

* fix: rewrite address validator

Co-authored-by: Ilia_Solovev1 <49729985+IliaSolovev@users.noreply.github.com>
Co-authored-by: RomanAchilov <dakaktak95@gmail.com>
Co-authored-by: RomanAchilov <41574246+RomanAchilov@users.noreply.github.com>
  • Loading branch information
4 people authored Mar 23, 2021
1 parent c6ae630 commit 30c5b49
Show file tree
Hide file tree
Showing 141 changed files with 11,505 additions and 8,763 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"env": {
"browser": true,
"webextensions": true
"webextensions": true,
"jest": true
},
"rules": {
"react/jsx-filename-extension": [2, { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
Expand Down
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Unit - Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runTestsByPath", "${relativeFile}", "-c", "jest.unit.js"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
}
150 changes: 150 additions & 0 deletions __tests__/unit/validate-adress.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import validateAddress, { validatePort, validateDomain, validateProtocol } from '../../src/forms/validators/address';

describe('smoke', () => {
describe('should pass', () => {
test.each([
['http://foo.bar'],
['http://127.0.0.1'],
['http://localhost'],
['https://foo.bar'],
['http://foo.bar/path'],
['http://foo.bar:8090'],
['http://foo-bar.baz'],
['http://привет.рф'],
])('%s', (a) => {
expect(() => validateAddress(a)).not.toThrow();
});
});

describe('should fail', () => {
test.each([
['http:8090'],
['http:/8090'],
['http://foobar'],
['http://999.0.0.1'],
['ftp://foo.bar'],
['http://foo.bar:99999'],
['http://foo.bar:-1'],
['foobar'],
['https://foo..bar'],
['http://f.b'],
['http://foo-bar'],
['http://-привет.рф'],
])('%s', (a) => {
expect(() => validateAddress(a)).toThrow();
});
});
});

describe('protocol validator', () => {
describe('should pass', () => {
test.each([
['http:'],
['https:'],
])('%s', (a) => {
expect(() => validateProtocol(a, ['http:', 'https:'])).not.toThrow();
});
});
describe('should fail', () => {
test.each([
['ftp:'],
])('%s', (a) => {
expect(() => validateProtocol(a, ['http:', 'https:'])).toThrow();
});
});
});

describe('domain validator', () => {
const label63Characters = 'f'.repeat(63);
const domain255Characters = `${label63Characters}.${label63Characters}.${label63Characters}.${label63Characters}`;
describe('should pass', () => {
it('one-letter domain', () => {
expect(() => validateDomain('f.ba')).not.toThrow();
});
it('two-letter domain', () => {
expect(() => validateDomain('fo.ba')).not.toThrow();
});
it('label with a hyphen', () => {
expect(() => validateDomain('fo-oo.bar')).not.toThrow();
});
it('label with uppercase / mixed case letters', () => {
expect(() => validateDomain('FOo.bAr')).not.toThrow();
});
it('label length up to 63 characters', () => {
expect(() => validateDomain(`${label63Characters}.co`)).not.toThrow();
});
it('multiple labels', () => {
expect(() => validateDomain('foo.bar.baz')).not.toThrow();
});
it('total length up to 255 characters (including dots)', () => {
expect(() => validateDomain(domain255Characters)).not.toThrow();
});
it('exception word (localhost)', () => {
expect(() => validateDomain('localhost', ['localhost'])).not.toThrow();
});
it('punicode ("привет.рф" to "xn--b1agh1afp.xn--p1ai")', () => {
expect(() => validateDomain('xn--b1agh1afp.xn--p1ai')).not.toThrow();
});
});

describe('should fail', () => {
it('single letter top-level domain', () => {
expect(() => validateDomain('foo.c')).toThrow();
});
it('label length exceeds 63 characters', () => {
expect(() => validateDomain(`${label63Characters}f.co`)).toThrow();
});
it('label leading hyphen', () => {
expect(() => validateDomain('-foo.bar')).toThrow();
});
it('label trailing hyphen', () => {
expect(() => validateDomain('foo-.bar')).toThrow();
});
it('top-level domain leading digit', () => {
expect(() => validateDomain('foo.9bar')).toThrow();
});
it('total length exceeds 255 (including dots)', () => {
// eslint-disable-next-line max-len
expect(() => validateDomain(`extralength${domain255Characters}`)).toThrow();
});
});
});

describe('port validator', () => {
describe('should pass', () => {
describe('within 1024-65536 range', () => {
test.each([
['1024'],
['8090'],
['65535'],
])('%s', (port) => {
expect(() => validatePort(port)).not.toThrow();
});
});
});
describe('should fail', () => {
describe('outside 1024-65536 range', () => {
test.each([
['-1'],
['1023'],
['65536'],
[Infinity],
[-Infinity],
])('%s', (port) => {
expect(() => validatePort(port)).toThrow();
});
});
describe('not a finite integer', () => {
test.each([
[''],
['8090.9'],
['foo'],
[undefined],
[null],
[NaN],
])('%s', (port) => {
expect(() => validatePort(port)).toThrow();
});
});
});
});
41 changes: 41 additions & 0 deletions jest.unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2020 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
testEnvironment: 'node',
transform: {
'^.+\\.ts?$': 'ts-jest',
},
testMatch: ['**/__tests__/unit/**/*.spec.+(ts|tsx|js)'],
moduleFileExtensions: ['ts', 'js'],
setupFilesAfterEnv: ['jest-extended'],
globals: {
'ts-jest': {
tsConfig: './test.tsconfig.json',
},
},
collectCoverageFrom: ['src/**', '!**/node_modules/**'],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: -10,
},
'**/*.ts': {
branches: 100,
},
},
};
Loading

0 comments on commit 30c5b49

Please sign in to comment.