Sitemap
Context-driven-testing

Context-driven-testing

Selenium, Selenium Test Automation, Manual Testing

How to Connect GitHub to Jenkins and Automate CI/CD Pipelines.

16 min readOct 2, 2026
Press enter or click to view image in full size

Step 1 : Create a New Project folder workspace in C or D drive in the Name of : Project_Github_Jenkins_Integration

Project_Github_Jenkins_Integration
Press enter or click to view image in full size

Step 2: Create a New project folder in the name of : Github_jenkins_project

Github_jenkins_project
Press enter or click to view image in full size

Step 3: Open the project in vs code

code .
Press enter or click to view image in full size

Step 4 : Based on the image, clicking “Manage” inside the blue warning banner will open a menu or dialog box that allows you to configure your Workspace Trust settings in Cursor/VS Code.

Press enter or click to view image in full size

Step 5: Based on the image, clicking “Trust” (indicated by the blue button and red arrow) means you are declaring that you trust the authors of the files in your current project folder.

When you click this button, you exit Restricted Mode and unlock the full capabilities of your editor for this workspace. Specifically, it enables the following functions that are currently blocked:

Press enter or click to view image in full size

Step 6: Based on the image, clicking the “X” (Close/Cancel) button indicated by the red arrow means you are simply closing the Workspace Trust configuration window.

Because you already clicked “Trust” in the previous step, the window now states “You trust this folder” at the top. Clicking the “X” will save this trusted state, close the screen, and return you directly to your empty code editor workspace so you can begin working with all features fully enabled.

Now that your project folder is trusted and ready, would you like help opening a specific file, setting up a new code file, or opening the terminal (Ctrl + Alt + Z) to start working?

Press enter or click to view image in full size
Press enter or click to view image in full size

Step 7: In VS Code: Terminal → New Terminal , Make sure you’re using PowerShell. Your terminal might show:

PS D:\Project_Github_Jenkins_Integration\Github_jenkins_project>
Press enter or click to view image in full size

Step 8: Create a virtual environment by running the following command:

i. On Windows (Command Prompt):

python -m venv venv
venv\Scripts\activate

ii.On Windows (PowerShell):

(Note: If you get an execution policy error, run Set-ExecutionPolicy RemoteSigned -Scope Process first.)

python -m venv venv
.\.venv\Scripts\Activate.ps1

iii. On macOS / Linux:

python3 -m venv venv
source venv/bin/activate
Press enter or click to view image in full size
Press enter or click to view image in full size

After entering above command user can create .venv file is created below.

You’ll now have:

Github_jenkins_project

└── .venv

Press enter or click to view image in full size

Step 9: Activate the Virtual Environment in PowerShell After creating the .venv virtual environment, run the following command to activate it: Activate it:

.\.venv\Scripts\Activate.ps1
Press enter or click to view image in full size

Step 10: After activating you will see like

(.venv) PS D:\Project_Github_Jenkins_Integration\Github_jenkins_project>
Press enter or click to view image in full size

Step11: After activating the virtual environment in VS Code, select Python: Select Interpreter from the Command Palette.

  1. Open VS Code.
  2. Press
Ctrl + Shift + P 
  1. The Command Palette will appear.
  2. Type or Search Python: Select Interpreter in search bar and click on it.
Python: Select Interpreter

After selecting Python: Select Interpreter, you will see the available Python interpreters, as shown in the image belo

Press enter or click to view image in full size

Step 12: click on

Python: Select Interpreter
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 13: Select the interpreter similar to: Python 3.x.x (‘.venv’) Or manually select: .\.venv\Scripts\python.exe , then Click on

.venv(3.14.7.final.0) .\.venv\Scripts\python.exe
Press enter or click to view image in full size

Step 14 : Ctrl+Shift+P → Developer: Reload Window after selecting .venv(3.14.7.final.0) .\.venv\Scripts\python.exe

Step 15: Install Playwright + Pytest With (.venv) visible in the terminal,

run:

pip install pytest-playwright
Press enter or click to view image in full size

Step 16 : If user see such type warning then upgrade the pip version type below command :

To update, run:

python.exe -m pip install - upgrade pip
Press enter or click to view image in full size

After updating pip version you will see such type latest upgrade version of pip.

Press enter or click to view image in full size

Step 17 : Verify pip version by entering below command.

pip - - version

After upgrading now pip version is 26.2.1 is latest version.

Press enter or click to view image in full size

Step 18 : Or you can directly put below command to install playwright test Option 1: single command to install all the required plugins:

pip install pytest playwright pytest-xdist pytest-html allure-pytest pytest-rerunfailures openpyxl Faker python-slugify
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 19 : Then install Playwright browsers:

playwright install

Uninstall Playwright browser:

playwright uninstall

Playwright uninstall all browser

playwright uninstall - all

Or You can also install the dependencies for a single browser by passing it as an argument:

playwright install-deps chromium

It’s also possible to combine install-deps with install so that the browsers and OS dependencies are installed with a single command.

playwright install - with-deps chromium
Press enter or click to view image in full size

Step 20: Install Allure pytest plugin.

First Verify that allure pytest plugin is present put below command.

pip show allure-pytest
Press enter or click to view image in full size

Step 21:Then Run the below following command to install the required plugin:

pip install allure-pytest
Press enter or click to view image in full size

Step 22: Once the virtual environment is active, the project structure looks like this:

Press enter or click to view image in full size

Step 23 : Enter below command :

pip list 
Press enter or click to view image in full size

Step 24: Project folder structure breakdown

Based on your uploaded VS Code sidebar image, this layout follows an industry-standard Page Object Model (POM) pattern for a Python-based automation framework (like Pytest + Playwright). Here is what each part represents:

Github_jenkins_project
The root directory of your project hosted on GitHub and built via Jenkins.

  • 📁 .github/
    Contains GitHub-specific configurations. This is typically where your GitHub Actions workflow YAML files live if you trigger pipelines directly from GitHub.
  • 📁 .venv/
    The isolated Python virtual environment folder where all project dependencies (like pytest and playwright) are installed locally.
  • 📁 pages/
    The core of the Page Object Model design pattern. This folder contains Python files representing different web pages, storing their UI locators and functional interaction methods.
  • 📁 reports/
    The destination folder where test framework execution outputs—such as HTML reports, JUnit XML files, logs, and screenshots—are stored.
  • 📁 testdata/
    Stores external data files utilized for data-driven testing, such as JSON files, CSV configurations, or environment variables.
  • 📁 tests/
    Houses your actual functional execution script files (e.g., files named test_*.py) that carry out assertions against your application components.
  • 📁 utilities/
    Contains custom helper scripts, database connectors, custom loggers, or API client wrapper functions reusable across multiple test files.
  • 🐍 config.py
    Global framework settings configuration file hosting details like base URLs, timeout intervals, or target execution browser indicators.
  • 🐍 conftest.py
    The centralized Pytest infrastructure file defining initialization fixtures, browser context setups, teardown scripts, and custom command-line flags.
  • ⚙️ pytest.ini
    The master initialization configuration file used by Pytest to dictate default command line arguments, register markers, and define test discovery paths.
  • 📄 requirements.txt
    The dependency manifest cataloging required application third-party libraries (pytest, playwright, etc.) used by Jenkins to reproduce your system workspace.

Git and GitHub Commands Used in the Project.

Step 25: git init is used to initialize a new Git repository in your current project folder.

Git creates a hidden .git folder inside your project directory. This folder stores Git-related information such as commits, branches, and configuration.

git init
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 26: Add your project files

git add .
Press enter or click to view image in full size

Step 27: Make your first commit

 git commit -m "Added Github Jenkins Integration Project"
Press enter or click to view image in full size

Step 28: If your GitHub repository is completely empty and you want your initial code directly on the main branch, you can bypass creating a separate feature branch.

git branch -M main
Press enter or click to view image in full size

Step 29: Link your local repository to GitHub by adding it as a remote origin:

git remote add origin https://github.com/DurgeshYaduvanshi2026/GitHub-Jenkins-integration-project.git
Press enter or click to view image in full size

Step 30: Push your local code to the main branch on GitHub.

git push -u origin main
Press enter or click to view image in full size

Step 31: Once the push is complete, refresh your GitHub repository page to view your project files on the main branch.

Press enter or click to view image in full size

