Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing logout tests #28

Merged
merged 51 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4e83957
Fixed failing logout test and made common methods to click to avoid c…
Oct 9, 2024
8536373
Fix git hooks errors with formatting
Oct 9, 2024
c03e84d
Fix failing tests following last commit
Oct 9, 2024
78ee810
Fix issue with attaching screenshots to alure report
Oct 9, 2024
88f7579
Fix issue with attaching screenshots to alure report
Oct 9, 2024
41c04f8
Fix issue with attaching screenshots to allure reports and fixed fail…
Oct 9, 2024
6ff2d70
Fix issue with inconsistent test failures when running headless
Oct 10, 2024
daf58e1
Hopefully nailed all intermittent failures
Oct 10, 2024
3c61394
Fixed all issues except recording a vaccine and improved wait times
Oct 21, 2024
4add662
Try publishing data to github
Oct 21, 2024
323d649
Try publishing data to github
Oct 21, 2024
3de22b5
Try publishing data to github
Oct 21, 2024
7f827a8
Try publishing data to github
Oct 21, 2024
be8d97a
Try publishing data to github
Oct 21, 2024
b08ecbc
Fixed attach screenshot issue
Oct 22, 2024
f776266
May have solved the image attachment issue
Oct 22, 2024
3498d32
Make github pages url dynamic
Oct 22, 2024
056909c
Try attach screenshots again
Oct 22, 2024
ce7fb29
Corrected upload artifact version
Oct 22, 2024
3735b8b
Fixed issue with yml
Oct 22, 2024
e0696bd
Fix dynamic branch url naming issue
Oct 22, 2024
8fb61f2
Reset git leaks actions from last colin's change
Oct 22, 2024
30b639d
Only run logout test for quick feedback
Oct 22, 2024
ca781b9
Upload screenshots as artifacts again
Oct 22, 2024
1602432
Try different version of git actions
Oct 22, 2024
56046d5
Try different version of git actions
Oct 22, 2024
47591a5
Try different version of git actions
Oct 22, 2024
b88bafb
Try different version of git actions
Oct 22, 2024
f2f778b
Try different version of git actions
Oct 22, 2024
528fdc1
Try different version of git actions
Oct 22, 2024
a4d1945
Correct screenshot path
Oct 22, 2024
fed98a2
Correct screenshot path
Oct 22, 2024
fe2d849
Correct screenshot path
Oct 22, 2024
07e073f
Correct screenshot path
Oct 22, 2024
2d9c5a1
Correct screenshot path
Oct 22, 2024
c5c8926
Correct screenshot path
Oct 22, 2024
773a935
Correct screenshot path
Oct 22, 2024
0733163
Correct screenshot path
Oct 22, 2024
7378157
Correct screenshot path
Oct 22, 2024
ef32cff
Correct screenshot path
Oct 22, 2024
e4a0045
Correct screenshot path
Oct 22, 2024
5f34f2f
publish to gibhun-dev
Oct 22, 2024
37ac12b
made new branch for publishing to github-pages-dev
Oct 22, 2024
c3fdc2b
made new branch for publishing to github-pages-dev
Oct 22, 2024
1c4af0f
made new branch for publishing to github-pages-dev
Oct 22, 2024
9704508
Fix failing tests in dev excpet record a vaccine and added enough wai…
Oct 23, 2024
fd07f17
Added more wait timers
Oct 23, 2024
975d36d
Implement new workflow file
Oct 23, 2024
d8b30c6
debug workflow file
Oct 23, 2024
9537a2a
debug workflow file
Oct 23, 2024
d4be641
debug workflow file
Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/scan-secrets/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ runs:
shell: bash
run: |
# Please do not change this `check=whole-history` setting, as new patterns may be added or history may be rewritten.
check=staged-changes ./scripts/githooks/scan-secrets.sh
check=whole-history ./scripts/githooks/scan-secrets.sh
22 changes: 20 additions & 2 deletions .github/workflows/tests_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,24 @@ jobs:

