mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
test: add scenario to handle 404 page
This commit is contained in:
parent
2b89d46a74
commit
d5e7f752aa
@ -10,6 +10,8 @@ import Typography from '@material-ui/core/Typography/index';
|
|||||||
import { Wrapper, Inner, EmptyPackage, Heading, Card, List } from './styles';
|
import { Wrapper, Inner, EmptyPackage, Heading, Card, List } from './styles';
|
||||||
import PackageImg from './img/package.svg';
|
import PackageImg from './img/package.svg';
|
||||||
|
|
||||||
|
export const NOT_FOUND_TEXT = "Sorry, we couldn't find it...";
|
||||||
|
|
||||||
// eslint-disable-next-line react/prop-types
|
// eslint-disable-next-line react/prop-types
|
||||||
const NotFound = ({ history, width }) => {
|
const NotFound = ({ history, width }) => {
|
||||||
const handleGoTo = to => () => {
|
const handleGoTo = to => () => {
|
||||||
@ -42,7 +44,9 @@ const NotFound = ({ history, width }) => {
|
|||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Inner>
|
<Inner>
|
||||||
<EmptyPackage alt={'404 - Page not found'} src={PackageImg} />
|
<EmptyPackage alt={'404 - Page not found'} src={PackageImg} />
|
||||||
<Heading variant={isWidthUp('sm', width) ? 'h2' : 'h4'}>{"Sorry, we couldn't find it..."}</Heading>
|
<Heading className={'not-found-text'} variant={isWidthUp('sm', width) ? 'h2' : 'h4'}>
|
||||||
|
{NOT_FOUND_TEXT}
|
||||||
|
</Heading>
|
||||||
{renderSubTitle()}
|
{renderSubTitle()}
|
||||||
<Card>{renderList()}</Card>
|
<Card>{renderList()}</Card>
|
||||||
</Inner>
|
</Inner>
|
||||||
|
@ -152,4 +152,11 @@ describe('/ (Verdaccio Page)', () => {
|
|||||||
const text = await page.evaluate(() => document.querySelector('#help-card__title').textContent);
|
const text = await page.evaluate(() => document.querySelector('#help-card__title').textContent);
|
||||||
expect(text).toMatch('No Package Published Yet');
|
expect(text).toMatch('No Package Published Yet');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should go to 404 page', async () => {
|
||||||
|
await page.goto('http://0.0.0.0:55552/-/web/detail/@verdaccio/not-found');
|
||||||
|
await page.waitFor(500);
|
||||||
|
const text = await page.evaluate(() => document.querySelector('.not-found-text').textContent);
|
||||||
|
expect(text).toMatch("Sorry, we couldn't find it...");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
|
|||||||
|
|
||||||
module.exports = async function() {
|
module.exports = async function() {
|
||||||
console.log(chalk.green('Setup Puppeteer'));
|
console.log(chalk.green('Setup Puppeteer'));
|
||||||
const browser = await puppeteer.launch({headless: true});
|
const browser = await puppeteer.launch({headless: true, /* slowMo: 300 */ });
|
||||||
global.__BROWSER__ = browser;
|
global.__BROWSER__ = browser;
|
||||||
mkdirp.sync(DIR);
|
mkdirp.sync(DIR);
|
||||||
fs.writeFileSync(path.join(DIR, 'wsEndpoint'), browser.wsEndpoint());
|
fs.writeFileSync(path.join(DIR, 'wsEndpoint'), browser.wsEndpoint());
|
||||||
|
Loading…
Reference in New Issue
Block a user