Step 32: Delete from GitHub but keep it on your computer

Get Context-driven-testing’s stories in your inbox

Join Medium for free to get updates from this writer.

If you want to remove the file from the online GitHub repository but keep the actual file on your local computer.

git rm --cached reporting-labs

Steps : Delete from GitHub but keep it on your computer

  1. Go to your GitHub repository dashboard. Locate and click on the file or folder you want to delete (e.g., reporting-labs).
Press enter or click to view image in full size

2. Click the three dots … menu on the upper right, select Delete directory, and confirm the deletion. Once the folder is removed from GitHub, open your local project environment.

Press enter or click to view image in full size

3. Open your terminal in VS Code and run the following command to remove the directory from Git tracking while keeping the physical files on your local computer:

git rm -r --cached reporting-labs
Press enter or click to view image in full size

4. Commit and push the updates to GitHub

After adding reporting-labs/ to your .gitignore file, save the file and run the following commands in your terminal to sync your changes with GitHub:

git add .
git commit -m "Deleted the reporting-labs file"
git push

4. Verify the final changes on GitHub

After pushing the changes, navigate back to your GitHub repository dashboard to confirm that the reporting-labs directory is no longer present and that your .gitignore file has been updated successfully.

Step 33: Open your browser and log into your Jenkins dashboard.

Press enter or click to view image in full size

Step 34: Click on “New Item” in the left-hand navigation panel to create a new project.

Press enter or click to view image in full size

Step 35: Enter your project name in the input field, select Freestyle project from the item type options, and then click OK at the bottom of the page.

Press enter or click to view image in full size

Step 36: In the Enter an item name field, type GitHub-Jenkins-Project. Ensure Freestyle project remains selected, then click the OK button at the bottom left to proceed.

Press enter or click to view image in full size

Step 37: After clicking the OK button, you will be automatically redirected to the project configuration dashboard, where you can manage your job settings.

Press enter or click to view image in full size

Step 38: Scroll down to the Source Code Management section, select the Git radio button, and paste your GitHub repository link into the Repository URL field.

Press enter or click to view image in full size
Press enter or click to view image in full size

Step 39: Scroll down to the Branches to build section. In the Branch Specifier field, change the value to */main to match your GitHub repository’s default branch. If you are using a different branch for your deployment, enter its name here instead.

Press enter or click to view image in full size
Press enter or click to view image in full size

Step 40: Leave the other configuration fields at their default values and scroll down to the Triggers section. Select the Build periodically checkbox, then enter your desired cron schedule expression in the Schedule text box to define when the project should run automatically.

Press enter or click to view image in full size

Step 41: Enter H 22 * * * to run the build daily between 10:00 PM and 10:59 PM. The H symbol is a Jenkins best practice that randomizes the exact minute to prevent resource spikes.

Press enter or click to view image in full size

Step 42: Configure Build Steps.

Scroll down to the Build Steps section and click on the Add build step dropdown button to choose the execution environment for your project commands.

Press enter or click to view image in full size

Step 43: Select the build execution environment.

From the Add build step dropdown menu, select Execute Windows batch command to open the terminal input area for your project scripts.

Press enter or click to view image in full size

Step 44: Access the Command Input Field.

Once you select the option, an Execute Windows batch command configuration block will appear. You will now see the empty Command text box where you can input your automation or execution scripts.

Press enter or click to view image in full size

Step 45: Enter your build automation commands.

In the Command text box, enter the following sequence of batch commands to set up the virtual environment, install dependencies, clear old test data, and run your tests:

python -m venv .venv
call .venv\Scripts\activate
pip install -r requirements.txt
playwright install
rmdir /s /q reports\allure-results
pytest tests

Note: If you’re on Mac/Linux, select “Execute shell” and use:

python -m venv .venv
call .venv\Scripts\activate
pip install -r requirements.txt
playwright install
rmdir /s /q reports\allure-results
pytest tests\
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 46: Navigate to Post-build Actions.

Once you finish configuring your build steps, scroll down to the “Post-build Actions” section.

Press enter or click to view image in full size

Step 47: Add an Allure Report post-build action.

Click the Add post-build action dropdown button to open the actions menu. From the list of available options, select Allure Report to add test reporting to your pipeline configuration.

