diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0488173..c3935185 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/inst/examples/Slider.R b/inst/examples/Slider.R index 9fcd611d..e6e05662 100644 --- a/inst/examples/Slider.R +++ b/inst/examples/Slider.R @@ -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")) ) } diff --git a/js/cypress/integration/dashboard/dashboard.cy.js b/js/cypress/integration/dashboard/dashboard.cy.js new file mode 100644 index 00000000..200b31ed --- /dev/null +++ b/js/cypress/integration/dashboard/dashboard.cy.js @@ -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'); + }); +}); diff --git a/js/cypress/integration/actionButtons.js b/js/cypress/integration/e2e-test/actionButtons.js similarity index 100% rename from js/cypress/integration/actionButtons.js rename to js/cypress/integration/e2e-test/actionButtons.js diff --git a/js/cypress/integration/deepMixing.js b/js/cypress/integration/e2e-test/deepMixing.js similarity index 100% rename from js/cypress/integration/deepMixing.js rename to js/cypress/integration/e2e-test/deepMixing.js diff --git a/js/cypress/integration/fluentComponents.js b/js/cypress/integration/e2e-test/fluentComponents.js similarity index 100% rename from js/cypress/integration/fluentComponents.js rename to js/cypress/integration/e2e-test/fluentComponents.js diff --git a/js/cypress/integration/reactInShiny.js b/js/cypress/integration/e2e-test/reactInShiny.js similarity index 100% rename from js/cypress/integration/reactInShiny.js rename to js/cypress/integration/e2e-test/reactInShiny.js diff --git a/js/cypress/integration/scenarios.js b/js/cypress/integration/e2e-test/scenarios.js similarity index 100% rename from js/cypress/integration/scenarios.js rename to js/cypress/integration/e2e-test/scenarios.js diff --git a/js/cypress/integration/shimmer.js b/js/cypress/integration/e2e-test/shimmer.js similarity index 100% rename from js/cypress/integration/shimmer.js rename to js/cypress/integration/e2e-test/shimmer.js diff --git a/js/cypress/integration/shinyInReact.js b/js/cypress/integration/e2e-test/shinyInReact.js similarity index 100% rename from js/cypress/integration/shinyInReact.js rename to js/cypress/integration/e2e-test/shinyInReact.js diff --git a/js/cypress/integration/themeProvider.js b/js/cypress/integration/e2e-test/themeProvider.js similarity index 100% rename from js/cypress/integration/themeProvider.js rename to js/cypress/integration/e2e-test/themeProvider.js diff --git a/js/package.json b/js/package.json index 97fb07e7..61a57630 100644 --- a/js/package.json +++ b/js/package.json @@ -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": [