mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
test: add scenario to handle 404 page
This commit is contained in:
parent
2b89d46a74
commit
d5e7f752aa
3 changed files with 13 additions and 2 deletions
|
@ -10,6 +10,8 @@ import Typography from '@material-ui/core/Typography/index';
|
|||
import { Wrapper, Inner, EmptyPackage, Heading, Card, List } from './styles';
|
||||
import PackageImg from './img/package.svg';
|
||||
|
||||
export const NOT_FOUND_TEXT = "Sorry, we couldn't find it...";
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const NotFound = ({ history, width }) => {
|
||||
const handleGoTo = to => () => {
|
||||
|
@ -42,7 +44,9 @@ const NotFound = ({ history, width }) => {
|
|||
<Wrapper>
|
||||
<Inner>
|
||||
<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()}
|
||||
<Card>{renderList()}</Card>
|
||||
</Inner>
|
||||
|
|
|
@ -152,4 +152,11 @@ describe('/ (Verdaccio Page)', () => {
|
|||
const text = await page.evaluate(() => document.querySelector('#help-card__title').textContent);
|
||||
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() {
|
||||
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;
|
||||
mkdirp.sync(DIR);
|
||||
fs.writeFileSync(path.join(DIR, 'wsEndpoint'), browser.wsEndpoint());
|
||||
|
|
Loading…
Reference in a new issue