Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Element Web
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Element (formerly New Vector)
Element Web
Commits
14b0303e
Commit
14b0303e
authored
1 month ago
by
Half-Shot
Browse files
Options
Downloads
Patches
Plain Diff
Add brand tests
parent
1446550d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
playwright/e2e/modules/brand.spec.ts
+43
-0
43 additions, 0 deletions
playwright/e2e/modules/brand.spec.ts
playwright/sample-files/brand-module.js
+24
-0
24 additions, 0 deletions
playwright/sample-files/brand-module.js
with
67 additions
and
0 deletions
playwright/e2e/modules/brand.spec.ts
0 → 100644
+
43
−
0
View file @
14b0303e
/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import
{
type
Page
}
from
"
@playwright/test
"
;
import
{
test
,
expect
}
from
"
../../element-web-test
"
;
test
.
describe
(
"
Brand API
"
,
()
=>
{
test
.
use
({
displayName
:
"
Manny
"
,
botCreateOpts
:
{
autoAcceptInvites
:
true
,
},
config
:
{
modules
:
[
"
/modules/brand-module.js
"
],
},
page
:
async
({
page
},
use
)
=>
{
await
page
.
route
(
"
/modules/brand-module.js
"
,
async
(
route
)
=>
{
await
route
.
fulfill
({
path
:
"
playwright/sample-files/brand-module.js
"
});
});
await
use
(
page
);
},
room
:
async
({
page
,
app
,
user
,
bot
},
use
)
=>
{
const
roomId
=
await
app
.
client
.
createRoom
({
name
:
"
TestRoom
"
,
invite
:[
bot
.
credentials
.
userId
]
});
await
use
({
roomId
});
},
});
test
.
describe
(
"
basic functionality
"
,
()
=>
{
test
(
"
should replace the standard window title
"
,
async
({
page
,
room
,
app
,
user
,
bot
})
=>
{
await
page
.
goto
(
`/#/home`
);
// Default title
expect
(
await
page
.
title
()).
toEqual
(
"
MyBrand | OK | notifs=undefined | notifsenabled=undefined | roomId=undefined | roomName=undefined
"
);
await
app
.
viewRoomById
(
room
.
roomId
);
expect
(
await
page
.
title
()).
toEqual
(
`MyBrand | OK | notifs=undefined | notifsenabled=undefined | roomId=
${
room
.
roomId
}
| roomName=TestRoom`
);
},
);
});
This diff is collapsed.
Click to expand it.
playwright/sample-files/brand-module.js
0 → 100644
+
24
−
0
View file @
14b0303e
/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
export
default
class
CustomBrandModule
{
static
moduleApiVersion
=
"
^1.2.0
"
;
/**
*
* @param {import("@element-hq/element-web-module-api").Api} api
*/
constructor
(
api
)
{
this
.
api
=
api
;
this
.
api
.
brand
.
registerTitleRenderer
(({
errorDidOccur
,
notificationCount
,
notificationsEnabled
,
roomId
,
roomName
})
=>
{
return
`MyBrand |
${
errorDidOccur
?
"
ERROR
"
:
"
OK
"
}
| notifs=
${
notificationCount
}
| notifsenabled=
${
notificationsEnabled
}
| roomId=
${
roomId
}
| roomName=
${
roomName
}
`
});
this
.
api
.
brand
.
registerFaviconRenderer
(()
=>
{
return
`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAGMUExURQAAAHZNgHhuiXZQgXqYlX3Kon3IonZOgJPQsXrHoF0AGHmglnVLf7POxIOGlpjStXpwi5TRsoXLqHt5jY7OrorNq4fMqZ//4HZTgnZPgXuqmXjUonXEnFK4hHZNgHZNgHZMgHZMgHpqiY7Cq5LRsZD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GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==`
;
})
}
async
load
()
{}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment