mirror of
https://github.com/SomboChea/ui
synced 2024-11-28 00:44:30 +07:00
Merge branch '4.x-master' of github.com:verdaccio/ui into 4.x-master
This commit is contained in:
commit
58cb4c7465
22
codecept.conf.js
Normal file
22
codecept.conf.js
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
exports.config = {
|
||||
tests: './test/acceptance/*_test.js',
|
||||
output: './test/acceptance/output',
|
||||
helpers: {
|
||||
Puppeteer: {
|
||||
url: 'http://localhost:8080',
|
||||
// "show": true,
|
||||
chrome: {
|
||||
// headless: false
|
||||
}
|
||||
}
|
||||
},
|
||||
include: {
|
||||
I: './test/acceptance/steps_file.js'
|
||||
},
|
||||
smartWait: 30000,
|
||||
bootstrap: null,
|
||||
plugins: {},
|
||||
mocha: {},
|
||||
name: '@verdaccio/ui-theme'
|
||||
}
|
@ -28,9 +28,10 @@
|
||||
"@verdaccio/eslint-config": "2.0.0",
|
||||
"@verdaccio/types": "7.0.0",
|
||||
"autosuggest-highlight": "3.1.1",
|
||||
"babel-loader": "8.0.6",
|
||||
"bundlesize": "0.18.0",
|
||||
"codeceptjs": "2.1.0",
|
||||
"codecov": "3.5.0",
|
||||
"babel-loader": "8.0.6",
|
||||
"concurrently": "4.1.0",
|
||||
"cross-env": "5.2.0",
|
||||
"css-loader": "0.28.10",
|
||||
@ -136,7 +137,10 @@
|
||||
"type-check": "tsc --noEmit",
|
||||
"type-check:watch": "npm run type-check -- --watch",
|
||||
"release": "standard-version -a -s",
|
||||
"test": "cross-env NODE_ENV=test BABEL_ENV=test TZ=UTC jest --config ./jest/jest.config.js --maxWorkers 2",
|
||||
"test:clean": "npx jest --clearCache",
|
||||
"test:acceptance": "codeceptjs run --steps",
|
||||
"test:acceptance:server": "concurrently --kill-others \"npm run verdaccio:server\" \"npm run test:acceptance\"",
|
||||
"test": "cross-env NODE_ENV=test BABEL_ENV=test TZ=UTC jest --config ./jest/jest.config.js --maxWorkers 2 --passWithNoTests",
|
||||
"test:size": "bundlesize",
|
||||
"lint": "npm run lint:js && npm run lint:css",
|
||||
"lint:js": "npm run type-check && eslint . --ext .js,.ts,.tsx",
|
||||
|
@ -1,11 +1,68 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import Repository from './Repository';
|
||||
jest.mock('./img/git.png', () => '');
|
||||
|
||||
describe('<Repository /> component', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
});
|
||||
|
||||
test('should render the component in default state', () => {
|
||||
const packageMeta = {
|
||||
latest: {
|
||||
repository: {
|
||||
type: 'git',
|
||||
url: 'git+https://github.com/verdaccio/ui.git',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
jest.doMock('../../pages/version/Version', () => ({
|
||||
DetailContextConsumer: component => {
|
||||
return component.children({ packageMeta });
|
||||
},
|
||||
}));
|
||||
|
||||
const Repository = require('./Repository').default;
|
||||
const wrapper = shallow(<Repository />);
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render the component in with no repository data', () => {
|
||||
const packageMeta = {
|
||||
latest: {},
|
||||
};
|
||||
|
||||
jest.doMock('../../pages/version/Version', () => ({
|
||||
DetailContextConsumer: component => {
|
||||
return component.children({ packageMeta });
|
||||
},
|
||||
}));
|
||||
|
||||
const Repository = require('./Repository').default;
|
||||
const wrapper = shallow(<Repository />);
|
||||
expect(wrapper.html()).toEqual('');
|
||||
});
|
||||
|
||||
test('should render the component in with invalid url', () => {
|
||||
const packageMeta = {
|
||||
latest: {
|
||||
repository: {
|
||||
type: 'git',
|
||||
url: 'git://github.com/verdaccio/ui.git',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
jest.doMock('../../pages/version/Version', () => ({
|
||||
DetailContextConsumer: component => {
|
||||
return component.children({ packageMeta });
|
||||
},
|
||||
}));
|
||||
|
||||
const Repository = require('./Repository').default;
|
||||
const wrapper = shallow(<Repository />);
|
||||
expect(wrapper.html()).toEqual('');
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,3 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<Repository /> component should render the component in default state 1`] = `""`;
|
||||
exports[`<Repository /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root-1 MuiList-dense-3 MuiList-padding-2 MuiList-subheader-4\\"><h3 class=\\"MuiTypography-root-5 MuiTypography-subheading-12 css-hyrz44 e1wmjxnh0\\">Repository</h3><li class=\\"MuiListItem-root-41 MuiListItem-default-44 MuiListItem-dense-45 MuiListItem-gutters-49 css-z8a2h0 e1wmjxnh4\\"><div class=\\"MuiAvatar-root-53 MuiAvatar-colorDefault-54\\"></div><div class=\\"MuiListItemText-root-56 MuiListItemText-dense-58\\"><span class=\\"MuiTypography-root-5 MuiTypography-subheading-12 MuiListItemText-primary-59 MuiListItemText-textDense-61\\"><div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-1m8aenu eb8w2fo1\\"><a href=\\"git+https://github.com/verdaccio/ui.git\\" target=\\"_blank\\" class=\\"css-15gl0ho e1wmjxnh2\\">git+https://github.com/verdaccio/ui.git</a></span><button class=\\"MuiButtonBase-root-76 MuiIconButton-root-70 css-56v3u0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label-75\\"><svg class=\\"MuiSvgIcon-root-79\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path fill=\\"none\\" d=\\"M0 0h24v24H0z\\"></path><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span></button></div></span></div></li></ul>"`;
|
||||
|
1
test/acceptance/.gitignore
vendored
Normal file
1
test/acceptance/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output
|
9
test/acceptance/Menu_test.js
Normal file
9
test/acceptance/Menu_test.js
Normal file
@ -0,0 +1,9 @@
|
||||
Feature('Menu');
|
||||
|
||||
Scenario('check if we find the npm commands to set the registry', (I) => {
|
||||
I.amOnPage('http://localhost:8080');
|
||||
I.waitForElement('#header--button-registryInfo', 5);
|
||||
I.click('#header--button-registryInfo');
|
||||
I.waitForElement('#registryInfo--dialog-container');
|
||||
I.see('npm set registry http://localhost:8080');
|
||||
});
|
10
test/acceptance/SearchResult_test.js
Normal file
10
test/acceptance/SearchResult_test.js
Normal file
@ -0,0 +1,10 @@
|
||||
Feature('SearchResult');
|
||||
|
||||
Scenario('check if we get the "no results found" text', (I) => {
|
||||
I.amOnPage('http://localhost:8080');
|
||||
I.seeElement('header .react-autosuggest__input input');
|
||||
I.fillField('header .react-autosuggest__input input', 'test');
|
||||
I.waitForElement('header .react-autosuggest__suggestions-container');
|
||||
I.wait(1);
|
||||
I.see('No results found.', 'header .react-autosuggest__suggestions-container');
|
||||
});
|
11
test/acceptance/steps_file.js
Normal file
11
test/acceptance/steps_file.js
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
// in this file you can append custom step methods to 'I' object
|
||||
|
||||
module.exports = function() {
|
||||
return actor({
|
||||
|
||||
// Define custom steps here, use 'this' to access default methods of I.
|
||||
// It is recommended to place a general 'login' function here.
|
||||
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user