Skip to content

Commit

Permalink
Merge pull request #179 from Appsilon/e2e-tests-dashboard
Browse files Browse the repository at this point in the history
Cypress tests for demo dashboard
  • Loading branch information
kamilzyla committed Apr 28, 2023
2 parents 5462707 + d3bd153 commit 18fa702
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,16 @@ jobs:
start: yarn start-e2e-test-app
working-directory: js
record: true
spec: cypress/integration/e2e-test/*.js
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Run Cypress on example Dashboard
if: always()
uses: cypress-io/github-action@v5
with:
start: yarn start-e2e-router-app
working-directory: js
record: true
spec: cypress/integration/dashboard/*.js
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
2 changes: 1 addition & 1 deletion inst/examples/Slider.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ library(shiny.fluent)
ui <- function(id) {
ns <- NS(id)
div(
Slider.shinyInput(ns("slider"), value = 42, min = -100, max = 100),
Slider.shinyInput(ns("slider"), value = 0, min = -100, max = 100),
textOutput(ns("sliderValue"))
)
}
Expand Down
17 changes: 17 additions & 0 deletions js/cypress/integration/dashboard/dashboard.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Dashboard', () => {
it('Slider', () => {
cy.visit('http://localhost:8889/#!/Slider');
const steps = 15;
const arrows = '{rightarrow}'.repeat(steps);
cy.get('.ms-Slider-slideBox')
.focus()
.type(arrows);
cy.contains('Value: 15');
});
it('Dropdown', () => {
cy.visit('http://localhost:8889/#!/Dropdown');
cy.get('.ms-Dropdown-title').click();
cy.get('.ms-Dropdown-item').contains('Option C').click();
cy.contains('Value: C');
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"scripts": {
"lint": "eslint --ext .js,.jsx src cypress",
"start-e2e-test-app": "cd ../inst/examples/e2e-test && Rscript -e 'shiny::runApp(port=8888)'",
"e2e-test": "start-server-and-test start-e2e-test-app http://localhost:8888 'cypress run'"
"e2e-test": "start-server-and-test start-e2e-test-app http://localhost:8888 'cypress run --spec \"cypress/integration/e2e-test/*.js\"'",
"start-e2e-router-app": "cd ../inst/examples/dashboard && Rscript -e 'shiny::runApp(port=8889)'",
"e2e-router": "start-server-and-test start-e2e-router-app http://localhost:8889 'cypress run --config baseUrl=http://localhost:8889 --spec \"cypress/integration/dashboard/*.js\"'"
},
"babel": {
"presets": [
Expand Down

0 comments on commit 18fa702

Please sign in to comment.