2021-08-18 10:04:28 -04:00
|
|
|
// these tests do not sign in as a user
|
|
|
|
|
2020-10-02 16:53:52 -04:00
|
|
|
const SeleniumHelper = require('./selenium-helpers.js');
|
|
|
|
|
|
|
|
const {
|
|
|
|
clickText,
|
2023-04-11 09:05:06 -04:00
|
|
|
buildDriver,
|
2023-09-22 11:43:45 -04:00
|
|
|
findText,
|
2023-09-25 11:34:30 -04:00
|
|
|
navigate,
|
2023-09-22 11:43:45 -04:00
|
|
|
waitUntilDocumentReady
|
2020-10-02 16:53:52 -04:00
|
|
|
} = new SeleniumHelper();
|
|
|
|
|
2023-10-24 14:22:28 -04:00
|
|
|
const rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
|
2020-10-02 16:53:52 -04:00
|
|
|
|
2021-12-03 09:14:25 -05:00
|
|
|
jest.setTimeout(60000);
|
2020-10-02 16:53:52 -04:00
|
|
|
|
|
|
|
let driver;
|
|
|
|
|
|
|
|
describe('www-integration footer links', () => {
|
|
|
|
beforeAll(async () => {
|
|
|
|
driver = await buildDriver('www-integration footer links');
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
2023-09-25 11:34:30 -04:00
|
|
|
await navigate(rootUrl);
|
2023-04-11 09:05:06 -04:00
|
|
|
await findText('Create stories, games, and animations');
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
2023-10-24 14:22:28 -04:00
|
|
|
afterAll(() => driver.quit());
|
2020-10-02 16:53:52 -04:00
|
|
|
|
|
|
|
// ==== About Scratch column ====
|
|
|
|
|
|
|
|
test('click About Scratch link', async () => {
|
|
|
|
await clickText('About Scratch');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 15:42:59 -04:00
|
|
|
expect(pathname).toMatch(/^\/about\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click For Parents link', async () => {
|
|
|
|
await clickText('For Parents');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/parents\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click For Educators link', async () => {
|
|
|
|
await clickText('For Educators');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/educators\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click For Developers link', async () => {
|
|
|
|
await clickText('For Developers');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/developers\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ==== COMMUNITY column ====
|
|
|
|
|
|
|
|
test('click Community Guidelines link', async () => {
|
|
|
|
await clickText('Community Guidelines');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/community_guidelines\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click Discussion Forums link', async () => {
|
|
|
|
await clickText('Discussion Forums');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/discuss\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click Statistics link', async () => {
|
|
|
|
await clickText('Statistics');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/statistics\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ==== SUPPORT column ====
|
|
|
|
|
|
|
|
test('click Ideas link', async () => {
|
|
|
|
await clickText('Ideas');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/ideas\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click FAQ link', async () => {
|
|
|
|
await clickText('FAQ');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2021-08-05 13:55:11 -04:00
|
|
|
expect(pathname).toMatch(/^\/faq\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click Download link', async () => {
|
|
|
|
await clickText('Download');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/download\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click Contact Us link', async () => {
|
|
|
|
await clickText('Contact Us');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/contact-us\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// ==== LEGAL column ====
|
|
|
|
|
|
|
|
test('click Terms of Use link', async () => {
|
|
|
|
await clickText('Terms of Use');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/terms_of_use\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test('click Privacy Policy link', async () => {
|
|
|
|
await clickText('Privacy Policy');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/privacy_policy\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
2023-06-05 09:00:19 -04:00
|
|
|
test('click Cookies link', async () => {
|
|
|
|
await clickText('Cookies');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2023-06-05 09:00:19 -04:00
|
|
|
expect(pathname).toMatch(/^\/cookies\/?$/);
|
|
|
|
|
|
|
|
// Verify localization of last updated message
|
2023-10-18 17:59:21 -04:00
|
|
|
const lastUpdated = await findText('The Scratch Cookie Policy was last updated');
|
2023-10-24 14:22:28 -04:00
|
|
|
const lastUpdatedVisible = await lastUpdated.isDisplayed();
|
|
|
|
expect(lastUpdatedVisible).toBe(true);
|
2023-06-05 09:00:19 -04:00
|
|
|
});
|
|
|
|
|
2020-10-02 16:53:52 -04:00
|
|
|
test('click DMCA link', async () => {
|
|
|
|
await clickText('DMCA');
|
2023-09-22 11:43:45 -04:00
|
|
|
await waitUntilDocumentReady();
|
2023-10-24 14:22:28 -04:00
|
|
|
const url = await driver.getCurrentUrl();
|
|
|
|
const pathname = (new URL(url)).pathname;
|
2020-10-06 16:42:57 -04:00
|
|
|
expect(pathname).toMatch(/^\/DMCA\/?$/);
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
2024-10-11 07:03:32 -04:00
|
|
|
|
|
|
|
test('click DSA requirements link', async () => {
|
|
|
|
await clickText('DSA requirements');
|
|
|
|
await waitUntilDocumentReady();
|
|
|
|
const url = await driver.getCurrentUrl();
|
2024-10-16 13:45:53 -04:00
|
|
|
expect(url).toBe('https://www.scratchfoundation.org/dsa/');
|
|
|
|
|
|
|
|
const pocText = await findText('DSA-PoC@scratch.org'); // shouldn't change with localization
|
|
|
|
const pocTextVisible = await pocText.isDisplayed();
|
|
|
|
expect(pocTextVisible).toBeTruthy();
|
2024-10-11 07:03:32 -04:00
|
|
|
});
|
2020-10-02 16:53:52 -04:00
|
|
|
});
|
|
|
|
|
2023-09-22 16:32:06 -04:00
|
|
|
// The following links in the footer are skipped because they are not part of scratch-www
|
2020-10-02 16:53:52 -04:00
|
|
|
|
|
|
|
// Jobs
|
|
|
|
// Press
|
|
|
|
// SCRATCH STORE
|
|
|
|
// DONATE
|
|
|
|
// SCRATCH WIKI
|
|
|
|
// SCRATCH ED (SCRATCHED)
|
|
|
|
// SCRATCH JR (SCRATCHJR)
|
|
|
|
// SCRATCH DAY
|
|
|
|
// SCRATCH FOUNDATION
|
2023-09-22 16:32:06 -04:00
|
|
|
// Scratch Conference
|