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

[Tech Debt] Update tests to be able to run against live staging/production environments #146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

levinmr
Copy link
Member

@levinmr levinmr commented Nov 12, 2024

No description provided.

Copy link
Collaborator

@sanason sanason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m torn between this approach (where the running test site supports all different environments and the user of the test site chooses which one to use on a page-by-page basis at runtime with query params) vs an approach where the test site environment is set at execution-time (via something like npm run test-site-dev vs npm run test-site-staging).

I would guess that one is usually not switching environments during a single testing session (so the flexibility of approach 1 is less useful) and it’s probably simpler to execute a test if you don’t have to deal with setting the environment each time you load a page (so approach 2 would make it easier both to write automated tests and to perform manual tests against the test site).

let dapCodeLocation;
dapScriptTag.id = "_fed_an_ua_tag";
dapScriptTag.async = true;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There aren't any automated tests hitting it yet but I guess this would need to be replicated on the youtube.html page too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can something like Server Side Includes be used to insert this script in the <head> of every page in the test site? I should have thought about that when I first committed this file.

@levinmr
Copy link
Member Author

levinmr commented Nov 13, 2024

I’m torn between this approach (where the running test site supports all different environments and the user of the test site chooses which one to use on a page-by-page basis at runtime with query params) vs an approach where the test site environment is set at execution-time (via something like npm run test-site-dev vs npm run test-site-staging).

I would guess that one is usually not switching environments during a single testing session (so the flexibility of approach 1 is less useful) and it’s probably simpler to execute a test if you don’t have to deal with setting the environment each time you load a page (so approach 2 would make it easier both to write automated tests and to perform manual tests against the test site).

I agree that it would really odd to switch environments in the middle of a testing session, so we probably don't have to account for that case. The only advantage I can think of for keeping the env setting in the test runner is to be able to customize test expectations by environment. But this also seems to only be useful for a small set of tests currently that check for unexpected request hostnames and there are workarounds for it.

@sanason
Copy link
Collaborator

sanason commented Nov 15, 2024

I agree that it would really odd to switch environments in the middle of a testing session, so we probably don't have to account for that case. The only advantage I can think of for keeping the env setting in the test runner is to be able to customize test expectations by environment. But this also seems to only be useful for a small set of tests currently that check for unexpected request hostnames and there are workarounds for it.

I agree with your assessment. I think I prefer approach 2 (for ease of executing tests) however I don't feel strongly and I'm happy to approve this approach too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants