-
Notifications
You must be signed in to change notification settings - Fork 157
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
1 parent
d4ee09e
commit 1a5153c
Showing
12 changed files
with
1,372 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"testFiles": "**/*cy.*", | ||
"componentFolder": "src" | ||
} |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { startDevServer } = require('@cypress/vite-dev-server'); | ||
const vue = require('@vitejs/plugin-vue'); | ||
|
||
module.exports = (on, config) => { | ||
const viteConfig = { | ||
plugins: [vue()], | ||
}; | ||
|
||
viteConfig.esbuild = viteConfig.esbuild || {}; | ||
viteConfig.esbuild.jsxFactory = 'h'; | ||
viteConfig.esbuild.jsxFragment = 'Fragment'; | ||
viteConfig.logLevel = 'error'; | ||
viteConfig.resolve = { | ||
alias: { | ||
vue: 'vue/dist/vue.esm-bundler.js', | ||
}, | ||
}; | ||
|
||
on('dev-server:start', (options) => { | ||
return startDevServer({ options, viteConfig }); | ||
}); | ||
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,41 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
Cypress.Commands.add('drag', { prevSubject: 'element' }, (subject, options) => { | ||
if (options.x && options.y) { | ||
cy.get(subject).trigger('mousedown', { which: 1 }); | ||
cy.document() | ||
.trigger('mousemove', { | ||
pageX: options.x, | ||
pageY: options.y, | ||
}) | ||
.trigger('mouseup', { force: true }); | ||
} | ||
}); | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
Cypress.Commands.overwrite('get', (originalFn, selector, options) => { | ||
if (typeof selector === 'string') { | ||
return originalFn(selector.replace(/cy:(\w+)/g, '[data-cy="$1"]'), options); | ||
} else { | ||
return originalFn(selector, options); | ||
} | ||
}); |
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,23 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; | ||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
beforeEach(() => { | ||
cy.viewport(600, 600, { log: false }); | ||
}); |
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,9 @@ | ||
export function random(min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min; | ||
} | ||
|
||
export function range(length) { | ||
return Array(length) | ||
.fill() | ||
.map((_, i) => i); | ||
} |
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,30 @@ | ||
import { mount } from '@cypress/vue'; | ||
import { SlickList, SlickItem } from './'; | ||
|
||
const wrapper = { | ||
name: 'Wrapper', | ||
components: { | ||
SlickList, | ||
SlickItem, | ||
}, | ||
data() { | ||
return { | ||
list: ['1', '2', '3'], | ||
}; | ||
}, | ||
template: ` | ||
<SlickList v-model:list="list" data-cy="list"> | ||
<SlickItem v-for="(item, i) in list" :key="item" :index="i" data-cy="item"> | ||
Item {{ item }} | ||
</SlickItem> | ||
</SlickList> | ||
`, | ||
}; | ||
|
||
describe('it', () => { | ||
it('works', () => { | ||
mount(wrapper); | ||
cy.get('cy:list cy:item').first().should('contain', 'Item').drag({ x: 80, y: 50 }); | ||
cy.get('cy:list').should('contain', 'Item 2 Item 3 Item 1'); | ||
}); | ||
}); |
Oops, something went wrong.