-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@web3-storage/website): add /account/payment page in website (#1744
) * feat(@web3-storage/website): stub /account/payment page in website * website: account/payment page has redirectTo='/login/' * add .parserOptions.{project,tsconfigRootDir} to packages/website/.eslintrc.js * test(website): add accountPayment.e2e test ensuring GET /account/payment with noauth redirects to /login/
- Loading branch information
Showing
7 changed files
with
83 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @fileoverview Account Payment Settings | ||
*/ | ||
|
||
import AccountPageData from '../../content/pages/app/account.json'; | ||
|
||
const PaymentSettingsPage = props => { | ||
const { dashboard } = AccountPageData.page_content; | ||
return ( | ||
<> | ||
<> | ||
<div className="page-container account-container"> | ||
<h1 className="table-heading">{dashboard.heading}</h1> | ||
<div className="account-content">{props.title}</div> | ||
</div> | ||
</> | ||
</> | ||
); | ||
}; | ||
|
||
/** | ||
* @returns {{ props: import('components/types').PageProps}} | ||
*/ | ||
export function getStaticProps() { | ||
return { | ||
props: { | ||
title: AccountPageData.seo.title, | ||
isRestricted: true, | ||
redirectTo: '/login/', | ||
}, | ||
}; | ||
} | ||
|
||
export default PaymentSettingsPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
import { E2EScreenshotPath } from './screenshots'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/'); | ||
}); | ||
|
||
test.describe('/account/payment', () => { | ||
test('redirects to /login/ when not authenticated', async ({ page }, testInfo) => { | ||
await Promise.all([ | ||
page.waitForNavigation({ | ||
waitUntil: 'networkidle', | ||
}), | ||
page.goto('/account/payment'), | ||
]); | ||
await expect(page).toHaveURL('/login/'); | ||
await page.screenshot({ | ||
fullPage: true, | ||
path: await E2EScreenshotPath(testInfo, `accountPayment-noauth`), | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { extname } from 'path'; | ||
|
||
import type { TestInfo } from '@playwright/test'; | ||
|
||
/** | ||
* Given a screenshot name, return an absolute path to a good place to store it. | ||
* The resulting path will be to a '.png' file unless 'name' already has an extname. | ||
* @param testInfo - @playwright/test TestInfo | ||
* @param name - logical name of screenshot | ||
* @returns absolute path to a good place to store a screenshot | ||
*/ | ||
export async function E2EScreenshotPath(testInfo: Pick<TestInfo, 'outputPath'>, name: string) { | ||
if (!extname(name)) { | ||
name = `${name}.png`; | ||
} | ||
const path = testInfo.outputPath(name); | ||
return path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters