Skip to content

Commit 98a9c06

Browse files
lmiller1990JessicaSachstgriesser
authored
feat(unification): adding specs list for the app (#18391)
* wip * wip * Adding required icons and strings for spec list * adding icons with some duplication * wip * fixing the colors and classes * removing the Icon from usage in the button and input * green => jade * wip * Fixes * wip * merge * fixing no projects state * Adding better spec pattern parsing * Adding routing for the runner * adding more tests * update tests * chore: lint * update types * types * chore: align vue-i18n version * update findSpecs * remove old spec * omit new properties returned from findSpecs * fix test * use different type Co-authored-by: Jessica Sachs <jess@jessicasachs.io> Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
1 parent db3e7b3 commit 98a9c06

File tree

118 files changed

+1459
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1459
-273
lines changed

apollo.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports = {
99
localSchemaFile: path.join(__dirname, 'packages/graphql/schemas/schema.graphql'),
1010
},
1111
tagName: 'gql',
12-
includes: [path.join(__dirname, 'packages/launchpad/src/**/*.vue')],
12+
includes: [path.join(__dirname, 'packages/{launchpad,app}/src/**/*.vue')],
1313
},
1414
}

packages/app/.windicss/icon-color-plugins.ts

Lines changed: 0 additions & 107 deletions
This file was deleted.

