Our News / Web application acceptance tests

Web application acceptance tests

in gitlab-ci using codeception and selenium installed as docker container
Let’s assume we are running acceptance tests of our application during the testing stage in gitlab-ci. The runner starts the container with our web app, and then executes codeception acceptance tests using the selenium server using the google chrome browser. We are using a local gitlab server with a registered runner to execute our tests..gitlab-ci.yml looks like this:

  - name: postgres:alpine
  alias: postgres
  - name: redis:alpine
  alias: redis
  - name: selenium/standalone-chrome
  alias: chrome
  - name: tophfr/mailcatcher
  alias: smtp
What could possibly go wrong? Actually, everything could go wrong. The problem is that selenium is a service in gitlab-ci.yml and it does not know the runner’s executor container IP address and cannot reach it by host name.
Indeed, if you check the executor’s host file you will see something like this:

$ cat /etc/hosts localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0   ip6-localnet
ff00::0   ip6-mcastprefix
ff02::1   ip6-allnodes
ff02::2   ip6-allrouters    chrome 9a7c560fcc81    tophfr__mailcatcher 47ca8ed9a04a    tophfr-mailcatcher 47ca8ed9a04a    smtp 47ca8ed9a04a    selenium__standalone-chrome 9a7c560fcc81    selenium-standalone-chrome 9a7c560fcc81   runner-fc308d01-project-17- concurrent-0
But, if we look in the host file of the selenium container you won’t see any information about our web app container (runner-fc308d01-project-17-concurrent-0 with IP address   localhost
::1         localhost ip6-localhost ip6-loopback
fe00::0	    ip6-localnet
ff00::0	    ip6-mcastprefix
ff02::1	    ip6-allnodes
ff02::2	    ip6-allrouters 	564756c8670d
This problem is something unexpected but, is not new. I have found a 2-year old issue on gitlab
However, container linking (including containers in the same network) is still not implementing in gitlab. So, the main container is able to call the service container, but the service container cannot call the main container.
One possible workaround can be the usage of environmental variables to deliver the container’s IP address into the codeception config and test files.
We can grab the container’s IP address from the main container’s host file. It can be done directly in .gitlab-ci.yml

- export WEB_APP_IP="$(ifconfig | grep -A 1 'eth0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1)"
# will set WEB_APP_IP environment variable to
- export SMTP_IP=$(grep 'smtp' /etc/hosts | awk '{print $1}')
# will set SMTP_IP environment variable to
Now we can use the WEP_APP_IP variable to set the page URL in the acceptance.suite.yml

class_name: AcceptanceTester

    - WebDriver:
        host: chrome
        port: 4444
        browser: chrome
        window_size: 1024x768
        url: 'http://%WEB_APP_IP%'
          unexpectedAlertBehaviour: 'accept'
    - Asserts
don’t forget to specify params: env in codeception.yml

namespace: frontend\tests
actor: Tester
  tests: tests
  log: tests/_output
  data: tests/_data
  helpers: tests/_support
  bootstrap: _bootstrap.php
  colors: true
  memory_limit: 1024M
      configFile: 'config/test-local.php'
params: env
If you need to call one service container from another service container during your codeception test script MyCest.php, you can obtain the service container IP address from PHP
$this->mailClientURL = 'http://'.getenv('SMTP_IP');
Cappers ranked as IOS app development agency
Cappers Applications has been recognized as Top 30 IOS app development companies in 2021 by DesignRush. Cappers Applications has been recognized as Top 30 IOS app…
Our News
Volunteer development - The rapid testing kit program page for BCC website
Cappers helped Burlington Chamber of Commerce to build a new page. The project was accomplished in just 2 days.Further, 47 appointments were booked, and 4,700+ kits were distributed before June 1.
Our News
Thinking about changing website content?
You can change your website content at anytime, without the help of Developers. The WordPress CMS development allows you to update posts, add new images and videos, on a daily basis. Capper's Customized Themes are user-friendly and easily adaptable for any user group which will provide an easier way in creating content for the website. Our Customized Theme structure has the ability to expand and incorporate professional or personal blogs on the websites.
Our News
Helpdesk feature
We have something NEW we want to share with all of you. We have created a Helpdesk feature to stay in touch and keep track of your technical needs. Inside this new feature, you can create a new support ticket, check your status, and call for support.
Our News
Revamp of a Pet Microchip Website
Our long term client approached us to update his website.
Our News
Opportunities to streamline processes and reduce costs
Have you had thoughts about how you can make changes to improve your business for our NEW normal? As small businesses are slowly reopening, this is still an unknown time.
Our News
Support in remote operations and ongoing projects
During COVID-19, we have been staying connected with our clients in support of improvement in remote operations and ongoing projects.
Our News
COVID-19: Maintaining the safety of our staff and clients.
Just like you, we have been doing our very best to navigate the COVID-19 crisis in a way that is both responsive and responsible, while maintaining the safety of our staff and clients.
Our News
FinTech Events in Chicago
Last week, I had the opportunity to attend the Digital Innovations and Challenges in FinTech & Financial Services event in Chicago.
Our News
IESE Alumni Event
Last week I had the pleasure to be a presenter at the IESE Alumni Event. It was great to meet peers from IESE Business School and exchange ideas about Innovation, AI, and Blockchain.
Our News
FinTech Mobile Application
We are happy to announce our most proudest project, FinTech mobile app. The app was developed to utilize the latest tech stack.
Our Technologies
REST Design Methodology
Here's a helpful tip, when developing an API, stick to the REST design methodology. Here we'll describe the requirements for the REST architecture.
Our News
API Contract
Ask any IT person, what’s the stumbling block in the Web Application Development? Majority of the time, the answer is the contract between the front-end and back-end teams.
Our News
Pitch Club in Detroit
Last week, I had the opportunity to attend an event called Pitch Club in Detroit. We had 3 companies present and may the best company win, with their Pitch.
Our News
Small Business Week in Halton Region
It has been a busy yet productive week, coming back from the long Thanksgiving weekend. This week within our community, it was Official Small Business Week in Oakville and Burlington.
Our News
An easy way to update reviews on your website
Sign up for 11am.io today and have reviews not only on Google, FB and other platforms but also on your website, if the customer would like to leave a review directly.
Our Technologies
Had a great time at the Digital Summit in Detroit
Had a great time at the Digital Summit in Detroit. I listened, learned and connected with some great people. I wanted to share with everyone some of my personal take aways during the Summit.
Our News
Google Chrome extension for MDland
As the world evolves and your company expands, there are many difficult obstacles you can come across. One particular challenge is adding a new web application that seamlessly integrates with already existing programs.
Our Technologies
Online reputation management
Are you a Digital Agency or Digital Expert where you help to Small Businesses improve local SEO? Cappers Application has developed a new way to help Digital Agencies that work on local SEO for their clients. 11am.io
New Applications
Cappers Applications Inc.
Welcome to our new, lighter and faster website. With the use of Gatsby - JavaScript site generator, we are able to create a static website, which combines the latest technology, ReactJS and GraphQL.
Our News


Start your web development or mobile application today! Schedule a call to get a quote.