Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export const config = {
export const identifier = {
about: {
url: '/about',
jobs: '/about/jobs.php',
terms: '/about/terms.php',
bios: '/about/bios',
contact: '/about/contact',
credits: '/about/credits',
jobs: '/about/jobs',
news: '/about/news-stories',
terms: '/about/terms',
volunteer: '/about/volunteer-positions',
},
av: {
url: '',
Expand All @@ -33,6 +37,11 @@ export const identifier = {
url: '/details',
default: '/details/theworksofplato01platiala',
},
legal: {
url: '/legal/',
affidavit: '/legal/affidavit',
faq: '/legal/faq'
},
lending: {
chromium: 'hitrun0000haro',
firefox: 'cornellstudiesin26unse',
Expand Down Expand Up @@ -83,6 +92,13 @@ export const identifier = {
url: '',
default: '/search',
},
static: {
url: '',
bookserver: '/bookserver',
petabox: '/web/petabox',
scanning: '/scanning',
sflan: '/web/sflan',
}
};

export const testBeforeEachConfig = async (context: BrowserContext) => {
Expand Down
16 changes: 9 additions & 7 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ const reportName = () => `${process.env.CATEGORY}/${formattedDateTime()}`;

/**
* See https://playwright.dev/docs/test-configuration.
*
*
* Timeouts are set by `ms`.
* Can be modified if needed
*/
export default defineConfig({
workers: 5,
workers: 3,
// Give failing tests 3 retry attempts
retries: 3,
// Timeout for each test
timeout: 5 * 60 * 1000, // 5 mins
timeout: 5 * 60 * 1000, // 5 mins
// Maximum time the whole test suite can run
globalTimeout: 20 * 60 * 1000, // 20 mins
globalTimeout: 20 * 60 * 1000, // 20 mins
testDir: './tests',
reporter: [
[
Expand All @@ -40,13 +42,13 @@ export default defineConfig({
],
],
expect: {
timeout: 2 * 60 * 1000, // set to 2min
timeout: 2 * 60 * 1000, // set to 2min
},
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// This is set in config/index.ts
baseURL: config.baseURL,
actionTimeout: 2 * 60 * 1000, // set to 2min
actionTimeout: 2 * 60 * 1000, // set to 2min
screenshot: 'only-on-failure',
},

Expand All @@ -56,7 +58,7 @@ export default defineConfig({
name: 'Desktop - Chromium',
use: {
...devices['Desktop Chrome'],
ignoreHTTPSErrors: true, // this is needed to avoid getting warnings like: the website is not safe
ignoreHTTPSErrors: true, // this is needed to avoid getting warnings like: the website is not safe
},
},
{
Expand Down
45 changes: 38 additions & 7 deletions tests/about/about.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,45 @@ test('Canonical About page has correct title and text', async ({ page }) => {
await expect(page.locator('news-stories')).toBeVisible();
});

test('About > Bios page has correct title and text', async ({ page }) => {
await page.goto(identifier.about.bios);
await expect(page).toHaveTitle(/Bios/);
await expect(page.locator('h1:has-text("Bios")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('A passionate advocate for public Internet access');
});

test('About > Contact page has correct title and text', async ({ page }) => {
await page.goto(identifier.about.contact);
await expect(page).toHaveTitle(/Contact/);
await expect(page.locator('h1:has-text("Contacts at the Internet Archive")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('300 Funston Avenue');
await expect(page.locator('#maincontent').locator('a:has-text("Frequently Asked Questions")')).toBeVisible();
});

test('About > Credits page has correct title and text', async ({ page }) => {
await page.goto(identifier.about.credits);
await expect(page).toHaveTitle(/Credits/);
await expect(page.locator('h1:has-text("Credits: Thank You from the Internet Archive")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('The Kahle/Austin Foundation');
});

test('About > Jobs page has correct title and text', async ({ page }) => {
await page.goto(identifier.about.jobs);
await expect(page).toHaveTitle(/Jobs/);
await expect(page.locator('h1:has-text("Job Opportunities")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('Based in San Francisco');
});

test('About > News Stories page has correct title and text', async ({page}) => {
await page.goto(identifier.about.news);
await page.waitForURL(/news-stories/);
await expect(page).toHaveTitle(/News Stories/);
await expect(page.locator('h1:has-text("News stories")')).toBeVisible();
await expect(page.locator('#main-content')).toContainText(
'Including The Wayback Machine',
);
});

test('About > Terms of Service page has correct title and text', async ({page}) => {
await page.goto(identifier.about.terms);
await expect(page).toHaveTitle(/Terms of Use/);
Expand All @@ -32,12 +64,11 @@ test('About > Terms of Service page has correct title and text', async ({page})
);
});

test('About > News Stories page has correct title and text', async ({page}) => {
await page.goto(identifier.about.news);
await page.waitForURL(/news-stories/);
await expect(page).toHaveTitle(/News Stories/);
await expect(page.locator('h1:has-text("News stories")')).toBeVisible();
await expect(page.locator('#main-content')).toContainText(
'Including The Wayback Machine',
test('About > Volunteer Positions page has correct title and text', async ({page}) => {
await page.goto(identifier.about.volunteer);
await expect(page).toHaveTitle(/Volunteer Positions/);
await expect(page.locator('h1:has-text("Volunteer Positions")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText(
'We could always use a hand',
);
});
28 changes: 28 additions & 0 deletions tests/legal/legal.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { test, expect } from '@playwright/test';

import { identifier, testBeforeEachConfig } from '../../config';

test.beforeEach(async ({ context }) => {
await testBeforeEachConfig(context);
});

test('Main Legal page has correct title and text', async ({ page }) => {
await page.goto(identifier.legal.url);
await expect(page).toHaveTitle(/Internet Archive: Legal: Requests/);
await expect(page.locator('h1:has-text("Information Requests")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('The following sets forth');
});

test('Legal > Affidavit page has correct title and text', async ({ page }) => {
await page.goto(identifier.legal.affidavit);
await expect(page).toHaveTitle(/Internet Archive: Legal: Affidavit/);
await expect(page.locator('h1:has-text("Standard Affidavit")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('I am a Records Request Processor at the Internet Archive');
});

test('Legal > FAQ page has correct title and text', async ({ page }) => {
await page.goto(identifier.legal.faq);
await expect(page).toHaveTitle(/Internet Archive: Legal FAQ/);
await expect(page.locator('h1:has-text("FREQUENTLY ASKED QUESTIONS")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('Do I really need an affidavit');
});
35 changes: 35 additions & 0 deletions tests/static/static.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from '@playwright/test';

import { identifier, testBeforeEachConfig } from '../../config';

test.beforeEach(async ({ context }) => {
await testBeforeEachConfig(context);
});

test('Bookserver page has correct title and text', async ({ page }) => {
await page.goto(identifier.static.bookserver);
await expect(page).toHaveTitle(/Internet Archive: A Future for Books -- BookServer/);
await expect(page.locator('h1:has-text("A Future for Books -- BookServer")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('The widespread success of digital reading');
});

test('Scanning page has correct title and text', async ({ page }) => {
await page.goto(identifier.static.scanning);
await expect(page).toHaveTitle(/Internet Archive: Digitization Services/);
await expect(page.locator('h1:has-text("Scanning Services")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('Open and free online discovery');
});

test('Web > Petabox page has correct title and text', async ({ page }) => {
await page.goto(identifier.static.petabox);
await expect(page).toHaveTitle(/Internet Archive: Petabox/);
await expect(page.locator('h1:has-text("Petabox")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('A few highlights from the Petabox');
});

test('Web > SFlan page has correct title and text', async ({ page }) => {
await page.goto(identifier.static.sflan);
await expect(page).toHaveTitle(/Internet Archive: SFLan/);
await expect(page.locator('h1:has-text("Community Wireless")')).toBeVisible();
await expect(page.locator('#maincontent')).toContainText('Internet access in bulk, delivered');
});
Loading