Press enter or click to view image in full size

Step 48: Inside the Allure Report “Path” input box, specify your results directory as reports/allure-results.

reports/allure-results
Press enter or click to view image in full size

Step 49: Add an Email Notification post-build action.

Click the Add post-build action dropdown button once again. From the expanded options menu, select E-mail Notification to configure build status alerts for your team.

Press enter or click to view image in full size

Step 50: Configure email notification recipients.

In the Recipients input box under the E-mail Notification section, enter the email addresses that should receive the build alerts. If you want to add multiple email IDs, separate them using spaces.

Press enter or click to view image in full size

Step 51: Save and apply your configurations.

Once all build settings and post-build actions are complete, click the Apply button to register your changes, and then click Save to finalize the project setup and return to the main pipeline dashboard.

Press enter or click to view image in full size

Step 52: Access the project overview dashboard.

After saving your configuration, you will be redirected to the main dashboard for GitHub-Jenkins-Project.

Press enter or click to view image in full size

Step 53: Run the manual build execution.

Click on Build Now in the left sidebar menu to immediately trigger the pipeline and start your first automated integration run.

Press enter or click to view image in full size

Step 54: Monitor the execution in the Build History panel.

Under the Builds card in the lower-left corner, you will see your first pipeline run (#1) appearing with a animated progress bar. This indicates that Jenkins is actively pulling your code from GitHub and executing the batch script commands.

Press enter or click to view image in full size

Step 55: View the live execution logs.

From the build overview dashboard on the left-hand sidebar menu, click on Console Output to monitor the live execution details and terminal output of your running automation script.

Press enter or click to view image in full size

Step 56: Verify the build logs and execution status.

The Console Output page displays the live execution logs. You can monitor the entire build lifecycle, including cloning the GitHub repository, installing python dependencies, executing the Playwright tests, and generating the final Allure test report. At the end of the log, confirm that the build finished with a Finished: SUCCESS status.

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 57: Return to the Build Status dashboard.

From the left-hand sidebar navigation menu, click on Status to go back to the overview dashboard for this specific build execution (#1). Here, you can view generated build artifacts and access reporting links.

Press enter or click to view image in full size

Step 58: Open the Allure Test Report.

Click on Allure Report in the left sidebar menu (or the matching link in the main center pane) to open your interactive graphical dashboard and review your test results.

Press enter or click to view image in full size

Step 59: Analyze your execution results in the Allure Report Dashboard.

Clicking the link opens the comprehensive Allure Report web dashboard. You can navigate through the left sidebar tabs to fully analyze your test results:

i. Overview: Displays the global pass rate metric (100% success across all 7 test cases).

ii. Suites & Packages: Breaks down executions by specific functional folders like tests.login, tests.cart, and tests.checkout.

iii. Behaviors: Maps test cases back to core feature requirements and user stories.

iv. Graphs & Timeline: Visualizes test statistics, duration trends, severity status, and historical execution timelines.

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Step 60: Return to the Jenkins project page.

Click the browser’s Back button in the upper-left corner to exit the Allure Report interface and return to your main Jenkins project dashboard.

Press enter or click to view image in full size

Step 61: Click the “Jenkins” logo in the top-left corner to return to the main dashboard.

Press enter or click to view image in full size

Step 62: Verify project status on the main dashboard.

You will now be back on the main Jenkins home dashboard. Look at your project list to confirm that GitHub-Jenkins-Project displays a green checkmark status icon under the S (Status) column, indicating a successful execution.

Press enter or click to view image in full size

Step 63: Trigger a re-run from the main dashboard.

If you want to run the project again, you can trigger a build directly from the dashboard in two ways: click the dropdown arrow next to the project name and select Build Now, or click the green Play icon on the far right side of the project row.

Press enter or click to view image in full size

Step 64: Click on “Build History” in the left sidebar navigation panel to view a detailed record of all past project executions.

Press enter or click to view image in full size
Press enter or click to view image in full size

Step 65: Click the “Jenkins” logo in the upper-left header panel to go back to your main project dashboard.

Press enter or click to view image in full size
Press enter or click to view image in full size

--

--

Selenium Test Automation, Manual Testing, Playwright