Skip to content

Commit

Permalink
refactor: Add GitDataSource, FileDataSource, toast for errors (#18385)
Browse files Browse the repository at this point in the history
* refactor: Add GitDataSource, FileDataSource, toast for errors

* Fix

* fix

* Fix: use frontend-shared for common optimizeDeps

* schema/type fixes

* add debug for circle job

* add debug for circle job

* Attempting to debug CI flake

* Fix types

* Attempt to fix

* Revert "Attempt to fix"

This reverts commit 12a8db4.

* Just use more parallelization?

* See if this fixes it

* remove debug

* Force browser relaunch?

* use internal ENV var
  • Loading branch information
tgriesser authored Oct 8, 2021
1 parent 98a9c06 commit bda7e5e
Show file tree
Hide file tree
Showing 30 changed files with 340 additions and 267 deletions.
9 changes: 8 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,16 @@ commands:
description: ct or e2e
type: enum
enum: ['ct', 'e2e']
debug:
description: debug option
type: string
default: ''
steps:
- restore_cached_workspace
- run:
command: |
DEBUG=<<parameters.debug>> \
CYPRESS_INTERNAL_FORCE_BROWSER_RELAUNCH='true' \
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$TEST_LAUNCHPAD_RECORD_KEY \
yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --record --parallel --group <<parameters.package>>-<<parameters.type>>
Expand Down Expand Up @@ -1184,12 +1190,13 @@ jobs:

run-launchpad-component-tests-chrome:
<<: *defaults
parallelism: 3
parallelism: 7
steps:
- run-new-ui-tests:
browser: chrome
package: launchpad
type: ct
# debug: cypress:*,engine:socket

run-launchpad-integration-tests-chrome:
<<: *defaults
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"@types/detect-port": "^1.3.1",
"@types/enzyme-adapter-react-16": "1.0.5",
"@types/execa": "0.9.0",
"@types/fluent-ffmpeg": "^2.1.18",
"@types/fs-extra": "^8.0.1",
"@types/getenv": "^1.0.0",
"@types/glob": "7.1.1",
Expand Down
26 changes: 1 addition & 25 deletions packages/app/cypress/component/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @type {import('@cypress/vite-dev-server')}
*/
const { startDevServer } = require('@cypress/vite-dev-server')

/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
Expand All @@ -20,23 +15,4 @@ const { startDevServer } = require('@cypress/vite-dev-server')
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

if (config.testingType === 'component') {
on('dev-server:start', async (options) => {
return startDevServer({
options,
viteConfig: {
// TODO(tim): Figure out why this isn't being picked up
optimizeDeps: {
include: ['@headlessui/vue'],
},
},
})
})
}

return config // IMPORTANT to return a config
}
module.exports = require('@packages/frontend-shared/cypress/plugins/index')
43 changes: 32 additions & 11 deletions packages/data-context/src/DataContext.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import type { LaunchArgs, OpenProjectLaunchOptions } from '@packages/types'
import type { AppApiShape, ProjectApiShape } from './actions'
import type { NexusGenAbstractTypeMembers } from '@packages/graphql/src/gen/nxs.gen'
import type { AuthApiShape } from './actions/AuthActions'
import debugLib from 'debug'
import fsExtra from 'fs-extra'
import type { AuthApiShape } from './actions/AuthActions'
import { CoreDataShape, makeCoreData } from './data/coreDataShape'
import { DataActions } from './DataActions'
import { AppDataSource } from './sources/AppDataSource'
import { ProjectDataSource } from './sources/ProjectDataSource'
import {
AppDataSource,
GitDataSource,
FileDataSource,
ProjectDataSource,
WizardDataSource,
BrowserDataSource,
UtilDataSource,
} from './sources/'
import { cached } from './util/cached'
import { WizardDataSource } from './sources'
import type { AppApiShape, ProjectApiShape } from './actions'
import { makeLoaders } from './data/loaders'
import { BrowserDataSource } from './sources/BrowserDataSource'
import type { NexusGenAbstractTypeMembers } from '@packages/graphql/src/gen/nxs.gen'

export interface DataContextConfig {
launchArgs: LaunchArgs
Expand All @@ -37,8 +41,6 @@ export class DataContext {
this._coreData = config.coreData ?? makeCoreData()
}

loaders = makeLoaders(this)

get launchArgs () {
return this.config.launchArgs
}
Expand All @@ -59,6 +61,21 @@ export class DataContext {
return this.coreData.app.browsers
}

@cached
get util () {
return new UtilDataSource(this)
}

@cached
get file () {
return new FileDataSource(this)
}

@cached
get git () {
return new GitDataSource(this)
}

@cached
get browser () {
return new BrowserDataSource(this)
Expand Down Expand Up @@ -138,6 +155,10 @@ export class DataContext {
}

dispose () {
this.loaders.dispose()
this.util.disposeLoaders()
}

get loader () {
return this.util.loader
}
}
5 changes: 5 additions & 0 deletions packages/data-context/src/actions/FileActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { DataContext } from '..'

export class FileActions {
constructor (private ctx: DataContext) {}
}
4 changes: 2 additions & 2 deletions packages/data-context/src/actions/ProjectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class ProjectActions {
return this
}

async findSpecs (projectRoot: string, specType: Maybe<SpecType>): Promise<FoundSpec[]> {
const config = await this.ctx.loaders.projectConfig(projectRoot)
async findSpecs (projectRoot: string, specType: Maybe<SpecType>) {
const config = await this.ctx.project.getConfig(projectRoot)
const specs = await this.api.findSpecs({
projectRoot,
fixturesFolder: config.fixturesFolder ?? false,
Expand Down
1 change: 1 addition & 0 deletions packages/data-context/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

export * from './AppActions'
export * from './AuthActions'
export * from './FileActions'
export * from './ProjectActions'
export * from './WizardActions'
2 changes: 0 additions & 2 deletions packages/data-context/src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@

export * from './DataEmitter'
export * from './coreDataShape'
export * from './loaders'
export * from './util/'
81 changes: 0 additions & 81 deletions packages/data-context/src/data/loaders.ts

This file was deleted.

105 changes: 0 additions & 105 deletions packages/data-context/src/data/util/gitInfo.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/data-context/src/data/util/index.ts

This file was deleted.

Loading

0 comments on commit bda7e5e

Please sign in to comment.