Skip to content

Commit

Permalink
Merge pull request #1885 from skbkontur/smoke-tests
Browse files Browse the repository at this point in the history
Smoke теcт на контролы
  • Loading branch information
wKich authored Feb 25, 2020
2 parents 053d530 + b2855b3 commit 1d28c7a
Show file tree
Hide file tree
Showing 20 changed files with 1,801 additions and 23 deletions.
7 changes: 7 additions & 0 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ object ReactUI_BuildRetailUi : BuildType({
object ReactUI_LintTest : BuildType({
name = "Lint/Test"

artifactRules = "packages/react-ui-smoke-test/temp/reactUIControls.png => smokeReactUI.zip"

vcs {
root(RetailUi)
}
Expand All @@ -282,6 +284,11 @@ object ReactUI_LintTest : BuildType({
type = "jonnyzzz.yarn"
param("yarn_commands", "workspace @skbkontur/react-ui test")
}
step {
name = "Smoke test"
type = "jonnyzzz.yarn"
param("yarn_commands", "workspace react-ui-smoke-test test")
}
}
})

Expand Down
7 changes: 7 additions & 0 deletions packages/react-ui-smoke-test/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
'@babel/preset-env',
'@babel/typescript',
],
plugins: [['@babel/plugin-transform-runtime', { version: '7.8.3' }]],
};
1 change: 1 addition & 0 deletions packages/react-ui-smoke-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temp
21 changes: 21 additions & 0 deletions packages/react-ui-smoke-test/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 SKB Kontur

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions packages/react-ui-smoke-test/cra-template-react-ui/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 SKB Kontur

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions packages/react-ui-smoke-test/cra-template-react-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "cra-template-react-ui",
"version": "0.0.1",
"keywords": [
"react",
"create-react-app",
"template",
"typescript"
],
"description": "The Create React App template with components for smoke test.",
"main": "template.json",
"license": "MIT",
"engines": {
"node": ">=10.0"
},
"files": [
"template",
"template.json"
]
}
11 changes: 11 additions & 0 deletions packages/react-ui-smoke-test/cra-template-react-ui/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"package": {
"dependencies": {
"@testing-library/react": "^9.3.2",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/user-event": "^7.1.2",
"typescript": "~3.7.4",
"@skbkontur/react-icons": "^3.2.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="description" content="Smoke tests for React UI" />
<title>React UI</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="react-ui-page"></div>
<div id="root"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import React from 'react';
import {
Button,
Fias,
FiasAPI,
FiasSearch,
Logotype,
TopBar,
Toast,
Autocomplete,
Center,
Checkbox,
ComboBox,
CurrencyLabel,
DateInput,
DatePicker,
Dropdown,
MenuItem,
MenuSeparator,
MenuHeader,
DropdownMenu,
FxInput,
Gapped,
Group,
Hint,
Input,
Kebab,
Link,
Loader,
Modal,
Paging,
RadioGroup,
Radio,
ScrollContainer,
SidePage,
Spinner,
Sticky,
Switcher,
Tabs,
Textarea,
Token,
TokenInput,
TokenInputType,
Tooltip,
TooltipMenu,
LocaleProvider,
LangCodes,
ThemeProvider,
Toggle,
Select,
} from '@skbkontur/react-ui';
import EditIcon from '@skbkontur/react-icons/Edit';
import { FLAT_THEME } from '@skbkontur/react-ui/lib/theming/themes/FlatTheme';

export const App = () => {
Toast.push('Successfully saved', {
label: 'Cancel',
handler: () => Toast.push('Canceled'),
});

return (
<main>
<Autocomplete source={[]} value={''} onValueChange={() => ({})}/>
<Button>Кнопка</Button>
<Center style={{ background: '#fdd', height: 150 }}>
<div style={{ background: 'black', width: 30, height: 30 }}/>
</Center>
<Checkbox checked={false} onValueChange={() => ({})}>Checkbox</Checkbox>
<ComboBox getItems={q => Promise.resolve([{ value: 1, label: 'First' }])}/>
<CurrencyLabel value={12356.1} currencySymbol={'₽'}/>
<DateInput/>
<DatePicker value={''} onValueChange={() => ({})}/>
<Dropdown caption="Click">
<MenuItem onClick={() => alert('Clack')}>Clack</MenuItem>
<MenuSeparator/>
<MenuHeader>Here goes the header</MenuHeader>
<MenuItem onClick={() => alert('Pow')} comment="With comment.">
Pow
</MenuItem>
</Dropdown>
<DropdownMenu caption={<Button use="primary">Открыть меню</Button>}>
<MenuHeader>Заголовок меню</MenuHeader>
<MenuSeparator/>
<MenuItem>Раз</MenuItem>
<MenuItem>Два</MenuItem>
<MenuItem>Три</MenuItem>
<MenuSeparator/>
<MenuItem>Раз</MenuItem>
<MenuItem>Два</MenuItem>
<MenuItem>Три</MenuItem>
</DropdownMenu>
<FxInput onValueChange={() => ({})}/>
<Gapped><Button use="primary">Сохранить</Button><Button>Отмена</Button></Gapped>
<Group><Button use="primary">Hey</Button><Button>Ma</Button></Group>
<Hint text="World">Hello</Hint>
<Input/>
<Kebab size="large">
<MenuItem icon={<EditIcon/>} onClick={() => Toast.push('Nope')}>
Редактировать
</MenuItem>
</Kebab>
<Link>Enabled</Link>
<Loader/>
<MenuItem
href="http://tech.skbkontur.ru/react-ui/"
component={({ href, ...rest }) => <Link to={href} {...rest} />}
>
Awesome link
</MenuItem>
<Modal>
<Modal.Header/>
<Modal.Body/>
<Modal.Footer/>
</Modal>
<Paging activePage={0} onPageChange={() => ({})} pagesCount={12}/>
<RadioGroup>
<Radio value="value"/>
</RadioGroup>
<ScrollContainer>scroll container</ScrollContainer>
<Select onValueChange={() => ({})}/>
<SidePage>
<SidePage.Header/>
<SidePage.Body>
<SidePage.Container>C</SidePage.Container>
</SidePage.Body>
<SidePage.Footer panel/>
</SidePage>
<Spinner type="big" caption="big"/>
<Sticky side="top" getStop={() => null}>{_ => 'Small loan of a million dollars'}</Sticky>
<Switcher items={['One', 'Two', 'Three']}/>
<Tabs value="fuji">
<Tabs.Tab id="fuji">Fuji</Tabs.Tab>
<Tabs.Tab id="tahat">Tahat</Tabs.Tab>
</Tabs>
<Textarea/>
<Toggle/>
<Token>Default</Token>
<TokenInput
type={TokenInputType.Combined}
getItems={_ => Promise.resolve(['First'])}
/>
<Tooltip render={() => <div/>} pos="right top">a</Tooltip>
<TooltipMenu caption={<Button use="primary">Открыть меню</Button>}>
<MenuHeader>Заголовок меню</MenuHeader>
</TooltipMenu>
<LocaleProvider langCode={LangCodes.en_GB}>
<TokenInput
type={TokenInputType.Combined}
getItems={_ => Promise.resolve(['First'])}
/>
</LocaleProvider>
<ThemeProvider value={FLAT_THEME}>
<Input/>
</ThemeProvider>
<Fias baseUrl={'https://api.kontur.ru/fias/v1/'} value={{}} onValueChange={() => ({})}/>
<FiasSearch api={new FiasAPI('https://api.kontur.ru/fias/v1/')}/>
<Logotype suffix="экстерн" color="#F15600"/>
<TopBar>
<TopBar.Start>
<TopBar.ItemStatic>
<Logotype suffix="ui" withWidget/>
</TopBar.ItemStatic>
<TopBar.Item>s</TopBar.Item>
</TopBar.Start>
<TopBar.End>
<TopBar.User userName="Alexander The Great"/>
<TopBar.Divider/>
<TopBar.Logout onClick={() => alert('Logout!')}/>
</TopBar.End>
</TopBar>
</main>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { App } from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
Loading

0 comments on commit 1d28c7a

Please sign in to comment.