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

Add GOV.UK Chat tests #42

Merged
merged 1 commit into from
Oct 16, 2024
Merged
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
19 changes: 19 additions & 0 deletions tests/chat.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect } from "@playwright/test";
import { test } from "../lib/cachebust-test";
import { publishingAppUrl } from "../lib/utils";

test.describe("GOV.UK Chat", { tag: ["@app-govuk-chat"] }, () => {
test("Can view a static page", async ({ page }) => {
await page.goto("/chat/about");
Copy link

Choose a reason for hiding this comment

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

The Smokey test for this has a bit of logic within it to switch the host depending on the environment.

Chat is set up slightly differently on integration/staging vs prod currently. Chat is still in beta so it's only available via the external URL on prod. So a custom step definition was needed here to set the external URL differently on integration. Once we've got all environments consistent, we can delete this whole step definition file and just use the existing "When I visit x" definition.

(From alphagov/smokey#1332)

I can't tell if these e2e tests are running yet but it looks like from the helm charts that they are. So I'm wondering if this test will fail if it doesn't include the same logic as the Ruby test from Smokey.

Copy link
Contributor Author

@theseanything theseanything Oct 4, 2024

Choose a reason for hiding this comment

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

Currently this test will use the following URLs for each environments:

From my understanding of the smokey code, they should be?

(But slight confused as chat.integration.publishing.service.gov.uk redirects to www.integration.publishing.service.gov.uk/chat)

Copy link

Choose a reason for hiding this comment

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

Chat isn't live on production yet - the pilot is due to start on 14th October, at which point we'll enable the www.gov.uk/chat URL. But in order to test the infra works with the www domain on integration and staging, we've enabled that route on both of those environments and set up the redirect you were seeing.

So from today up until the 14th October, the URLs would be:

After launch the URLs would be:

We'll take responsibility of updating the production URL in this codebase once the pilot is live, but I think we'll need this test to use the www domain for int/staging and the non-www domain for production right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The behaviour the test should follow those after launch. As the only difference, prod url - which wouldn't stop deployments anyways.

await expect(page.getByRole("heading", { name: "About GOV.UK Chat" })).toBeVisible();
});
});

test.describe("GOV.UK Chat Admin", { tag: ["@app-govuk-chat"] }, () => {
test.use({ baseURL: publishingAppUrl("chat") });

test("Can log in to chat admin", async ({ page }) => {
await page.goto("/admin");
jackbot marked this conversation as resolved.
Show resolved Hide resolved
await expect(page.getByRole("heading", { name: "GOV.UK Chat Admin" })).toBeVisible();
});
});