Skip to content

Commit

Permalink
chore: remove /blog from screenshot
Browse files Browse the repository at this point in the history
this screenshot is unstable, it is making a lot of false positives

Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Mar 8, 2024
1 parent cce30a7 commit 73c5676
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
29 changes: 29 additions & 0 deletions website-argos/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**********************************************************************
* Copyright (C) 2024 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import { expect, test } from '@playwright/test';
import { extractSitemapPathnames } from './utils';

const sitemapPath = '../website/build/sitemap.xml';

test('check /blog is not included', () => {
const allURLs = extractSitemapPathnames(sitemapPath);

// Check that /blog is not present
expect(allURLs).not.toContain('/blog');
});
22 changes: 20 additions & 2 deletions website-argos/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**********************************************************************
* Copyright (C) 2023-2024 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
***********************************************************************/

import * as cheerio from 'cheerio';
import * as fs from 'fs';

Expand All @@ -20,8 +38,8 @@ export function extractSitemapPathnames(sitemapPath: string): string[] {
urls.push($(this).text());
});

// filter out all /tags/ pages
urls = urls.filter(url => !url.includes('/tags/') && !url.endsWith('/tags'));
// filter out all /tags/ pages and /blog page
urls = urls.filter(url => !url.includes('/tags/') && !url.endsWith('/tags')).filter(url => !url.endsWith('/blog'));

let pathnames = urls.map(url => new URL(url).pathname);

Expand Down

0 comments on commit 73c5676

Please sign in to comment.