Skip to content

Commit

Permalink
chore(@dpc-sdp/ripple-test-utils): fix cypress config importing from …
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
dylankelly committed Aug 2, 2023
1 parent e26c8ba commit cf64e63
Show file tree
Hide file tree
Showing 11 changed files with 427 additions and 431 deletions.
22 changes: 22 additions & 0 deletions examples/nuxt-app/cypress.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'dotenv/config'
import { defineConfig } from 'cypress'
import * as rplCypressConfigPkg from '@dpc-sdp/ripple-test-utils'

export default defineConfig({
projectId: 'mie4kg',
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: '**/*.{feature,feature.ts}',
supportFile: false,
supportFolder: './test',
downloadsFolder: './test/downloads',
fixturesFolder: './test/fixtures',
videosFolder: './test/videos',
screenshotsFolder: './test/screenshots',
async setupNodeEvents(on, config) {
await rplCypressConfigPkg.rplCypressConfigPlugin(on, config)
return config
}
},
blockHosts: ['*youtube.com', '*doubleclick.net']
})
31 changes: 0 additions & 31 deletions examples/nuxt-app/cypress.config.ts

This file was deleted.

20 changes: 0 additions & 20 deletions examples/nuxt-app/cypress/support/e2e.ts

This file was deleted.

3 changes: 2 additions & 1 deletion examples/nuxt-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Example Nuxt application for SDP",
"version": "2.1.0-alpha.77",
"license": "Apache-2.0",
"type": "module",
"private": true,
"scripts": {
"dev": "nuxt dev",
Expand All @@ -13,7 +14,7 @@
"start": "node .output/server/index.mjs",
"start:mock": "NUXT_PUBLIC_API_URL=http://localhost:3001 API_PORT=3001 concurrently 'pnpm mockserver' 'pnpm start'",
"mockserver": "nuxt-ripple mock ./test/fixtures -S ./test/fixtures/site/reference.json -R mock-routes.json",
"cy:open": "cypress open --e2e --browser electron --config-file ./node_modules/@dpc-sdp/ripple-test-utils/src/config/cypress.config.ts",
"cy:open": "cypress open --e2e --browser electron",
"cy:run": "cypress run --record",
"test:ci": "NUXT_PUBLIC_API_URL=http://localhost:3001 API_PORT=3001 start-test start tcp:3000 'cy:run'",
"test:integration": "start-test 'NUXT_PUBLIC_API_URL=http://localhost:3001 API_PORT=3001 pnpm dev' 'http-get://localhost:3000/api/tide/site?id=8888' 'cy:open'",
Expand Down
40 changes: 0 additions & 40 deletions examples/nuxt-app/test/support/commands.ts

This file was deleted.

20 changes: 0 additions & 20 deletions examples/nuxt-app/test/support/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---
to: cypress.config.ts
to: cypress.config.mjs
---
import 'dotenv/config'
import { defineConfig } from 'cypress'
import { rplCypressConfigPlugin } from '@dpc-sdp/ripple-test-utils'
import * as rplCypressConfigPkg from '@dpc-sdp/ripple-test-utils'

export default defineConfig({
env: {
searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME
},
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: false,
specPattern: '**/*.{feature,feature.ts}',
async setupNodeEvents (
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
await rplCypressConfigPlugin(on, config)
async setupNodeEvents(on, config) {
await rplCypressConfigPkg.rplCypressConfigPlugin(on, config)
return config
}
},
Expand Down
3 changes: 2 additions & 1 deletion packages/ripple-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Test utils for Ripple sites",
"version": "2.0.0",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/config/index.js",
"exports": {
".": "./dist/config/index.js",
Expand All @@ -22,7 +23,7 @@
"LICENSE"
],
"dependencies": {
"@badeball/cypress-cucumber-preprocessor": "^15.1.5",
"@badeball/cypress-cucumber-preprocessor": "^18.0.2",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"@testing-library/cypress": "^9.0.0",
"cypress": "^12.8.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/ripple-test-utils/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'
import addCucumberPreprocessorPluginPkg from '@badeball/cypress-cucumber-preprocessor'
import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild'
import * as createBundlerDefault from '@bahmutov/cypress-esbuild-preprocessor'
import apiMocking from './apiMock'
import createBundler from '@bahmutov/cypress-esbuild-preprocessor'
import apiMocking from './apiMock.js'
const { addCucumberPreprocessorPlugin } = addCucumberPreprocessorPluginPkg

export const rplCypressConfigPlugin = async (on, config) => {
await addCucumberPreprocessorPlugin(on, config)
const createBundler = createBundlerDefault
on(
'file:preprocessor',
createBundler({
Expand Down
9 changes: 7 additions & 2 deletions packages/ripple-test-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "NodeNext",
"moduleResolution": "Node16",
"rootDir": "./src",
"outDir": "./dist",
"noImplicitAny": false,
"declaration": true,
"jsx": "preserve",
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"types": ["cypress", "node"]
"types": ["cypress", "node"],
"paths": {
"@badeball/cypress-cucumber-preprocessor/*": [
"./node_modules/@badeball/cypress-cucumber-preprocessor/dist/subpath-entrypoints/*"
]
}
},
"exclude": ["step_definitions"]
}
Loading

0 comments on commit cf64e63

Please sign in to comment.