packages/app/.windicss/safelist.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/app/cypress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"openMode": 0
1010
},
1111
"nodeVersion": "system",
12-
"testFiles": "**/*.spec.{js,ts,tsx,jsx}",
12+
"testFiles": "**/*.spec.{j,ts,tsx,jsx}",
1313
"reporter": "../../node_modules/cypress-multi-reporters/index.js",
1414
"reporterOptions": {
1515
"configFile": "../../mocha-reporter-config.json"
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// @ts-nocheck
2+
// @ts-ignore
3+
import * as JustMyLuck from 'just-my-luck'
4+
import faker from 'faker'
5+
import { template, keys, reduce, templateSettings } from 'lodash'
6+
import combineProperties from 'combine-properties'
7+
8+
templateSettings.interpolate = /{{([\s\S]+?)}}/g
9+
10+
let jml
11+
const setupSeeds = () => {
12+
const seed = 2
13+
14+
faker.seed(seed)
15+
jml = new JustMyLuck(JustMyLuck.MersenneTwister(seed))
16+
}
17+
18+
setupSeeds()
19+
20+
beforeEach(() => setupSeeds)
21+
22+
/**
23+
* Component Naming Fixtures
24+
*/
25+
export const modifiers = [
26+
'Async',
27+
'Dynamic',
28+
'Static',
29+
'Virtual',
30+
'Lazy',
31+
]
32+
33+
export const domainModels = [
34+
'Person',
35+
'Product',
36+
'Spec',
37+
'Settings',
38+
'Account',
39+
'Login',
40+
'Logout',
41+
'Launchpad',
42+
'Wizard',
43+
]
44+
45+
export const componentNames = [
46+
'List',
47+
'Table',
48+
'Header',
49+
'Footer',
50+
'Button',
51+
'Cell',
52+
'Row',
53+
'Skeleton',
54+
'Loader',
55+
'Layout',
56+
]
57+
58+
export const specPattern = ['.spec', '_spec']
59+
60+
export const fileExtension = ['.tsx', '.jsx', '.ts', '.js']
61+
62+
export const directories = {
63+
rootDedicated: template('tests'),
64+
rootSrc: template('src'),
65+
monorepo: template('packages/{{component}}/test'),
66+
jestRoot: template('__test__'),
67+
jestNestedLib: template('lib/{{component}}{{component2}}/__test__'),
68+
dedicatedNested: template('lib/{{component}}/test'),
69+
jestNested: template('src/{{component}}/__test__'),
70+
componentsNested: template('src/components/{{component}}'),
71+
componentsFlat: template('src/{{component}}'),
72+
viewsFlat: template('src/views'),
73+
frontendFlat: template('frontend'),
74+
frontendComponentsFlat: template('frontend/components'),
75+
}
76+
77+
const nameTemplates = {
78+
// Business Logic Components
79+
longDomain: template(`{{prefix}}{{modifier}}{{domain}}{{component}}`),
80+
longDomain2: template(`{{prefix}}{{domain}}{{component}}{{component2}}`),
81+
82+
// App Components
83+
page1: template(`{{domain}}Page`),
84+
layout: template(`{{domain}}Layout`),
85+
86+
presentationalShort: template(`Base{{component}}`),
87+
presentationalLong: template(`Base{{component}}{{component2}}`),
88+
medium1: template(`{{prefix}}{{modifier}}{{component}}`),
89+
medium2: template(`{{prefix}}{{component}}{{component2}}`),
90+
short: template(`{{prefix}}{{component}}`),
91+
}
92+
93+
const prefixes = ['I', 'V', 'Cy', null]
94+
95+
export const componentNameGenerator = (options: { template: any, omit: any, overrides: any } = { template: nameTemplates.medium1, omit: [], overrides: {} }) => {
96+
const withoutValues = reduce(options.omit, (acc, v) => {
97+
acc[v] = null
98+
99+
return acc
100+
}, {})
101+
102+
const components = jml.pickCombination(componentNames, 2)
103+
const defaultOptions = {
104+
modifier: jml.pick(modifiers),
105+
domain: jml.pick(domainModels),
106+
prefix: jml.pick(prefixes),
107+
component: components[0],
108+
component2: components[1],
109+
}
110+
111+
return options.template({
112+
...defaultOptions,
113+
...withoutValues,
114+
...options.overrides,
115+
})
116+
}
117+
118+
const allRandomComponents = combineProperties({
119+
domain: domainModels,
120+
modifier: modifiers,
121+
prefix: prefixes,
122+
component: componentNames,
123+
component2: componentNames,
124+
fileExtension,
125+
specPattern,
126+
directory: keys(directories),
127+
})
128+
129+
export const randomComponents = (n = 200) => {
130+
return faker.random.arrayElements(allRandomComponents, n).map((d) => {
131+
const name = componentNameGenerator({
132+
overrides: d,
133+
template: faker.random.objectElement(nameTemplates),
134+
})
135+
136+
const gitFileState = jml.pick(['modified', 'unmodified', 'added', 'deleted'])
137+
138+
return {
139+
componentName: name,
140+
relativePath: directories[d.directory](d),
141+
specExtension: d.specPattern,
142+
fileExtension: d.fileExtension,
143+
name: `${name}${d.specPattern}${d.fileExtension}`,
144+
id: faker.datatype.uuid(),
145+
gitInfo: {
146+
comitter: gitFileState ? faker.internet.userName() : undefined,
147+
timeAgo: gitFileState ? faker.datatype.datetime() : undefined,
148+
fileState: gitFileState,
149+
},
150+
}
151+
}, n)
152+
}

packages/app/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@intlify/vite-plugin-vue-i18n": "2.4.0",
2929
"@packages/frontend-shared": "0.0.0-development",
3030
"@testing-library/cypress": "8.0.0",
31+
"@types/faker": "5.5.8",
3132
"@urql/core": "2.3.1",
3233
"@urql/vue": "0.4.3",
3334
"@vitejs/plugin-vue": "1.2.4",
@@ -36,11 +37,14 @@
3637
"@windicss/plugin-interaction-variants": "1.0.0",
3738
"bluebird": "3.5.3",
3839
"classnames": "2.3.1",
40+
"combine-properties": "0.1.0",
3941
"concurrently": "^6.2.0",
4042
"cross-env": "6.0.3",
43+
"faker": "5.5.3",
4144
"graphql": "^15.5.1",
4245
"graphql-tag": "^2.12.5",
4346
"javascript-time-ago": "2.3.8",
47+
"just-my-luck": "3.0.0",
4448
"prismjs": "1.24.0",
4549
"rimraf": "3.0.2",
4650
"rollup-plugin-polyfill-node": "^0.7.0",
@@ -55,7 +59,7 @@
5559
"vite-plugin-windicss": "1.2.4",
5660
"vite-svg-loader": "2.1.1",
5761
"vue": "3.2.6",
58-
"vue-i18n": "9.2.0-beta.1",
62+
"vue-i18n": "9.2.0-beta.7",
5963
"vue-prism-component": "2.0.0",
6064
"vue-prism-editor": "^2.0.0-alpha.2",
6165
"vue-router": "4",

packages/app/src/Foo.spec.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import Foo from './Foo.vue'
44
describe('Foo', () => {
55
it('renders something', () => {
66
cy.mountFragment(FooFragmentDoc, {
7+
onResult: (ctx) => {
8+
return ctx
9+
},
710
render: (gqlVal) => {
811
return <Foo gql={gqlVal} />
912
},
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)