We are trying to run Cypress using Docker. We can embed the screenshots on failed tests when we run Cypress locally. Is there a way to show the Screenshots taken or failed test using their included Docker image?
Related
I am trying to run a web application implemented with php, js, html together with Selenium to test functionality. I am using a python script together with pytest to run the selenium tests against the web application. The web application is already dockerized with a windows/servercore:ltsc2019 base image and the xampp application. If the dockerfile is build for the first time it succeeds. But if some changes are done and the container has to be rebuilded i get the following error:
Status: failed to copy files: failed to copy directory: chtimes \\?\Volume{06ac6f98-32bd-4e73-b16b-f982f49c7bd6}\xampp\htdocs\img: Access denied
on this Dockerfile step:
Step 2/7 : COPY . C:\\xampp\\htdocs
I am using the already dockerized web application (including docker-compose) and an existing gitlab pipeline. After adding selenium and python services to docker-compose I found out that they are only available on linux containers so I switched the docker engine to experimental to make use of the mixed mode. And that was working just fine for my pc at work (I tested it there). But then I used the same docker-compose file on my home pc and I got the error from above. Also on the gitlab-runner that runs the pipeline the same error occured after modifying the pipeline slightly (Added point 2-4).
Run web application container
docker-compose -f ./docker/stage/docker-compose-staging.yml --compatibility up --build -d
Switch daemon to linux container with powershell script
./docker-e2e-tests/SwitchDaemon.ps1
Run the test containers (Selenium, python)
docker-compose -f ./docker-e2e-tests/docker-compose.yml --compatibility up --build -d
Switch daemon back to windows container with powershell script
./docker-e2e-tests/SwitchDaemon.ps1
Same result here. First time it was fine. Second time I tried to COPY the changes into the container (step 1) I got the same error as above. And now the worst problem is, that the pipeline is not running anymore at all. I am even getting the same error now if I remove step 2-4.
I am trying to run the selenium test cases in a docker container with Centos using a protractor. I am getting an error. Even I have the latest version of the xvfb package.
We have two stages one to build the docker image and another one to scan it with prisma pluging.
build image :
stage('Build Docker image preproduction') {
steps {
script {
dockerImage = docker.build("${env.docker_image_name}")
}
}
}
stage('Prisma Cloud Scan') {
steps {
prismaCloudScanImage dockerAddress: "$DOCKER_HOST", image: "${env.docker_image_name}:latest", logLevel: 'debug', resultsFile: 'prisma-cloud-scan-results.json'
}
}
This works fine most of the time, but in some situation almost ( 1 over 20 ) the job failled and we get this error:
[PRISMACLOUD] Scanning images remotely on default-5mn8k
[PRISMACLOUD] Waiting for scanner to complete
[PRISMACLOUD] /home/jenkins/agent/workspace/ild_chore_add-prisma-to-pipeline/twistcli6275500796561372150 images scan otherimagename:1234 --docker-address tcp://localhost:2375 --min-scan-time 1611048549280 --ci --publish --details --address https://XXXXXXXXXprisma_host_hereXXXXX --ci-results-file prisma-cloud-scan-results.json
[ild_chore_add-prisma-to-pipeline] $ /home/jenkins/agent/workspace/ild_chore_add-prisma-to-pipeline/twistcli6275500796561372150 images scan otherimagename:1234 --docker-address tcp://localhost:2375 --min-scan-time 1611048549280 --ci --publish --details --address https://XXXXXXXXXprisma_host_hereXXXX --ci-results-file prisma-cloud-scan-results.json
[PRISMACLOUD] failed to find image otherimagename:1234
[PRISMACLOUD] Scanner failed to run properly. Status: 1
and before this message we can see in the console that the image is already present in the docker host:
+ docker build -t otherimagename:1234 .
Sending build context to Docker daemon 20.54MB
Step 1/2 : FROM nginx:stable
---> b9e1dc12387a
Step 2/2 : COPY docs /usr/share/nginx/html
---> Using cache
---> 09787d1a562e
Successfully built 09787d1a562e
Successfully tagged otherimagename:1234
Can you help me figure out what's going on? we also set up one sleep time between the two steps, but still facing the issue.
Thanks, #EFOE, this hint of the docker config helped. I ran into the same problem via Jenkins. The scans were running on Jenkins EC2 Jenkins agents, both Win and Linux for respective images. While there were no issues with the Linux image scans, the Windows scans failed to find the docker images.
I debugged the docker daemon logs on the windows EC2 agents and found that the images were actually accessible locally on those agents, but the Prisma plugin was unable to access the Docker API for the image details.
Since my agent never had any browsers installed (IE was broken), once I installed chrome as a browser, the Prisma plugin was able to access the docker images as well as perform the scans. So basically my agent needed a client to access the Docker API.
There were no issues when accessing the twistcli binaries by Prisma. Just had issues with only the Prisma Jenkins plugin for Windows.
Hopefully, this will help if someone runs into similar issues.
I have the following basic Dockerfile:
FROM mcr.microsoft.com/windows/servercore:1903
CMD echo Hello World!
When I run the command:
docker build -t latest . or docker build .
My terminal hangs forever and it seems like nothing is being done.
However, if I run:
docker pull mcr.microsoft.com/windows/servercore:1903
I can pull the image from the repository.
I'm not sure what I'm doing wrong, or how to fix it. The build command doesn't seem to have a verbose option, and I need a docker container running Windows.
I'm using Docker in Windows 10 Pro and its configured to use Windows containers.
Check which directory do you execute your commands from. You shall be executing them from directory where DOCKERFILE is located and nothing else. If you execute say from root of C drive or any other location with big number of files then docker as a first step will try to zip all of them up and then send to a builder and hence delays.
New to docker and I'm using Windows 7 SP1. It looks like docker is running fine in my machine as I have tried running hello-world by command docker run hello-world as instructed in the tutorial and got expected result. Now all I'm trying to do is create a docker image for a .net core console app. My app built and ran. but while building docker image by command docker build -t myapp . I get the below error
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&c
puquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=
duke&target=&ulimits=null: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on
Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Below my Dockerfile
FROM microsoft/dotnet:1.1-runtime-nanoserver
WORKDIR /DotNetConsole
COPY /bin/Debug/netcoreapp1.1/publish/ .
ENTRYPOINT ["dotnet", "DotNetConsole.dll"]
I could get around this problem by starting the "Docker QuickStart Terminal" installed with the docker tools, and running the commands for building the docker images from there.
If I used GIT BASH instead of the Docker QuickStart Terminal to execute the commands, I would get this kind of error. So it seems that if the commands are not executed from the Docker terminal itself, these errors show up.