Skip to content

Commit

Permalink
dev: fix e2e and docs (#1388)
Browse files Browse the repository at this point in the history
* docs: replace docz with docusaurus
  • Loading branch information
silviuaavram authored Jul 25, 2022
1 parent 26c93a5 commit 05aecb4
Show file tree
Hide file tree
Showing 28 changed files with 401 additions and 358 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: ${{ !contains(github.head_ref, 'all-contributors') }}
strategy:
matrix:
node: [12]
node: [16]
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
Expand Down
17 changes: 15 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ dist
.DS_Store
.next
.eslintcache
.docz
storybook-static
preact/

cypress/videos
Expand All @@ -18,3 +16,18 @@ cypress/screenshots
package-lock.json
yarn.lock
flow-coverage/

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
registry=http://registry.npmjs.org/
registry=https://registry.npmjs.org/
package-lock=false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10
16.14.0
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ dist/
preact/
package-lock.json
package.json
docs/
4 changes: 3 additions & 1 deletion .babelrc.js → babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ const customPreset = api => {
api.cache(true)
const evaluatedPreset = originalPreset(api)
const plugins = [
require.resolve('babel-plugin-dynamic-import-node'),
['no-side-effect-class-properties'],
...evaluatedPreset.plugins,
]
const presets = [...evaluatedPreset.presets]
return {
...evaluatedPreset,
presets,
plugins,
}
}
Expand Down
8 changes: 8 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const {defineConfig} = require('cypress')

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:6006',
video: false,
},
})
4 changes: 0 additions & 4 deletions cypress.json

This file was deleted.

24 changes: 11 additions & 13 deletions cypress/integration/combobox.js → cypress/e2e/combobox.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const bodyY = 500

describe('combobox', () => {
before(() => {
cy.visit('/')
cy.findByText(/^Tests$/).click()
cy.findByText(/^Combobox$/).click()
cy.visit('/combobox')
})

beforeEach(() => {
Expand Down Expand Up @@ -56,7 +54,7 @@ describe('combobox', () => {
.type('{downarrow}{enter}') // open and select first item
.should('have.value', 'Black')
.get('body')
.click(bodyX, bodyY)
.click(bodyX, bodyY, {force: true})
.findByTestId('combobox-input')
.should('have.value', 'Black')
})
Expand All @@ -76,12 +74,12 @@ describe('combobox', () => {
.should('have.value', 'R')
.click()
.get('body')
.trigger('mouseup', bodyX, bodyY)
.trigger('mouseup', bodyX, bodyY, {force: true})
.findByTestId('combobox-input')
.should('have.value', 'R')
.blur()
.get('body')
.trigger('click', bodyX, bodyY)
.trigger('click', bodyX, bodyY, {force: true})
.findByTestId('combobox-input')
.should('have.value', 'Red')
})
Expand All @@ -99,13 +97,13 @@ describe('combobox', () => {

it('does not reset when tabbing from input to the toggle button', () => {
cy.findByTestId('combobox-input').type('pu')
cy.findByTestId('toggle-button').focus()
cy.findByTestId('combobox-toggle-button').focus()
cy.findByTestId('downshift-item-0').click()
cy.findByTestId('combobox-input').should('have.value', 'Purple')
})

it('does not reset when tabbing from the toggle button to the input', () => {
cy.findByTestId('toggle-button').click()
cy.findByTestId('combobox-toggle-button').click()
cy.findByTestId('combobox-input').focus()
cy.findByTestId('downshift-item-0').click()
cy.findByTestId('combobox-input').should('have.value', 'Black')
Expand All @@ -115,18 +113,18 @@ describe('combobox', () => {
cy.findByTestId('combobox-input')
.type('re')
.get('body')
.trigger('touchstart', bodyX, bodyY)
.trigger('touchend', bodyX, bodyY)
.trigger('touchstart', bodyX, bodyY, {force: true})
.trigger('touchend', bodyX, bodyY, {force: true})
cy.findByTestId('downshift-item-0', {timeout: 10}).should('not.exist')
})

it('does not reset when swiping outside to scroll a touch screen', () => {
cy.findByTestId('combobox-input')
.type('re')
.get('body')
.trigger('touchstart', bodyX, bodyY)
.trigger('touchmove', bodyX, bodyY + 20)
.trigger('touchend', bodyX, bodyY + 20)
.trigger('touchstart', bodyX, bodyY, {force: true})
.trigger('touchmove', bodyX, bodyY + 20, {force: true})
.trigger('touchend', bodyX, bodyY + 20, {force: true})
cy.findByTestId('downshift-item-0', {timeout: 10}).should('be.visible')
})
})
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
describe('useCombobox', () => {
before(() => {
cy.visit('/')
cy.findByText(/^Tests$/).click()
cy.findByText(/^useCombobox$/, {
selector: '[href="/tests/use-combobox"]',
}).click()
cy.visit('/useCombobox')
})

it('should keep focus on the input when selecting by click', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
describe('useSelect', () => {
before(() => {
cy.visit('/')
cy.findByText(/^Tests$/).click()
cy.findByText(/^useSelect$/, {selector: '[href="/tests/use-select"]'}).click()
cy.visit('/useSelect')
})

it('can open and close a menu', () => {
Expand Down
File renamed without changes.
16 changes: 0 additions & 16 deletions docs/index.mdx

This file was deleted.

104 changes: 0 additions & 104 deletions docs/tests/combobox.js

This file was deleted.

11 changes: 0 additions & 11 deletions docs/tests/combobox.mdx

This file was deleted.

59 changes: 0 additions & 59 deletions docs/tests/useCombobox.js

This file was deleted.

11 changes: 0 additions & 11 deletions docs/tests/useCombobox.mdx

This file was deleted.

Loading

0 comments on commit 05aecb4

Please sign in to comment.