星期三, 4月 24, 2019

Quick Start: Selenium Grid

How can we create a Selenium Grid Environment quickly? If you have docker-compose already, just refer this, save as docker-compose.yml, and run "docker-compose up -d" to start it. That's all.

How to prove it worked? we need:
  • selenese-runner.jar download from here
  • check your docker host ip address like "ip addr | grep docker0"
  • any workable side file
If selenese-runner.jar and my.side in the current directory, start another docker container:
  • docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp openjdk java -jar selenese-runner.jar --driver remote --remote-url http://<DOCKER_HOST_IP>:4444/wd/hub --remote-browser <BROWSER> <WORKABLE.side>
<BROWSER> can be chrome or firefox.

星期二, 4月 16, 2019

CentOS7, Firewalld and Docker

In the past, I always stop firewalld for Docker. But it's not secured. According to this, if we update firewalld version to 0.4.3.2-9 can fix this, or running these command:
  • nmcli connection modify docker0 connection.zone trusted
  • systemctl stop NetworkManager.service
  • firewall-cmd --permanent --zone=trusted --change-interface=docker0
  • systemctl start NetworkManager.service
  • nmcli connection modify docker0 connection.zone trusted
  • systemctl restart docker.service

星期四, 4月 11, 2019

Jenkins fake warning about Subversion

If a Jenkins job correspond to Subversion, when checking config, maybe you will see this warning:
  • Unable to access the repository
Don't worry, this could be a fake warning, if you check Jenkins log and found something like:
  • SEVERE hudson.scm.SubversionSCM$ModuleLocation$DescriptorImpl checkCredentialsId
  • svn: E200015: Authentication cancelled

星期五, 3月 29, 2019

selenese runner can't nesting while end loop

Consider this code snippet:
  • execute script | return 2; | i
  • while | ${i} > 0 |
    • execute script | return 3; | j
    • while | ${j} > 0 |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • end | |
    • execute script | return ${i} - 1; | i
  • end | |
It works fine in Selenium IDE with output:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
  • i: 1, j: 2
  • i: 1, j: 1
But selenese runner missing some output, just:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
How can we avoid this inconsistent? this code snippet should be ok:
  • execute script | return 2; | i
  • do | |
    • execute script | return 3; | j
    • do | |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • repeat if | ${j} > 0 |
    • execute script | return ${i} - 1; | i
  • repeat if | ${i} > 0 |
[2019/03/30]
This bug was fixed at version 3.22.0, see here.

星期二, 1月 29, 2019

Build WebGoat in a temporary Docker Container

  • git clone https://github.com/WebGoat/WebGoat
  • cd WebGoat
  • docker run -it --rm --name mymaven -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3-jdk-11 mvn clean install

星期六, 1月 19, 2019

Access your private npm repository - Nexus

  • Nexus Server
    • install Nexus
    • create npm repository (reference)
    • grant user / pass
  • Nexus Client (Jenkins Node)
    • install npm
    • npm login --registry https://nexus.acme.com/repository/npm-group/
    • (check ~/.npmrc)
    • npm --registry https://nexus.acme.com/repository/npm-group/ install somePackage (reference)