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

[Journey] test journey execution with form only #1346

Merged
merged 12 commits into from
Jan 7, 2025
Prev Previous commit
Next Next commit
chore: journey fixture
  • Loading branch information
peschina committed Dec 17, 2024
commit 965e9fcbe075479672e3b32beec938a47ebe27d8
91 changes: 91 additions & 0 deletions apps/journey/e2e/fixtures/journeyFixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { test as base } from "./pageFixtures";
import { formUrl, journeyCreateUrl, mockRedirectUrl, noMessageText, noPaymentText, postSubmisionBtnLabel } from "../utils/constants";
import { JourneyTitlePage } from "../objects/journeyCreation/JourneyTitlePage";
import { JourneyFormPage } from "../objects/journeyCreation/JourneyFormPage";
import { JourneyPaymentPage } from "../objects/journeyCreation/JourneyPaymentPage";
import { JourneyMessagePage } from "../objects/journeyCreation/JourneyMessagePage";
import { JourneyPostSubmissionDetailsPage } from "../objects/journeyCreation/JourneyPostSubmissionDetailsPage";
import { ReviewPage } from "../objects/journeyCreation/ReviewPage";
import { DonePage } from "../objects/journeyCreation/DonePage";
import { createProviderAndPaymentRequest } from "../utils/payments";

type journeyFixtures = {
basicJourney: {
journeyLink: string;
journeyName: string;
};
journeyWithPayment: {
journeyLink: string;
journeyName: string;
};
};

export const test = base.extend<journeyFixtures>({
basicJourney: async ({ publicServantPage }, use) => {
const journeyName = `Test journey ${Date.now()}`;
await publicServantPage.goto(journeyCreateUrl);

const journeyTitlePage = new JourneyTitlePage(publicServantPage);
await journeyTitlePage.enterName(journeyName);
await journeyTitlePage.continue();

const journeyFormUrlPage = new JourneyFormPage(publicServantPage);
await journeyFormUrlPage.enterUrl(formUrl);
await journeyFormUrlPage.continue();

const journeyPaymentPage = new JourneyPaymentPage(publicServantPage);
await journeyPaymentPage.choosePaymentRequest(noPaymentText);
await journeyPaymentPage.continue();

const journeyMessagePage = new JourneyMessagePage(publicServantPage);
await journeyMessagePage.chooseMessage(noMessageText);
await journeyMessagePage.continue();

const journeyPostSubmissionPage = new JourneyPostSubmissionDetailsPage(publicServantPage);
await journeyPostSubmissionPage.enterButtonLabel(postSubmisionBtnLabel)
await journeyPostSubmissionPage.enterButtonLink(mockRedirectUrl);
await journeyPostSubmissionPage.continue();

const reviewPage = new ReviewPage(publicServantPage);
await reviewPage.continue();

const journeyLink = await new DonePage(publicServantPage).getJourneyLink();

await use({ journeyLink, journeyName });
},

journeyWithPayment: async ({ publicServantPage, request }, use) => {
const prName = `Test payment request ${Date.now()}`;
await createProviderAndPaymentRequest(request, prName);

const journeyName = `Test journey ${Date.now()}`;
await publicServantPage.goto(journeyCreateUrl);

const journeyTitlePage = new JourneyTitlePage(publicServantPage);
await journeyTitlePage.enterName(journeyName);
await journeyTitlePage.continue();

const journeyFormUrlPage = new JourneyFormPage(publicServantPage);
await journeyFormUrlPage.enterUrl(formUrl);
await journeyFormUrlPage.continue();

const journeyPaymentPage = new JourneyPaymentPage(publicServantPage);
await journeyPaymentPage.choosePaymentRequest(prName);
await journeyPaymentPage.continue();

const journeyMessagePage = new JourneyMessagePage(publicServantPage);
await journeyMessagePage.chooseMessage(noMessageText);
await journeyMessagePage.continue();

const journeyPostSubmissionPage = new JourneyPostSubmissionDetailsPage(publicServantPage);
await journeyPostSubmissionPage.enterButtonLabel(postSubmisionBtnLabel)
await journeyPostSubmissionPage.enterButtonLink(mockRedirectUrl);
await journeyPostSubmissionPage.continue();

await new ReviewPage(publicServantPage).continue();

const journeyLink = await new DonePage(publicServantPage).getJourneyLink();

await use({ journeyLink, journeyName });
},
});
8 changes: 3 additions & 5 deletions apps/journey/e2e/objects/MyGovIdMockLoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ export class MyGovIdMockLoginPage {
}

async expectCitizenPage() {
const heading = await this.page.getByRole("heading", {
name: "This is not for you!",
exact: true,
});
await expect(heading).toBeVisible();
await expect(await this.page.getByRole("heading", { name: "New messages" })).toBeVisible();
await expect(await this.page.getByRole("heading", { name: "Highlighted journeys" })).toBeVisible();
await expect(await this.page.getByRole("heading", { name: "Recently submitted journeys" })).toBeVisible();
}

async expectInactiveHomepage() {
Expand Down
5 changes: 4 additions & 1 deletion apps/journey/e2e/objects/journeyCreation/DonePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ export class DonePage {
await expect(this.header).toBeVisible();
await expect(this.shareLinkText).toBeVisible();
await expect(this.linkInput).toBeVisible();
await expect(this.linkInput.inputValue).toBeDefined();
await expect(this.linkInput.inputValue()).toBeDefined();
await expect(this.copyLinkBtn).toBeVisible();
await expect(this.backToDashboardLink).toBeVisible();
await expect(this.savedJourneyBanner).toBeVisible();
}

async getJourneyLink() {
return await this.linkInput.inputValue();
}
}