Add test notification tool (#28334)
* Add test notification tool * Add frontend styles * Remove option from admin view * Refactor create post and add translations * Fix several CI errors * Fix API and frontend snapshots * Refactor trailing and leading icon on buttons * Add different button states * i18n-extract * Fix wrong text * Add tests * Fix wrong string * Fix test * feat: E2E send test notifications (#28371) * Refactor send desktop notification * Address rest of the feedback * Fix tests * Add correct link * Fix test --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
30a6ddc995
Коммит
118d0346ee
@@ -1178,6 +1178,37 @@ func TestCreatePost(t *testing.T) {
|
||||
|
||||
wg.Wait()
|
||||
})
|
||||
|
||||
t.Run("should sanitize the force notifications prop if the flag is not set", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.AddUserToChannel(th.BasicUser, th.BasicChannel)
|
||||
|
||||
postToCreate := &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "hello world",
|
||||
UserId: th.BasicUser.Id,
|
||||
}
|
||||
postToCreate.AddProp(model.PostPropsForceNotification, model.NewId())
|
||||
createdPost, err := th.App.CreatePost(th.Context, postToCreate, th.BasicChannel, model.CreatePostFlags{})
|
||||
require.Nil(t, err)
|
||||
require.Empty(t, createdPost.GetProp(model.PostPropsForceNotification))
|
||||
})
|
||||
|
||||
t.Run("should add the force notifications prop if the flag is set", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.AddUserToChannel(th.BasicUser, th.BasicChannel)
|
||||
|
||||
postToCreate := &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "hello world",
|
||||
UserId: th.BasicUser.Id,
|
||||
}
|
||||
createdPost, err := th.App.CreatePost(th.Context, postToCreate, th.BasicChannel, model.CreatePostFlags{ForceNotification: true})
|
||||
require.Nil(t, err)
|
||||
require.NotEmpty(t, createdPost.GetProp(model.PostPropsForceNotification))
|
||||
})
|
||||
}
|
||||
|
||||
func TestPatchPost(t *testing.T) {
|
||||
@@ -3739,3 +3770,13 @@ func TestPermanentDeletePost(t *testing.T) {
|
||||
assert.Len(t, infos, 0)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSendTestMessage(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
t.Run("Should create the post with the correct prop", func(t *testing.T) {
|
||||
post, result := th.App.SendTestMessage(th.Context, th.BasicUser.Id)
|
||||
assert.Nil(t, result)
|
||||
assert.NotEmpty(t, post.GetProp(model.PostPropsForceNotification))
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user