Skip to content

Commit 44e2409

Browse files
committed
merge in unified-desktop-gui
2 parents 3f267ad + 469b228 commit 44e2409

File tree

120 files changed

+1900
-489
lines changed

Some content is hidden

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

120 files changed

+1900
-489
lines changed

apollo.config.js

+1-1
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,app}/src/**/*.vue')],
12+
includes: [path.join(__dirname, 'packages/{launchpad,app,frontend-shared}/src/**/*.vue')],
1313
},
1414
}

autobarrel.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"packages/data-context/src/**/*"
66
],
77
"ignore": [
8+
"packages/data-context/src/gen",
89
"packages/graphql/src/stitching",
910
"packages/graphql/src/testing",
1011
"packages/graphql/src/gen"

graphql-codegen.yml

+30-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ config:
4444
DateTime: string
4545
JSON: any
4646
generates:
47+
'./packages/data-context/src/gen/all-operations.gen.ts':
48+
config:
49+
<<: *documentFilters
50+
flattenGeneratedTypes: true
51+
schema: 'packages/graphql/schemas/schema.graphql'
52+
documents:
53+
- './packages/frontend-shared/src/gql-components/**/*.vue'
54+
- './packages/app/src/**/*.vue'
55+
- './packages/launchpad/src/**/*.vue'
56+
plugins:
57+
- add:
58+
content: '/* eslint-disable */'
59+
- 'typescript':
60+
noExport: true
61+
- 'typescript-operations':
62+
noExport: true
63+
- 'typed-document-node'
64+
4765
###
4866
# Generates types for us to infer the correct "source types" when we mock out on the frontend
4967
# This ensures we have proper type checking when we're using cy.mountFragment in component tests
@@ -78,11 +96,15 @@ generates:
7896
# files for useQuery / useMutation, as well as types associated with the fragments
7997
###
8098
'./packages/launchpad/src/generated/graphql.ts':
81-
documents: './packages/launchpad/src/**/*.vue'
99+
documents:
100+
- './packages/launchpad/src/**/*.vue'
101+
- './packages/frontend-shared/src/**/*.vue'
82102
<<: *vueOperations
83103

84104
'./packages/app/src/generated/graphql.ts':
85-
documents: './packages/app/src/**/*.vue'
105+
documents:
106+
- './packages/app/src/**/*.vue'
107+
- './packages/frontend-shared/src/**/*.vue'
86108
<<: *vueOperations
87109

88110
'./packages/frontend-shared/src/generated/graphql.ts':
@@ -94,11 +116,15 @@ generates:
94116
# so we can actually use the document in cy.mountFragment
95117
###
96118
'./packages/launchpad/src/generated/graphql-test.ts':
97-
documents: './packages/launchpad/src/**/*.vue'
119+
documents:
120+
- './packages/launchpad/src/**/*.vue'
121+
- './packages/frontend-shared/src/**/*.vue'
98122
<<: *vueTesting
99123

100124
'./packages/app/src/generated/graphql-test.ts':
101-
documents: './packages/app/src/**/*.vue'
125+
documents:
126+
- './packages/app/src/**/*.vue'
127+
- './packages/frontend-shared/src/**/*.vue'
102128
<<: *vueTesting
103129

104130
'./packages/frontend-shared/src/generated/graphql-test.ts':

npm/create-cypress-tests/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0-development",
44
"description": "Cypress smart installation wizard",
55
"private": false,
6-
"main": "index.js",
6+
"main": "dist/src/main.js",
77
"scripts": {
88
"build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn prepare-copy-templates",
99
"build-prod": "yarn build",
@@ -41,6 +41,10 @@
4141
"snap-shot-it": "7.9.3",
4242
"typescript": "^4.2.3"
4343
},
44+
"files": [
45+
"dist",
46+
"bin"
47+
],
4448
"bin": {
4549
"create-cypress-tests": "dist/src/index.js"
4650
},

npm/create-cypress-tests/src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ export async function main ({ useNpm, ignoreTs, setupComponentTesting, ignoreExa
102102

103103
console.log(`\nHappy testing with ${chalk.green('cypress.io')} 🌲\n`)
104104
}
105+
106+
export { scanFSForAvailableDependency }

packages/app/cypress/e2e/integration/new-spec.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ describe('Button', () => {
3333
const { Primary } = composedStories
3434
mount(<Primary />)
3535
})
36-
36+
3737
it('should render Secondary', () => {
3838
const { Secondary } = composedStories
3939
mount(<Secondary />)
4040
})
41-
41+
4242
it('should render Large', () => {
4343
const { Large } = composedStories
4444
mount(<Large />)
4545
})
46-
46+
4747
it('should render Small', () => {
4848
const { Small } = composedStories
4949
mount(<Small />)
@@ -54,7 +54,7 @@ import Button from "./Button"
5454
5555
describe('<Button />', () => {
5656
it('renders', () => {
57-
see: https://reactjs.org/docs/test-utils.html
57+
// see: https://reactjs.org/docs/test-utils.html
5858
mount(<Button />)
5959
})
6060
})`,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
describe('App', () => {
2+
beforeEach(() => {
3+
cy.setupE2E('component-tests')
4+
5+
cy.initializeApp()
6+
})
7+
8+
it('resolves the runs page', () => {
9+
cy.loginUser()
10+
cy.visitApp()
11+
cy.wait(1000)
12+
cy.get('[href="#/runs"]').click()
13+
cy.get('[data-cy="runs"]')
14+
})
15+
16+
it('shows the loader', () => {
17+
cy.loginUser()
18+
cy.remoteGraphQLIntercept(async (obj) => {
19+
await new Promise((resolve) => setTimeout(resolve, 200))
20+
21+
return obj.result
22+
})
23+
24+
cy.visitApp()
25+
cy.get('[href="#/runs"]').click()
26+
cy.get('[data-cy="runs-loader"]')
27+
cy.get('[data-cy="runs"]')
28+
})
29+
30+
it('when no runs, shows call to action', () => {
31+
cy.loginUser()
32+
cy.remoteGraphQLIntercept(async (obj) => {
33+
// Currently, all remote requests go through here, we want to use this to modify the
34+
// remote request before it's used and avoid touching the login query
35+
if (obj.result.data?.cloudProjectsBySlugs) {
36+
for (const proj of obj.result.data.cloudProjectsBySlugs) {
37+
if (proj.runs?.nodes) {
38+
proj.runs.nodes = []
39+
}
40+
}
41+
}
42+
43+
return obj.result
44+
})
45+
46+
cy.visitApp()
47+
cy.get('[href="#/runs"]').click()
48+
cy.get('[data-cy="no-runs"]')
49+
})
50+
51+
it('when logged out, shows call to action', () => {
52+
cy.visitApp()
53+
cy.get('[href="#/runs"]').click()
54+
cy.contains('Log in').should('exist')
55+
})
56+
57+
it('when no project Id in the config file, shows call to action', () => {
58+
cy.loginUser()
59+
cy.visitApp()
60+
cy.withCtx(async (ctx) => {
61+
await ctx.actions.file.writeFileInProject('cypress.json', '{}')
62+
})
63+
64+
cy.get('[href="#/runs"]').click()
65+
cy.contains('Connect your project').should('exist')
66+
})
67+
})

packages/app/src/layouts/default.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="h-screen overflow-hidden flex flex-row">
3-
<main class="min-w-0 flex-1 border-t border-gray-200 lg:flex">
3+
<main class="h-screen min-w-0 flex-1 border-t border-gray-200 lg:flex">
44
<section
55
aria-labelledby="primary-heading"
66
class="min-w-0 flex-1 h-full flex flex-col overflow-hidden lg:order-last"
@@ -40,7 +40,7 @@
4040

4141
<script lang="ts" setup>
4242
import SidebarNavigation from '../navigation/SidebarNavigation.vue'
43-
import HeaderBar from '@cy/gql-components//HeaderBar.vue'
43+
import HeaderBar from '@cy/gql-components/HeaderBar.vue'
4444
import { useRoute } from 'vue-router'
4545
import { computed } from 'vue'
4646

packages/app/src/main.ts

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { makeUrqlClient } from '@packages/frontend-shared/src/graphql/urqlClient
77
import { createI18n } from '@cy/i18n'
88
import { createRouter } from './router/router'
99
import { createPinia } from './store'
10+
import Toast, { POSITION } from 'vue-toastification'
11+
import 'vue-toastification/dist/index.css'
1012

1113
// set a global so we can run
1214
// conditional code in the vite branch
@@ -16,6 +18,10 @@ window.__vite__ = true
1618

1719
const app = createApp(App)
1820

21+
app.use(Toast, {
22+
position: POSITION.BOTTOM_RIGHT,
23+
})
24+
1925
app.use(urql, makeUrqlClient('app'))
2026
app.use(createRouter())
2127
app.use(createI18n())

packages/app/src/navigation/SidebarNavigation.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="flex relative flex-col flex-1 min-h-0 bg-gray-1000">
33
<div
4-
class="absolute cursor-pointer bg-gray-1000 w-8px bottom-0 top-0 right-0 hover:bg-indigo-300"
4+
class="absolute cursor-pointer bg-gray-800 w-2px hover:w-8px bottom-0 top-0 right-0 hover:bg-indigo-300"
55
@click="mainStore.toggleNavBar"
66
/>
77
<div class="flex flex-col flex-1 pt-5 pb-4 overflow-y-auto">
@@ -41,13 +41,14 @@
4141
import SidebarNavigationRow from './SidebarNavigationRow.vue'
4242
import SpecsIcon from '~icons/cy/test-results_x24'
4343
import CodeIcon from '~icons/cy/code-editor_x24'
44+
import RunsIcon from '~icons/cy/runs_x24'
4445
import SettingsIcon from '~icons/cy/settings_x24'
4546
import { useMainStore } from '../store'
4647
4748
const navigation = [
4849
{ name: 'Home', icon: SpecsIcon, href: '/' },
4950
{ name: 'Specs', icon: CodeIcon, href: '/specs' },
50-
{ name: 'Runs', icon: CodeIcon, href: '/runs' },
51+
{ name: 'Runs', icon: RunsIcon, href: '/runs' },
5152
{ name: 'Settings', icon: SettingsIcon, href: '/settings' },
5253
{ name: 'New Spec', icon: SettingsIcon, href: '/newspec' },
5354
]

packages/app/src/pages/Runs.vue

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
<template>
2-
<div>
3-
<h2>Runs Page</h2>
2+
<div class="relative p-24px h-full overflow-y-scroll">
3+
<TransitionQuickFade>
4+
<RunsSkeleton v-if="query.fetching.value || !query.data.value" />
5+
<RunsPage
6+
v-else
7+
:gql="query.data.value"
8+
/>
9+
</TransitionQuickFade>
410
</div>
511
</template>
612

13+
<script lang="ts" setup>
14+
import { gql, useQuery } from '@urql/vue'
15+
import { RunsDocument } from '../generated/graphql'
16+
import RunsSkeleton from '../runs/RunsSkeleton.vue'
17+
import RunsPage from '../runs/RunsPage.vue'
18+
import TransitionQuickFade from '@cy/components/transitions/TransitionQuickFade.vue'
19+
20+
gql`
21+
query Runs {
22+
...RunsPage
23+
}`
24+
25+
const query = useQuery({ query: RunsDocument })
26+
</script>
27+
728
<route>
829
{
9-
name: "Runs Page",
30+
name: "Runs",
1031
meta: {
1132
title: "Runs"
1233
}

packages/launchpad/src/runs/RunCard.vue packages/app/src/runs/RunCard.vue

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<template>
22
<button
3+
:data-e2e="run.id"
34
class="block w-full overflow-hidden mb-4 border border-gray-100
45
rounded bg-light-50 hocus-default"
56
>
6-
<ListRowHeader>
7-
<template #icon>
8-
<RunIcon :gql="props.gql" />
9-
</template>
7+
<ListRowHeader :icon="icon">
108
<template #header>
119
{{ run.commitInfo?.summary }}
1210
</template>
@@ -40,26 +38,30 @@
4038
</template>
4139
<template #right>
4240
<RunResults
43-
:gql="props.gql"
41+
:gql="run"
4442
/>
4543
</template>
4644
</ListRowHeader>
4745
</button>
4846
</template>
4947

5048
<script lang="ts" setup>
49+
import { computed } from 'vue'
5150
import ListRowHeader from '@cy/components/ListRowHeader.vue'
5251
import { gql } from '@urql/core'
53-
import RunIcon from './RunIcon.vue'
5452
import RunResults from './RunResults.vue'
5553
import type { RunCardFragment } from '../generated/graphql'
56-
import { computed } from 'vue-demi'
54+
import PassedIcon from '~icons/cy/status-passed-solid_x24.svg'
55+
import FailedIcon from '~icons/cy/status-failed-solid_x24.svg'
56+
import ErroredIcon from '~icons/cy/status-errored-solid_x24.svg'
57+
import SkippedIcon from '~icons/cy/status-skipped_x24.svg'
58+
import PendingIcon from '~icons/cy/status-pending_x24.svg'
5759
5860
gql`
5961
fragment RunCard on CloudRun {
6062
id
6163
createdAt
62-
...RunIcon
64+
status
6365
...RunResults
6466
commitInfo {
6567
authorName
@@ -74,6 +76,19 @@ const props = defineProps<{
7476
gql: RunCardFragment
7577
}>()
7678
79+
const ICON_MAP = {
80+
PASSED: PassedIcon,
81+
FAILED: FailedIcon,
82+
TIMEDOUT: ErroredIcon,
83+
ERRORED: ErroredIcon,
84+
OVERLIMIT: ErroredIcon,
85+
CANCELLED: SkippedIcon,
86+
NOTESTS: SkippedIcon,
87+
RUNNING: PendingIcon,
88+
} as const
89+
90+
const icon = computed(() => ICON_MAP[props.gql.status!])
91+
7792
const run = computed(() => props.gql)
7893
7994
</script>

0 commit comments

Comments
 (0)