-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(e2e): create a test studio for e2e tests (#5044)
* chore(e2e): create a test studio for e2e tests * chore(e2e): use correct token * chore(e2e): add basePath to testing studio * chore(e2e): use test-studio as a dependency cleanup packages * chore(e2e): remove unused dependency * chore(e2e): run e2e tests in production build
- Loading branch information
Showing
20 changed files
with
283 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@sanity/eslint-config-studio" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# Compiled Sanity Studio | ||
/dist | ||
|
||
# Temporary Sanity runtime, generated by the CLI on every dev server start | ||
/.sanity | ||
|
||
# Logs | ||
/logs | ||
*.log | ||
|
||
# Coverage directory used by testing tools | ||
/coverage | ||
|
||
# Misc | ||
.DS_Store | ||
*.pem | ||
|
||
# Typescript | ||
*.tsbuildinfo | ||
|
||
# Dotenv and similar local-only files | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Sanity Clean Content Studio | ||
|
||
Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend. | ||
|
||
Now you can do the following things: | ||
|
||
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme) | ||
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme) | ||
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Box, Text} from '@sanity/ui' | ||
import React from 'react' | ||
|
||
export function Branding() { | ||
return ( | ||
<Box padding={3}> | ||
<Text weight="bold">E2E Test Studio™</Text> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "studio-e2e-testing", | ||
"private": true, | ||
"version": "3.18.1", | ||
"license": "MIT", | ||
"author": "Sanity.io <[email protected]>", | ||
"scripts": { | ||
"dev": "sanity dev --port 3339", | ||
"start": "sanity start --port 3339", | ||
"build": "sanity build" | ||
}, | ||
"keywords": [ | ||
"sanity" | ||
], | ||
"dependencies": { | ||
"@sanity/google-maps-input": "^3.0.1", | ||
"@sanity/icons": "^2.4.0", | ||
"@sanity/ui": "^1.7.2", | ||
"@sanity/vision": "3.18.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-is": "^18.2.0", | ||
"sanity": "3.18.1", | ||
"sanity-plugin-mux-input": "^2.2.1", | ||
"sanity-test-studio": "3.18.1", | ||
"styled-components": "^6.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {defineCliConfig} from 'sanity/cli' | ||
import {loadEnvFiles} from '../../scripts/utils/loadEnvFiles' | ||
|
||
loadEnvFiles() | ||
|
||
export default defineCliConfig({ | ||
api: { | ||
projectId: process.env.SANITY_E2E_PROJECT_ID, | ||
dataset: process.env.SANITY_E2E_DATASET, | ||
}, | ||
vite: { | ||
define: { | ||
'process.env.SANITY_E2E_PROJECT_ID': JSON.stringify(process.env.SANITY_E2E_PROJECT_ID), | ||
'process.env.SANITY_E2E_DATASET': JSON.stringify(process.env.SANITY_E2E_DATASET), | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import {defineConfig, definePlugin} from 'sanity' | ||
import {deskTool} from 'sanity/desk' | ||
import {visionTool} from '@sanity/vision' | ||
import {BookIcon} from '@sanity/icons' | ||
import {muxInput} from 'sanity-plugin-mux-input' | ||
import {googleMapsInput} from '@sanity/google-maps-input' | ||
import {imageAssetSource} from 'sanity-test-studio/assetSources' | ||
import {resolveDocumentActions as documentActions} from 'sanity-test-studio/documentActions' | ||
import {resolveInitialValueTemplates} from 'sanity-test-studio/initialValueTemplates' | ||
import {languageFilter} from 'sanity-test-studio/plugins/language-filter' | ||
import {defaultDocumentNode, newDocumentOptions, structure} from 'sanity-test-studio/structure' | ||
import {presenceTool} from 'sanity-test-studio/plugins/presence' | ||
import {copyAction} from 'sanity-test-studio/fieldActions/copyAction' | ||
import {assistFieldActionGroup} from 'sanity-test-studio/fieldActions/assistFieldActionGroup' | ||
import {commentAction} from 'sanity-test-studio/fieldActions/commentFieldAction' | ||
import {customInspector} from 'sanity-test-studio/inspectors/custom' | ||
import {pasteAction} from 'sanity-test-studio/fieldActions/pasteAction' | ||
import {Branding} from './components/Branding' | ||
import {schemaTypes} from './schemas' | ||
|
||
const sharedSettings = definePlugin({ | ||
name: 'sharedSettings', | ||
schema: { | ||
types: schemaTypes, | ||
templates: resolveInitialValueTemplates, | ||
}, | ||
form: { | ||
image: { | ||
assetSources: [imageAssetSource], | ||
}, | ||
}, | ||
studio: { | ||
components: { | ||
logo: Branding, | ||
}, | ||
}, | ||
document: { | ||
actions: documentActions, | ||
inspectors: (prev, ctx) => { | ||
if (ctx.documentType === 'inspectorsTest') { | ||
return [customInspector, ...prev] | ||
} | ||
|
||
return prev | ||
}, | ||
unstable_fieldActions: (prev, ctx) => { | ||
if (['fieldActionsTest', 'stringsTest'].includes(ctx.documentType)) { | ||
return [...prev, commentAction, assistFieldActionGroup, copyAction, pasteAction] | ||
} | ||
|
||
return prev | ||
}, | ||
newDocumentOptions, | ||
}, | ||
plugins: [ | ||
deskTool({ | ||
icon: BookIcon, | ||
name: 'content', | ||
title: 'Content', | ||
structure, | ||
defaultDocumentNode, | ||
}), | ||
languageFilter({ | ||
defaultLanguages: ['nb'], | ||
supportedLanguages: [ | ||
{id: 'ar', title: 'Arabic'}, | ||
{id: 'en', title: 'English'}, | ||
{id: 'nb', title: 'Norwegian (bokmål)'}, | ||
{id: 'nn', title: 'Norwegian (nynorsk)'}, | ||
{id: 'pt', title: 'Portuguese'}, | ||
{id: 'es', title: 'Spanish'}, | ||
], | ||
types: ['languageFilterDebug'], | ||
}), | ||
googleMapsInput({ | ||
apiKey: 'AIzaSyDDO2FFi5wXaQdk88S1pQUa70bRtWuMhkI', | ||
defaultZoom: 11, | ||
defaultLocation: { | ||
lat: 40.7058254, | ||
lng: -74.1180863, | ||
}, | ||
}), | ||
visionTool({ | ||
defaultApiVersion: '2022-08-08', | ||
}), | ||
// eslint-disable-next-line camelcase | ||
muxInput({mp4_support: 'standard'}), | ||
presenceTool(), | ||
], | ||
}) | ||
|
||
export default defineConfig({ | ||
name: 'default', | ||
title: 'studio-e2e-testing', | ||
|
||
projectId: process.env.SANITY_E2E_PROJECT_ID!, | ||
dataset: process.env.SANITY_E2E_DATASET!, | ||
|
||
plugins: [sharedSettings()], | ||
basePath: '/test', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {schemaTypes} from 'sanity-test-studio/schema' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Files placed here will be served by the Sanity server under the `/static`-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2017", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true | ||
}, | ||
"include": ["**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export const STUDIO_DATASET_NAME = 'test' | ||
export const STUDIO_PROJECT_ID = 'ppsg7ml5' | ||
export const STALE_TEST_THRESHOLD_MS = 10000 |
Oops, something went wrong.
2d58099
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
performance-studio – ./
performance-studio.sanity.build
performance-studio-git-next.sanity.build
2d58099
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
test-studio – ./
test-studio.sanity.build
test-studio-git-next.sanity.build