-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Barthélémy Ledoux
authored
Mar 31, 2021
1 parent
651df1b
commit adc2fc8
Showing
37 changed files
with
615 additions
and
246 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 |
---|---|---|
@@ -1,72 +1,11 @@ | ||
// @ts-check | ||
const { startDevServer } = require('@cypress/webpack-dev-server') | ||
const path = require('path') | ||
const babelConfig = require('../../babel.config.js') | ||
|
||
/** @type import("webpack").Configuration */ | ||
const webpackConfig = { | ||
resolve: { | ||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.scss', '.css'], | ||
}, | ||
mode: 'development', | ||
devtool: false, | ||
output: { | ||
publicPath: '/', | ||
chunkFilename: '[name].bundle.js', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js|jsx|mjs|ts|tsx)$/, | ||
loader: 'babel-loader', | ||
options: { ...babelConfig, cacheDirectory: path.resolve(__dirname, '..', '..', '.babel-cache') }, | ||
}, | ||
{ | ||
test: /\.modules?\.s[ac]ss$/i, | ||
exclude: [/node_modules/], | ||
use: [ | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
modules: true, | ||
}, | ||
}, | ||
'sass-loader', | ||
], | ||
}, | ||
{ | ||
test: /\.s[ac]ss$/i, | ||
exclude: [/node_modules/, /\.modules?\.s[ac]ss$/i], | ||
use: ['style-loader', 'css-loader', 'sass-loader'], | ||
}, | ||
{ | ||
// some of our examples import SVG | ||
test: /\.svg$/, | ||
loader: 'svg-url-loader', | ||
}, | ||
{ | ||
// some of our examples import SVG | ||
test: /\.svg$/, | ||
loader: 'svg-url-loader', | ||
}, | ||
{ | ||
test: /\.(png|jpg)$/, | ||
use: ['file-loader'], | ||
}, | ||
{ | ||
test: /\.(svg|eot|woff|woff2|ttf)$/, | ||
use: ['file-loader'], | ||
}, | ||
], | ||
}, | ||
} | ||
const { startDevServer } = require('@cypress/vite-dev-server') | ||
|
||
/** | ||
* @type Cypress.PluginConfig | ||
*/ | ||
module.exports = (on, config) => { | ||
on('dev-server:start', (options) => startDevServer({ options, webpackConfig, disableLazyCompilation: false })) | ||
on('dev-server:start', (options) => startDevServer({ options })) | ||
|
||
return config | ||
} |
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,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>AUT Frame</title> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// This file is merged in a <script type=module> into index.html | ||
// it will be used to load and kick start the selected spec | ||
|
||
const supportPath = import.meta.env.__cypress_supportPath | ||
const originAutUrl = import.meta.env.__cypress_originAutUrl | ||
|
||
const specPath = window.location.pathname.replace(originAutUrl, '') | ||
|
||
const importsToLoad = [() => import(/* @vite-ignore */ specPath)] | ||
|
||
if (supportPath) { | ||
importsToLoad.unshift(() => import(/* @vite-ignore */ supportPath)) | ||
} | ||
|
||
const CypressInstance = window.Cypress = parent.Cypress | ||
|
||
if (!CypressInstance) { | ||
throw new Error('Tests cannot run without a reference to Cypress!') | ||
} | ||
|
||
// load the support and spec | ||
CypressInstance.onSpecWindow(window, importsToLoad) | ||
|
||
// then start the test process | ||
CypressInstance.action('app:window:before:load', window) | ||
|
||
// Before all tests we are mounting the root element, | ||
// Cleaning up platform between tests is the responsibility of the specific adapter | ||
// because unmounting react/vue component should be done using specific framework API | ||
// (for devtools and to get rid of global event listeners from previous tests.) | ||
CypressInstance.on('test:before:run', () => { | ||
// leave the error overlay alone if it exists | ||
if (document.body.querySelectorAll('vite-error-overlay').length) { | ||
// make the error more readable by giving it more space | ||
Cypress.action('cy:viewport:changed', { viewportWidth: 1000, viewportHeight: 500 }) | ||
|
||
return | ||
} | ||
|
||
// reset the viewport to default when in normal mode | ||
Cypress.action('cy:viewport:changed', { | ||
viewportWidth: Cypress.config('viewportWidth'), | ||
viewportHeight: Cypress.config('viewportHeight'), | ||
}) | ||
}) | ||
|
||
// Make usage of node test plugins possible | ||
window.global = window |
This file was deleted.
Oops, something went wrong.
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 React from 'react' | ||
import './foo.css' | ||
import logo from './logo.png' | ||
|
||
export const Foo: React.FC = () => { | ||
return (<> | ||
<div>Hello world!!!!</div> | ||
<img src={logo} /> | ||
</>) | ||
} |
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 @@ | ||
div{ | ||
color: white; | ||
background: hotpink; | ||
padding: 20px; | ||
text-align: center; | ||
} | ||
|
||
img{ | ||
width:50%; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
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
41 changes: 41 additions & 0 deletions
41
npm/vite-dev-server/cypress/components/vue/Card/Card.spec.js
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,41 @@ | ||
// In this test file we demo how to test a component with slots and a scoped slot. | ||
|
||
// Usage is the same as Vue Test Utils, since slots and scopedSlots | ||
// in the render options are directly passed through to the Utils mount(). | ||
|
||
/// <reference types="cypress" /> | ||
import { mount } from '@cypress/vue' | ||
|
||
import Card from './Card.vue' | ||
|
||
describe('Card', () => { | ||
it('skipped slots', () => { | ||
mount(Card) | ||
cy.contains('Nothing used the Scoped content!').should('be.visible') | ||
}) | ||
|
||
it('renders slots', () => { | ||
mount(Card, { | ||
slots: { | ||
header: '<h1>HEADER</h1>', | ||
footer: '<div>FOOTER</div>', | ||
}, | ||
}) | ||
|
||
cy.contains('h1', 'HEADER') | ||
cy.contains('div', 'FOOTER') | ||
}) | ||
|
||
it('renders scopedSlots', () => { | ||
mount(Card, { | ||
slots: { | ||
default: `<template #default="props"> | ||
<p>Yay! {{props.content}}</p> | ||
</template>`, | ||
}, | ||
}) | ||
|
||
cy.contains('Yay! Scoped content!').should('be.visible') | ||
cy.contains('Nothing used the Scoped content!').should('not.exist') | ||
}) | ||
}) |
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,24 @@ | ||
<template> | ||
<div class="card"> | ||
<img src="./logo.png" /> | ||
<slot name="header" /> | ||
<slot :content="content"> | ||
<!-- Fallback content if no default slot is given --> | ||
<p>Nothing used the {{ content }}</p> | ||
</slot> | ||
<slot name="footer" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
// example from https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/components/Card.vue | ||
// For the sake of demoing scopedSlots, this Card component | ||
// passes a simple string down to its default slot. | ||
export default { | ||
data() { | ||
return { | ||
content: "Scoped content!", | ||
}; | ||
}, | ||
}; | ||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
adc2fc8
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.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
adc2fc8
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.
AppVeyor has built the
win32 ia32
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
adc2fc8
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.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: