dockercypress-component-testing

I am trying to run my component tests on docker on windows OS, but it by default picks my tests from e2e


I am trying to run my vue3 component tests on docker, for which I have created below image. enter image description here

image version: 10.5.0 cypress version: 13.7.3 OS: Windows 10

enter image description here

it runs my component tests from command prompt with below command: npx cypress run --component

But, when I try to run through docker using file as seen above, it by default picks my e2e tests and runs instead of my component tests.(dockerfile command: CMD ["npm","run","npx cypress run --component"])

Please guide me.

I tried multiple attampts of creating images in docker, and also tried with changing versions.


Solution

  • It worked with below dockerfile.. Have changed my command there..

    Old docker command: CMD ["npm", "run", "npx cypress run --component"]//not working

    New solution: CMD ["npm", "run", "npx cypress run", "--component"] //working

    Docker file below works fine for me now. I can test my Vue3 component tests from Cypress in docker.

    enter image description here

    After adding this Dockerfile to Cypress root project, please execute below through terminal:

    1. docker build -t ImageName . //ImageName is docker image name
    2. docker run -it ImageName