Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
with:
# Tests are only done on one playground to avoid long testing time
start: yarn local:env:react
env: playground=reactlocal
spec: cypress/integration/local-ui.spec.js
env: playground=local
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,23 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Download the latest stable version of Meilisearch
run: |
curl -L https://install.meilisearch.com | sh
chmod +x meilisearch
- name: Run Meilisearch
run: |
./meilisearch --master-key=masterKey --no-analytics true &
- name: Install dependencies
run: yarn --dev && yarn --cwd ./playgrounds/vue
- name: Run Browser tests
run: yarn --dev && yarn --cwd ./tests/env/react
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a matrix with react, vue, angular and vanilla javascript? Just in case to prevent possible breaking between them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would take a very very long time for the tests to run. I thought maybe run them once a week in a scheduled job but not on every PR. What do you think ?

- name: Setup Meilisearch Index
run: yarn local:env:setup
- name: Run local browser tests
uses: cypress-io/github-action@v2
with:
# Tests are only done on one playground to avoid long testing time
start: yarn playground:vue
env: playground=vue
spec: cypress/integration/search-ui.spec.js
start: yarn local:env:react
env: playground=local
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
14 changes: 1 addition & 13 deletions cypress.env.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
{
"react": {
"host": "http://localhost:1111"
},
"angular": {
"host": "http://localhost:4200"
},
"vue": {
"host": "http://localhost:8080"
},
"javascript": {
"host": "http://localhost:2222"
},
"reactlocal": {
"local": {
"host": "http://localhost:9999"
}
}
85 changes: 0 additions & 85 deletions cypress/integration/local-ui.spec.js

This file was deleted.

47 changes: 12 additions & 35 deletions cypress/integration/search-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ const {
[playground]: { host },
} = Cypress.env()

const HIT_ITEM_CLASS =
playground === 'react' ? '.ais-InfiniteHits-item' : '.ais-Hits-item'
const HIT_ITEM_CLASS = '.ais-InfiniteHits-item'

describe(`${playground} playground test`, () => {
before(() => {
Expand All @@ -17,20 +16,15 @@ describe(`${playground} playground test`, () => {
})

it('Contains stats', () => {
if (playground === 'react') cy.contains('12,546 results')
if (playground === 'angular') cy.contains('12546 results')
cy.contains('15 results')
})

it('Contains filter clear', () => {
if (playground === 'react') cy.contains('Clear all filters')
if (playground === 'angular') cy.contains('Clear refinements')
cy.contains('Clear all filters')
})

it('Contains Genres', () => {
cy.contains('Genres')
cy.contains('Action')
if (playground === 'react') cy.contains('5,554')
if (playground === 'angular') cy.contains('5554')
})

it('Contains searchBar', () => {
Expand All @@ -46,7 +40,7 @@ describe(`${playground} playground test`, () => {
const select = `.ais-SortBy-select`
cy.get(select).select('steam-video-games:recommendationCount:asc')
cy.wait(1000)
cy.get(HIT_ITEM_CLASS).eq(0).contains('Rag Doll Kung Fu')
cy.get(HIT_ITEM_CLASS).eq(0).contains('Deathmatch Classic')
})

it('Sort by default relevancy', () => {
Expand All @@ -57,28 +51,23 @@ describe(`${playground} playground test`, () => {
})

it('click on facets', () => {
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')

const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
cy.get(checkbox).eq(1).click()

if (playground === 'react') cy.contains('1,939')
if (playground === 'angular') cy.contains('1939')

cy.contains('Counter-Strike').should('not.exist')
cy.wait(1000)
cy.get(HIT_ITEM_CLASS).eq(1).contains('Team Fortress Classic')
cy.get(HIT_ITEM_CLASS).eq(1).contains('4.99 $')
})

it('Search', () => {
cy.get('.ais-SearchBox-input').type('orwell')
cy.get('.ais-SearchBox-input').type('Half-Life')
cy.wait(1000)
cy.get(HIT_ITEM_CLASS).eq(0).contains('Orwell')
cy.get(HIT_ITEM_CLASS).eq(0).contains('Late 2016')
cy.get(HIT_ITEM_CLASS).eq(0).contains('Half-Life')
})

it('Unclick on facets', () => {
const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
cy.get(checkbox).eq(0).click()
cy.get(HIT_ITEM_CLASS).eq(0).contains('Orwell')
cy.get(HIT_ITEM_CLASS).eq(0).contains('Half-Life')
})

it('Placeholder Search', () => {
Expand All @@ -88,19 +77,7 @@ describe(`${playground} playground test`, () => {
})

it('Paginate Search', () => {
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')

if (playground === 'react') {
cy.get('.ais-InfiniteHits-loadMore').click()
cy.get(HIT_ITEM_CLASS).should('have.length', 12)
} else {
if (playground === 'vue') {
cy.get('.ais-Pagination-item').eq(3).click()
} else {
cy.get('.ais-Pagination-item--page').eq(1).click()
}

cy.contains('Counter-Strike').should('not.exist')
}
cy.get('.ais-InfiniteHits-loadMore').click()
cy.get(HIT_ITEM_CLASS).should('have.length', 11)
})
})
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
"test:watch": "yarn test --watch",
"test": "jest --runInBand --selectProjects dom --selectProjects node",
"test:build": "yarn build && jest --runInBand --selectProjects build",
"test:e2e:all": "sh scripts/e2e.sh",
"test:e2e:local": "yarn local:env:setup && concurrently --kill-others -s first \"yarn local:env:react\" \"cypress run --env playground=reactlocal --spec 'cypress/integration/local-ui.spec.js'\"",
"test:e2e:local:watch": "yarn local:env:setup && concurrently --kill-others -s first \"yarn local:env:react\" \"cypress open --env playground=reactlocal\"",
"test:e2e": "yarn local:env:setup && concurrently --kill-others -s first \"yarn local:env:react\" \"cypress run --env playground=local \"",
"test:e2e:watch": "yarn local:env:setup && concurrently --kill-others -s first \"yarn local:env:react\" \"cypress open --env playground=local\"",
"test:all": "yarn test:e2e:all && yarn test && test:build",
"test:e2e": "concurrently --kill-others -s first \"yarn playground:vue\" \"cypress run --env playground=vue\"",
"test:e2e:watch": "concurrently --kill-others -s first \"yarn playground:vue\" \"cypress open --env playground=vue\"",
"cy:open": "cypress open",
"playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue serve",
"playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react start",
Expand Down
6 changes: 0 additions & 6 deletions scripts/e2e.sh

This file was deleted.