Skip to content

E2E: Add facebook OAuth login spec

Sanad Liaquat requested to merge qa-shl-facebook-oauth-e2e-test into master

What does this MR do and why?

Adds E2E test for OAuth login with Facebook

Related to gitlab-org/quality/testcases#3979 (closed)

Depends on gitlab-qa!1207 (merged)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Step 1

We will need to run GitLab with TLS enabled in docker exposed at https://gitlab.test. This will require some certificates be placed in the /etc/gitlab folder on the docker container. To do this:

  1. Copy the files in gitlab-qa/tls_certificates/gitlab to a gitlab/config/ssl folder on your computer such as ~/srv/gitlab/config/ssl

  2. Copy the files in gitlab-qa/tls_certificates/authority to a gitlab/config/trusted-certs folder on your computer such as ~/srv/gitlab/config/trusted-certs

We will mount gitlab/config folder onto /etc/gitlab folder when starting the docker container in step 5.

Step 2

In your /private/etc/hosts file, add this line:

127.0.0.1       gitlab.test

Step 3

Create test network

docker network create test

Step 4

Login to docker and pull the gitlab image:

docker login --username <YOUR_GITLAB_USERNAME> --password "<YOUR_GITLAB_PAT_WITH_REGISTRY_ACCESS>" registry.gitlab.com

docker pull registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:9757aba8814d8c02d86ba0a4d496009d9ad16f63

Step 5

Start GitLab in a docker with:

docker run \
--hostname gitlab.test \
--publish 443:443 --publish 80:80 \
--name gitlab-oauth \
--net test \
--platform linux/amd64 \
--volume ~/srv/gitlab/config:/etc/gitlab \
--env GITLAB_OMNIBUS_CONFIG="gitlab_rails['initial_root_password']='5iveL\!fe'; gitlab_rails['omniauth_enabled'] = true; letsencrypt['enable'] = false; external_url 'https://gitlab.test'; gitlab_rails['omniauth_allow_single_sign_on'] = ['facebook']; gitlab_rails['omniauth_block_auto_created_users'] = false; gitlab_rails['omniauth_providers'] = [   {     name: 'facebook',     app_id: '$QA_FACEBOOK_OAUTH_APP_ID',     app_secret: '$QA_FACEBOOK_OAUTH_APP_SECRET',  verify_ssl: false } ]; " \
registry.gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee:9757aba8814d8c02d86ba0a4d496009d9ad16f63

Step 6

From the qa directory:

bundle install

QA_FACEBOOK_USERNAME="<QA_FACEBOOK_USERNAME>" QA_FACEBOOK_PASSWORD="<QA_FACEBOOK_PASSWORD>" QA_DEBUG=true CHROME_HEADLESS=false bundle exec bin/qa Test::Instance::All https://gitlab.test qa/specs/features/browser_ui/1_manage/login/oauth_login_with_facebook_spec.rb -- --tag orchestrated

All variables are in 1Password GitLab-QA vault with the placeholder names. Make sure to click "Expand Search to All Fields" when searching in 1Password.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sanad Liaquat

Merge request reports

Loading