# Move the Allure report files to the root of the gh-pages directory
- name: Move Allure report files
run: mv allure-report/* .
run: |
mv allure-report/* .

- name: Upload Attachments
uses: actions/upload-artifact@v3
with:
name: screenshots
path: data/attachments/**
if-no-files-found: warn
include-hidden-files: false

- name: Get branch name
id: get_branch_name
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV

- name: Set destination branch for GitHub Pages
id: set-destination-branch
run: echo "DESTINATION_BRANCH=gh-pages-${{ env.BRANCH_NAME }}" >> $GITHUB_ENV

- name: Deploy Allure report to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
Expand All @@ -145,7 +162,8 @@ jobs:
script: |
const repo = context.repo.repo;
const owner = context.repo.owner;
const pagesUrl = `https://${owner}.github.io/${repo}`;
const branchName = context.ref.split('/').pop(); // Use the branch name you want to reference
const pagesUrl = `https://${owner}.github.io/${repo}/gh-pages-${branchName}`; // Use backticks for template literals
core.setOutput('pages_url', pagesUrl);

- name: Output GitHub Pages URL
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# Please, add your custom content below!

*.pyc
*.png
__pycache__/
screenshots/
.env
# *.png ## Cannot ignore png files because the images will be missing from the github pages allure report
venv/
.venv/
allure-results/
allure-report/
.js
tox.log
node_modules/
package-lock.json
4 changes: 3 additions & 1 deletion Docker/tests.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ RUN apt-get update && apt-get install -y \

WORKDIR /app

RUN mkdir -p /app/data/attachments

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt \
Expand Down Expand Up @@ -53,4 +55,4 @@ COPY . .

# Update the entrypoint to start both Allure server and tox
ENTRYPOINT ["tox"]
# ENTRYPOINT [ "bash" ]
# ENTRYPOINT [ "bash" ]
63 changes: 18 additions & 45 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pages.record_vaccinated_page import *
from pages.vaccines_choose_site_page import *
from pages.vaccines_choose_vaccine_page import *
from pages.vaccines_add_batch_page import *
from pages.site_vaccines_add_batch_page import *
from pages.vaccines_view_products_page import *
from init_helpers import *
from datetime import datetime, timedelta
Expand Down Expand Up @@ -51,18 +51,19 @@ def format_nhs_number(nhs_number):
formatted_number = re.sub(r"(\d{3})(\d{3})(\d{4})", r"\1 \2 \3", nhs_number)
return formatted_number

@pytest.fixture(scope='function')
def playwright_helper(request):
helper = PlaywrightHelper(get_working_directory(), config)
def teardown():
try:
helper.quit_browser()
except Exception as e:
print(f"An error occurred during teardown: {e}")
raise

request.addfinalizer(teardown)
return helper

# @pytest.fixture(scope='function')
# def playwright_helper(request):
# helper = PlaywrightHelper(get_working_directory(), config)
# def teardown():
# try:
# helper.quit_browser()
# except Exception as e:
# print(f"An error occurred during teardown: {e}")
# raise

# request.addfinalizer(teardown)
# return helper

# Fixture for site parameter
@pytest.fixture(params=["NEELIMA HOUSE", "ALBERT HOUSE", "ST JOHN'S HOUSE"])
Expand Down Expand Up @@ -111,12 +112,6 @@ def navigate_to_ravs(request):
def click_back_button_recording_consent(request):
click_back_button()

# Fixture for logging in and navigating to appointments
@pytest.fixture(scope='function')
def login_and_navigate_to_appointments(site, care_model, navigate_and_login):
click_continue_to_record_a_vaccination_homepage()
click_appointments_nav_link()

def set_vaccinator_location(site, care_model):
select_site(site)
select_care_model(care_model)
Expand All @@ -143,7 +138,6 @@ def login_and_navigate_to_appointments_open_first_patient(request, navigate_and_
attach_screenshot("user_has_selected_care_model")
click_continue_to_record_a_vaccination_homepage()
attach_screenshot("user_has_clicked_continue_to_ravs_homepage")
click_appointments_nav_link()
current_date = datetime.now()
fromDate = datetime(2023, 12, 1)
set_from_date(fromDate)
Expand All @@ -167,32 +161,11 @@ def login_and_find_a_patient_by_nhs_number(request, login_and_navigate_to_find_a
enter_nhs_number(nhs_number)
click_search_for_patient_button()

# Fixture for navigating to find a patient by PDS search page
@pytest.fixture(scope='function')
def login_and_navigate_to_find_a_patient_by_pds_search_page(request):
# set_vaccinator_location()
click_pds_search_nav_link()

# Fixture for navigating to appointments open first patient and clicking choose vaccine
@pytest.fixture(scope='function')
def goto_appointments_open_first_patient_and_click_choose_vaccine(request, login_and_navigate_to_appointments_open_first_patient):
click_choose_vaccine_button()

# Fixture for navigating to appointments open first patient and clicking choose covid vaccine
@pytest.fixture(scope='function')
def goto_appointments_open_first_patient_and_click_choose_covid_vaccine(request, goto_appointments_open_first_patient_and_click_choose_vaccine):
click_covid_radiobutton()

# Fixture for navigating to appointments open first patient and clicking choose seasonal flu vaccine
@pytest.fixture(scope='function')
def goto_appointments_open_first_patient_and_click_choose_seasonal_flu_vaccine(request, goto_appointments_open_first_patient_and_click_choose_vaccine):
click_flu_radiobutton()

# # Fixture for selecting covid vaccine and going to record consent
# @pytest.fixture(scope='function')
# def select_covid_vaccine_and_goto_record_consent(request, goto_appointments_open_first_patient_and_click_choose_covid_vaccine):
# click_continue_to_record_consent_button()

# Fixture for logging out
@pytest.fixture(scope='function')
def logout(request, navigate_and_login):
Expand Down Expand Up @@ -229,15 +202,15 @@ def click_on_patient_search_result_and_click_choose_vaccine(name, vaccine):

def choose_vaccine_and_vaccine_type_for_patient(site, vaccine, vaccine_type):
click_delivery_team_radiobutton(site)
click_consent_vaccine_radiobutton(vaccine)
click_consent_vaccine_type_radiobutton(vaccine_type)
click_vaccine_radiobutton(vaccine)
click_vaccine_type_radiobutton(vaccine_type)
click_continue_to_assess_patient_button()
attach_screenshot("selected_vaccine_" + vaccine + "_and_" + vaccine_type + "_and_clicked_continue_button")

def choose_vaccine_and_vaccine_type_only(site, vaccine, vaccine_type):
click_delivery_team_radiobutton(site)
click_consent_vaccine_radiobutton(vaccine)
click_consent_vaccine_type_radiobutton(vaccine_type)
click_vaccine_radiobutton(vaccine)
click_vaccine_type_radiobutton(vaccine_type)
attach_screenshot("selected_vaccine_" + vaccine + "_and_" + vaccine_type)

def check_vaccine_and_batch_exists_in_site_api_request(site, vaccine, vaccineType, batch_number, expirydate):
Expand Down
16 changes: 12 additions & 4 deletions features/add_batches.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ Feature: Add Batches to vaccine
And I click on an available add batch link
Then the add batch page should be launched

@addbatches
Scenario: Error messages should appear when no values are entered
Given I am logged into the RAVS app
When I am on the vaccines page
And I click on an available add batch link
And I click continue to confirm batch details page
Then the error messages and error links should appear highlighting missing required fields

@addbatches
Scenario Outline: Add batch to vaccine
Given I am on the RAVS home page
When I am on the vaccines page
And I view product for the <vaccine_type> on <site>
And I enter <batch_number>
And I view product for the existing vaccine in an existing site
And I enter batch number that already exists and expiry date
Then the batch is already added to site warning should appear

Examples:
| site | vaccine | vaccine_type | batch_number |
| NEELIMA HOUSE | COVID-19 | Spikevax JN.1 | AB2345-Y7890 |
| site | vaccine | vaccine_type | batch_number |
| ALBERT HOUSE | COVID-19 | Spikevax JN.1 | AB2345-Y7890 |
13 changes: 0 additions & 13 deletions features/add_vaccines.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,3 @@ Feature: Add vaccine to site
When I am on the vaccines page
And I click add vaccine button
Then the choose site page should be launched

@addvaccine
Scenario Outline: Vaccine already added to site warning should appear
Given I am on the RAVS home page
When I am on the vaccines page
And I click add vaccine button
And I select <site>, <vaccine>, <vaccineType>
Then the vaccine is already added to site warning should appear

Examples:
| site | vaccine | vaccineType |
| ALBERT HOUSE | COVID-19 | Spikevax JN.1 |
| ALBERT HOUSE | Flu | Flucelvax Tetra - QIVc |
1 change: 0 additions & 1 deletion features/find_a_patient.feature
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ Feature: Find a patient
And I enter the mandatory patient details <firstName>, <lastName>, and <dob>
When I click the search button
Then I can see a message that no results are found for the patient
And I can see an option to review the search tips
#And I can see an option to create a new patient

Examples:
Expand Down
Loading
Loading