Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F21588784
sitemap.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
sitemap.test.ts
View Options
import
*
as
assert
from
"node:assert"
;
import
{
test
,
expect
}
from
"./backend-fixture"
;
test
(
"sitemap returns expected XML for empty DB"
,
async
({
backend
,
request
})
=>
{
const
response
=
await
request
.
get
(
`
${
backend
.
url
}
/sitemap.xml`
);
assert
.
strictEqual
(
response
.
status
(),
200
);
const
actual
=
await
response
.
text
();
const
expected
=
`<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>
${
backend
.
url
}
/</loc>
</url>
</urlset>
`
;
assert
.
strictEqual
(
actual
,
expected
);
});
test
(
"sitemap returns expected XML after creating a page via UI"
,
async
({
page
,
backend
,
request
,
})
=>
{
await
page
.
goto
(
backend
.
url
);
await
page
.
getByRole
(
"link"
,
{
name
:
"Go to Admin"
}).
click
();
await
page
.
getByPlaceholder
(
"text"
).
fill
(
"admin"
);
await
page
.
getByPlaceholder
(
"text"
).
press
(
"Tab"
);
await
page
.
getByPlaceholder
(
"password"
).
fill
(
"adminadmin"
);
await
page
.
getByRole
(
"button"
,
{
name
:
"Wyślij"
}).
click
();
await
page
.
getByRole
(
"link"
,
{
name
:
"Edit Pages"
}).
click
();
await
page
.
getByRole
(
"link"
,
{
name
:
"Create"
}).
click
();
await
page
.
getByLabel
(
"url"
).
fill
(
"/my-page/"
);
await
page
.
getByLabel
(
"title"
).
fill
(
"My Page"
);
await
page
.
getByLabel
(
"heading"
).
fill
(
"My Heading"
);
await
page
.
getByLabel
(
"description"
).
fill
(
"My Description"
);
await
page
.
getByRole
(
"button"
,
{
name
:
"Wyślij"
}).
click
();
const
response
=
await
request
.
get
(
`
${
backend
.
url
}
/sitemap.xml`
);
assert
.
strictEqual
(
response
.
status
(),
200
);
const
actual
=
await
response
.
text
();
const
expected
=
`<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>
${
backend
.
url
}
/</loc>
</url>
<url>
<loc>
${
backend
.
url
}
/my-page/</loc>
</url>
</urlset>
`
;
assert
.
strictEqual
(
actual
,
expected
);
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 7, 15:12 (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1181798
Default Alt Text
sitemap.test.ts (1 KB)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline