Skip to content
Merged
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
104 changes: 54 additions & 50 deletions tests/categories.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ test('user can view category details', async ({ page }) => {
})
).toBeVisible()

await expect(page.getByText('objects: commutative rings')).toBeVisible()
await expect(page.getByText('morphisms: ring homomorphisms')).toBeVisible()
const body = page.locator('body')

await expect(body).toContainText('Objects: commutative rings')
await expect(body).toContainText('Morphisms: ring homomorphisms')
await expect(page.getByRole('link', { name: 'nLab link' })).toBeVisible()
await expect(page.getByText('is cocomplete')).toBeVisible()
await expect(page.getByText('is locally finitely presentable')).toBeVisible()
await expect(page.getByText('is not additive')).toBeVisible()
await expect(page.getByText('is not balanced')).toBeVisible()
await expect(page.getByText('terminal object: zero ring')).toBeVisible()
await expect(page.getByText('coproducts: tensor products')).toBeVisible()
await expect(
page.getByText('regular epimorphisms: surjective morphisms')
).toBeVisible()
await expect(body).toContainText('is cocomplete')
await expect(body).toContainText('is locally finitely presentable')
await expect(body).toContainText('is not additive')
await expect(body).toContainText('is not balanced')
await expect(body).toContainText('terminal object: zero ring')
await expect(body).toContainText('coproducts: tensor products')
await expect(body).toContainText('regular epimorphisms: surjective morphisms')
})

test('user sees no unknown properties for the category of sets', async ({ page }) => {
Expand All @@ -137,15 +137,13 @@ test('user may see unknown properties', async ({ page }) => {
})
).toBeVisible()

const unknown_properties_section = page
.locator('section', {
hasText: 'Unknown properties'
})
.first()
const unknown_properties_section = page.locator('section', {
hasText: 'Unknown properties'
})

const unknown_property_link = unknown_properties_section.locator('li').first()
const link = unknown_properties_section.locator('li').first()

await expect(unknown_property_link).toBeVisible()
await expect(link).toBeVisible()
})

