Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
dec24e3f
Commit
dec24e3f
authored
8 years ago
by
Martin Schoeler
Browse files
Options
Downloads
Patches
Plain Diff
api settings changes test
parent
b561fd21
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/steps/12-settings.js
+108
-0
108 additions, 0 deletions
tests/steps/12-settings.js
tests/steps/13-permissions.js
+0
-0
0 additions, 0 deletions
tests/steps/13-permissions.js
with
108 additions
and
0 deletions
tests/steps/12-settings.js
0 → 100644
+
108
−
0
View file @
dec24e3f
/* eslint-env mocha */
/* globals expect */
/* eslint no-unused-vars: 0 */
import
supertest
from
'
supertest
'
;
const
request
=
supertest
(
'
http://localhost:3000
'
);
const
prefix
=
'
/api/v1/
'
;
import
flexTab
from
'
../pageobjects/flex-tab.page
'
;
import
mainContent
from
'
../pageobjects/main-content.page
'
;
import
sideNav
from
'
../pageobjects/side-nav.page
'
;
//test data imports
import
{
checkIfUserIsValid
}
from
'
../data/checks
'
;
import
{
adminUsername
,
adminEmail
,
adminPassword
,
username
,
email
,
password
}
from
'
../data/user.js
'
;
function
api
(
path
)
{
return
prefix
+
path
;
}
function
log
(
res
)
{
console
.
log
(
res
.
req
.
path
);
console
.
log
({
body
:
res
.
body
,
headers
:
res
.
headers
});
}
const
credentials
=
{
[
'
X-Auth-Token
'
]:
undefined
,
[
'
X-User-Id
'
]:
undefined
};
const
login
=
{
user
:
adminUsername
,
password
:
adminPassword
};
var
settingValue
=
{
value
:
undefined
};
describe
(
'
Changing settings via api
'
,
()
=>
{
before
((
done
)
=>
{
checkIfUserIsValid
(
username
,
email
,
password
);
sideNav
.
getChannelFromList
(
'
general
'
).
waitForExist
(
5000
);
sideNav
.
openChannel
(
'
general
'
);
request
.
post
(
api
(
'
login
'
))
.
send
(
login
)
.
expect
(
'
Content-Type
'
,
'
application/json
'
)
.
expect
(
200
)
.
expect
((
res
)
=>
{
credentials
[
'
X-Auth-Token
'
]
=
res
.
body
.
data
.
authToken
;
credentials
[
'
X-User-Id
'
]
=
res
.
body
.
data
.
userId
;
})
.
end
(
done
);
});
it
(
'
/login
'
,
()
=>
{
expect
(
credentials
).
to
.
have
.
property
(
'
X-Auth-Token
'
).
with
.
length
.
at
.
least
(
1
);
expect
(
credentials
).
to
.
have
.
property
(
'
X-User-Id
'
).
with
.
length
.
at
.
least
(
1
);
});
describe
(
'
message edit
'
,
()
=>
{
it
(
'
it should change the message editing via api
'
,
(
done
)
=>
{
request
.
post
(
api
(
'
settings/Message_AllowEditing
'
))
.
set
(
credentials
)
.
send
({
'
value
'
:
false
})
.
expect
(
'
Content-Type
'
,
'
application/json
'
)
.
expect
(
200
)
.
expect
((
res
)
=>
{
expect
(
res
.
body
).
to
.
have
.
property
(
'
success
'
,
true
);
})
.
end
(
done
);
});
it
(
'
should not show the edit messages
'
,
()
=>
{
browser
.
pause
(
100
);
mainContent
.
sendMessage
(
'
Message for Message Edit Block
'
);
mainContent
.
openMessageActionMenu
();
mainContent
.
messageEdit
.
isVisible
().
should
.
be
.
false
;
});
});
describe
(
'
message delete
'
,
()
=>
{
it
(
'
it should change the message deleting via api
'
,
(
done
)
=>
{
request
.
post
(
api
(
'
settings/Message_AllowDeleting
'
))
.
set
(
credentials
)
.
send
({
'
value
'
:
false
})
.
expect
(
'
Content-Type
'
,
'
application/json
'
)
.
expect
(
200
)
.
expect
((
res
)
=>
{
expect
(
res
.
body
).
to
.
have
.
property
(
'
success
'
,
true
);
})
.
end
(
done
);
});
it
(
'
should not show the delete messages
'
,
()
=>
{
browser
.
pause
(
100
);
mainContent
.
sendMessage
(
'
Message for Message delete Block
'
);
mainContent
.
openMessageActionMenu
();
mainContent
.
messageDelete
.
isVisible
().
should
.
be
.
false
;
});
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/steps/1
2-admin-setting
s.js
→
tests/steps/1
3-permission
s.js
+
0
−
0
View file @
dec24e3f
File moved
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