Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ The tests expect an active group to exist called "End to end tests", which the t

#### Starting forms-runner

Forms-runner needs to be started with:
- The Notify API key in order to send confirmation emails
- AWS credentials for the dev account in order to send submissions
Forms-runner needs to be started with AWS credentials for the dev account in order to send submissions.

```shell
gds aws forms-dev-readonly --shell

ASSUME_DEV_IAM_ROLE=true SETTINGS__GOVUK_NOTIFY__API_KEY=<notify-api-key> ./bin/rails server
ASSUME_DEV_IAM_ROLE=true ./bin/rails server
```

see the [README for forms-runner](https://github.com/govuk-forms/forms-runner?tab=readme-ov-file#getting-aws-credentials) for more details
Expand All @@ -51,9 +49,12 @@ SETTINGS__GOVUK_NOTIFY__API_KEY=<notify-api-key> ./bin/rails server

#### Running the tests

The tests then need to be run with AWS credentials for the dev account in order to check for the confirmation email.
You can run the tests against localhost using the following command:

```shell
gds aws forms-dev-readonly --shell

SETTINGS__GOVUK_NOTIFY__API_KEY=<your api key> bundle exec rake
```

Expand Down
1 change: 1 addition & 0 deletions bin/load_env_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function set_e2e_env_vars() {
export SETTINGS__GOVUK_NOTIFY__API_KEY="$(get_param /${environment}/automated-tests/e2e/notify/api-key)"
export SETTINGS__SUBMISSION_STATUS_API__SECRET="$(get_param /${environment}/automated-tests/e2e/runner/submission_status_api_shared_secret)"
export SETTINGS__FORMS_ENV="$environment"
export SETTINGS__CONFIRMATION_EMAIL="$(get_param /${environment}/automated-tests/e2e/confirmation-email)"
export SETTINGS__GOVUK_ONE_LOGIN__USER_EMAIL="$(get_param /${environment}/automated-tests/e2e/one-login/user-email)"
export SETTINGS__GOVUK_ONE_LOGIN__USER_PASSWORD="$(get_param /${environment}/automated-tests/e2e/one-login/user-password)"
export SETTINGS__GOVUK_ONE_LOGIN__USER_OTP_SECRET_KEY="$(get_param /${environment}/automated-tests/e2e/one-login/user-otp-secret-key)"
Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ govuk_one_login:

submission_status_api:
secret:

confirmation_email:
2 changes: 2 additions & 0 deletions config/settings/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ aws:

govuk_one_login:
user_email: copy-of-answers-emails-tests@dev.forms.service.gov.uk

confirmation_email: confirmation-email-tests@dev.forms.service.gov.uk
2 changes: 1 addition & 1 deletion spec/end_to_end/end_to_end_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# Testing confirmation email
logger.info
logger.info "Scenario: Form is completed by a member of the public, and they request a confirmation email"
form_is_filled_in_by_form_filler(live_form_link, confirmation_email: test_email_address)
form_is_filled_in_by_form_filler(live_form_link, confirmation_email: Settings.confirmation_email)

unless skip_copy_of_answers?
logger.info "Scenario: Form is completed by a member of the public, and they request a copy of their answers"
Expand Down
6 changes: 6 additions & 0 deletions spec/support/aws_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def get_submission_from_s3(submission_reference, form_id)
end
end

def wait_for_confirmation_email(submission_reference)
prefix = "confirmation-emails/"
email_match_string = "Your form reference number is #{submission_reference}"
wait_for_ses_email_delivered_to_s3(prefix, email_match_string, submission_reference)
end

def wait_for_copy_of_answers_email(submission_reference)
prefix = "copy-of-answers-emails/"
email_match_string = "Your form reference number is #{submission_reference}"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/feature_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def form_is_filled_in_by_form_filler(live_form_link, yes_branch: false, confirma
logger.info "When I have filled out a form and requested a confirmation email"
logger.info "Then I can see the confirmation in my email inbox"

wait_for_notification(confirmation_email_reference)
wait_for_confirmation_email(submission_reference)
end

if copy_of_answers
Expand Down