test('user may see undecidable properties', async ({ page }) => {
Expand All @@ -158,11 +156,9 @@ test('user may see undecidable properties', async ({ page }) => {
})
).toBeVisible()

const undecidable_properties_section = page
.locator('section', {
hasText: 'Undecidable properties'
})
.first()
const undecidable_properties_section = page.locator('section', {
hasText: 'Undecidable properties'
})

const link = undecidable_properties_section.getByRole('link', {
name: 'accessible',
Expand All @@ -184,11 +180,9 @@ test('user may see properties that cannot be determined in a family of categorie
})
).toBeVisible()

const undecidable_properties_section = page
.locator('section', {
hasText: 'Undecidable properties'
})
.first()
const undecidable_properties_section = page.locator('section', {
hasText: 'Undecidable properties'
})

const link = undecidable_properties_section.getByRole('link', {
name: 'finite',
Expand All @@ -202,6 +196,7 @@ test('user can navigate to a related category', async ({ page }) => {
await page.goto('/category/FinSet', { waitUntil: 'networkidle' })

await page
.locator('li', { hasText: 'Related categories:' })
.getByRole('link', {
name: 'category of sets',
exact: true
Expand Down Expand Up @@ -230,11 +225,8 @@ test('user can navigate to the dual category if it exists in the database', asyn
})
).toBeVisible()

const item = page.locator('li', {
hasText: 'Dual category'
})

await item
await page
.locator('li', { hasText: 'Dual category' })
.getByRole('link', {
name: 'dual of the category of sets',
exact: true
Expand All @@ -255,6 +247,7 @@ test('user can navigate to a child category', async ({ page }) => {
await page.goto('/category/BG', { waitUntil: 'networkidle' })

await page
.locator('li', { hasText: 'Children:' })
.getByRole('link', {
name: 'delooping of a non-trivial finite group',
exact: true
Expand All @@ -275,11 +268,11 @@ test('user can navigate to a parent category', async ({ page }) => {
await page.goto('/category/Ring', { waitUntil: 'networkidle' })

await page
.locator('li', { hasText: 'Parent:' })
.getByRole('link', {
name: 'category of algebras',
exact: true
})
.first()
.click()

await expect(
Expand All @@ -295,7 +288,7 @@ test('user can navigate to a parent category', async ({ page }) => {
test('user can open and close a proof for a property of a category', async ({ page }) => {
await page.goto('/category/Grp', { waitUntil: 'networkidle' })

const claim = page.locator('li', { has: page.getByText('is mono-regular') })
const claim = page.locator('li', { hasText: 'is mono-regular' })

await expect(claim).toBeVisible()

Expand Down Expand Up @@ -331,69 +324,67 @@ test('user can open a proof for a deduced satisfied property of category', async
}) => {
await page.goto('/category/Ring', { waitUntil: 'networkidle' })

const claim = page.locator('li', { has: page.getByText('has an extremal generator') })
const claim = page.locator('li', { hasText: 'has an extremal generator' })

await expect(claim).toBeVisible()

await claim.locator('button').click()

const popup = page.locator('.popup').filter({ hasText: 'Proof' })

await expect(
popup.getByText(
'Since it is one-sorted finitary algebraic, it has an extremal generator'
)
).toBeVisible()
await expect(popup).toContainText(
'Since it is one-sorted finitary algebraic, it has an extremal generator'
)
})

test('user can open a proof for a deduced unsatisfied property of a category', async ({
page
}) => {
await page.goto('/category/Ab', { waitUntil: 'networkidle' })

const claim = page.locator('li', { has: page.getByText('is not cartesian closed') })
const claim = page.locator('li', { hasText: 'is not cartesian closed' })

await expect(claim).toBeVisible()

await claim.locator('button').click()

const popup = page.locator('.popup').filter({ hasText: 'Proof' })

await expect(
popup.getByText('Assume for contradiction that it is cartesian closed.')
).toBeVisible()
await expect(popup).toContainText(
'Assume for contradiction that it is cartesian closed.'
)
})

test('user can open a proof for an inherited satisfied property of a category', async ({
page
}) => {
await page.goto('/category/Ab', { waitUntil: 'networkidle' })

const claim = page.locator('li', { has: page.getByText('is abelian') })
const claim = page.locator('li', { hasText: 'is abelian' })

await expect(claim).toBeVisible()

await claim.locator('button').click()

const popup = page.locator('.popup').filter({ hasText: 'Proof' })

await expect(popup.getByText('This follows from the parent.')).toBeVisible()
await expect(popup).toContainText('This follows from the parent.')
})

test('user can open a proof for an inherited unsatisfied property of a category', async ({
page
}) => {
await page.goto('/category/BG_f', { waitUntil: 'networkidle' })

const claim = page.locator('li', { has: page.getByText('is not thin') })
const claim = page.locator('li', { hasText: 'is not thin' })

await expect(claim).toBeVisible()

await claim.locator('button').click()

const popup = page.locator('.popup').filter({ hasText: 'Proof' })

await expect(popup.getByText('This follows from the parent.')).toBeVisible()
await expect(popup).toContainText('This follows from the parent.')
})

test('user sees functors associated with the given category', async ({ page }) => {
Expand All @@ -414,7 +405,7 @@ test('user sees functors associated with the given category', async ({ page }) =
).toBeVisible()
})

test('user sees morphisms stored for the given category', async ({ page }) => {
test('user sees morphisms associated with the given category', async ({ page }) => {
await page.goto('/category/Grp', { waitUntil: 'networkidle' })

await expect(
Expand All @@ -431,3 +422,16 @@ test('user sees morphisms stored for the given category', async ({ page }) => {
})
).toBeVisible()
})

test('user sees symmetric monoidal categories for the given category', async ({
page
}) => {
await page.goto('/category/Top', { waitUntil: 'networkidle' })

await expect(
page.getByRole('link', {
name: 'cartesian symmetric monoidal category of topological spaces',
exact: true
})
).toBeVisible()
})
31 changes: 15 additions & 16 deletions tests/category-comparison.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,26 @@ test('user can view comparison table', async ({ page }) => {
})
).toBeVisible()

await expect(page.getByText('category of rings')).toBeVisible()
await expect(page.getByText('category of commutative rings')).toBeVisible()
const body = page.locator('body')
await expect(body).toContainText('category of rings')
await expect(body).toContainText('category of commutative rings')

const table = page.getByRole('table')
await expect(table).toBeVisible()

const table_except = {
abelian: ['no', 'no'],
generator: ['yes', 'yes'],
cocomplete: ['yes', 'yes'],
coextensive: ['no', 'yes']
}
const table_excerpt = [
['abelian', 'no', 'no'],
['generator', 'yes', 'yes'],
['cocomplete', 'yes', 'yes'],
['coextensive', 'no', 'yes']
]

for (const [prop, values] of Object.entries(table_except)) {
const row = table
.locator('tbody tr', {
has: page.getByRole('link', { name: prop, exact: true })
})
.first()
for (const [prop, value_1, value_2] of table_excerpt) {
const row = table.locator('tbody tr', {
has: page.getByRole('link', { name: prop, exact: true })
})
await expect(row).toBeVisible()
await expect(row.locator('td').nth(1)).toHaveAttribute('aria-label', values[0])
await expect(row.locator('td').nth(2)).toHaveAttribute('aria-label', values[1])
await expect(row.locator('td').nth(1)).toHaveAttribute('aria-label', value_1)
await expect(row.locator('td').nth(2)).toHaveAttribute('aria-label', value_2)
}
})
2 changes: 1 addition & 1 deletion tests/category-implications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test('user can see the details of an implication', async ({ page }) => {
})
).toBeVisible()

await expect(page.getByText('Proof: This holds by definition')).toBeVisible()
await expect(page.locator('body')).toContainText('Proof: This holds by definition')
})

test('user can open the list of deduced implications', async ({ page }) => {
Expand Down
28 changes: 14 additions & 14 deletions tests/category-properties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ test('user can view category property details', async ({ page }) => {
})
).toBeVisible()

await expect(page.getByText('A category is finitely accessible if')).toBeVisible()
await expect(page.locator('body')).toContainText(
'A category is finitely accessible if'
)

await expect(
page.getByRole('link', {
const related_link = page
.locator('li', { hasText: 'Related properties:' })
.getByRole('link', {
name: 'accessible',
exact: true
})
).toBeVisible()

await expect(related_link).toBeVisible()

const examples = page
.getByRole('heading', {
Expand Down Expand Up @@ -111,11 +115,8 @@ test('user can navigate to the dual property', async ({ page }) => {
})
).toBeVisible()

const item = page.locator('li', {
hasText: 'Dual property'
})

await item
await page
.locator('li', { hasText: 'Dual property:' })
.getByRole('link', {
name: 'coequalizers',
exact: true
Expand All @@ -136,11 +137,10 @@ test('user sees no unknown categories for the property of being additive', async
page
}) => {
await page.goto('/category-property/additive')
await expect(
page.getByText(
'There are 0 categories for which the database has no information on whether they satisfy this property'
)
).toBeVisible()

await expect(page.locator('body')).toContainText(
'There are 0 categories for which the database has no information on whether they satisfy this property'
)
})

test("user can navigate to properties tagged with 'colimits' from the property list page", async ({
Expand Down
Loading