Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a0ce51e7
authored
Jan 05, 2020
by
Johannes Zellner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add update tests
1 parent
7266acab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
15 deletions
test/test.js
test/test.js
View file @
a0ce51e
...
...
@@ -23,7 +23,7 @@ if (!process.env.USERNAME || !process.env.PASSWORD) {
describe
(
'Application life cycle test'
,
function
()
{
this
.
timeout
(
0
);
const
EXEC_
OPTION
S
=
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
};
const
EXEC_
ARG
S
=
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
};
const
LOCATION
=
'test'
;
const
TEST_TIMEOUT
=
10000
;
const
TEST_FILE_NAME_0
=
'index.html'
;
...
...
@@ -40,6 +40,12 @@ describe('Application life cycle test', function () {
browser
.
quit
();
});
function
getAppInfo
()
{
var
inspect
=
JSON
.
parse
(
execSync
(
'cloudron inspect'
));
app
=
inspect
.
apps
.
filter
(
function
(
a
)
{
return
a
.
location
===
LOCATION
;
})[
0
];
expect
(
app
).
to
.
be
.
an
(
'object'
);
}
function
waitForElement
(
elem
)
{
return
browser
.
wait
(
until
.
elementLocated
(
elem
),
TEST_TIMEOUT
).
then
(
function
()
{
return
browser
.
wait
(
until
.
elementIsVisible
(
browser
.
findElement
(
elem
)),
TEST_TIMEOUT
);
...
...
@@ -126,15 +132,11 @@ describe('Application life cycle test', function () {
done
();
}
xit
(
'build app'
,
function
()
{
execSync
(
'cloudron build'
,
EXEC_
OPTION
S
);
});
xit
(
'build app'
,
function
()
{
execSync
(
'cloudron build'
,
EXEC_
ARG
S
);
});
it
(
'install app'
,
function
()
{
execSync
(
`cloudron install --location
${
LOCATION
}
`
,
EXEC_
OPTION
S
);
});
it
(
'install app'
,
function
()
{
execSync
(
`cloudron install --location
${
LOCATION
}
`
,
EXEC_
ARG
S
);
});
it
(
'can get app information'
,
function
()
{
var
inspect
=
JSON
.
parse
(
execSync
(
'cloudron inspect'
));
app
=
inspect
.
apps
.
filter
(
function
(
a
)
{
return
a
.
location
===
LOCATION
;
})[
0
];
expect
(
app
).
to
.
be
.
an
(
'object'
);
});
it
(
'can get app information'
,
getAppInfo
);
it
(
'can login'
,
login
);
it
(
'can cli login'
,
cliLogin
);
...
...
@@ -150,8 +152,8 @@ describe('Application life cycle test', function () {
it
(
'second file is gone'
,
checkFileIsGone
.
bind
(
null
,
TEST_FILE_NAME_1
));
it
(
'can logout'
,
logout
);
it
(
'backup app'
,
function
()
{
execSync
(
`cloudron backup create --app
${
app
.
id
}
`
,
EXEC_
OPTION
S
);
});
it
(
'restore app'
,
function
()
{
execSync
(
`cloudron restore --app
${
app
.
id
}
`
,
EXEC_
OPTION
S
);
});
it
(
'backup app'
,
function
()
{
execSync
(
`cloudron backup create --app
${
app
.
id
}
`
,
EXEC_
ARG
S
);
});
it
(
'restore app'
,
function
()
{
execSync
(
`cloudron restore --app
${
app
.
id
}
`
,
EXEC_
ARG
S
);
});
it
(
'can login'
,
login
);
it
(
'file is listed'
,
checkFileIsListed
.
bind
(
null
,
TEST_FILE_NAME_0
));
...
...
@@ -165,16 +167,46 @@ describe('Application life cycle test', function () {
// ensure we don't hit NXDOMAIN in the mean time
browser
.
get
(
'about:blank'
).
then
(
function
()
{
execSync
(
`cloudron configure --location
${
LOCATION
}
2 --app
${
app
.
id
}
`
,
EXEC_
OPTION
S
);
execSync
(
`cloudron configure --location
${
LOCATION
}
2 --app
${
app
.
id
}
`
,
EXEC_
ARG
S
);
var
inspect
=
JSON
.
parse
(
execSync
(
'cloudron inspect'
));
app
=
inspect
.
apps
.
filter
(
function
(
a
)
{
return
a
.
location
===
LOCATION
+
'2'
;
})[
0
];
expect
(
app
).
to
.
be
.
an
(
'object'
);
getAppInfo
();
done
();
});
});
it
(
'can login'
,
login
);
it
(
'file is listed'
,
checkFileIsListed
.
bind
(
null
,
TEST_FILE_NAME_0
));
it
(
'file is served up'
,
checkFileIsPresent
);
it
(
'file is served up'
,
checkIndexFileIsServedUp
);
it
(
'can logout'
,
logout
);
it
(
'uninstall app'
,
function
(
done
)
{
// ensure we don't hit NXDOMAIN in the mean time
browser
.
get
(
'about:blank'
).
then
(
function
()
{
execSync
(
`cloudron uninstall --app
${
app
.
id
}
`
,
EXEC_ARGS
);
done
();
});
});
// test update
it
(
'can install app'
,
function
()
{
execSync
(
`cloudron install --appstore-id io.cloudron.surfer --location
${
LOCATION
}
`
,
EXEC_ARGS
);
});
it
(
'can get app information'
,
getAppInfo
);
it
(
'can login'
,
login
);
it
(
'can cli login'
,
cliLogin
);
it
(
'can upload file'
,
uploadFile
.
bind
(
null
,
TEST_FILE_NAME_0
));
it
(
'file is listed'
,
checkFileIsListed
.
bind
(
null
,
TEST_FILE_NAME_0
));
it
(
'file is served up'
,
checkFileIsPresent
);
it
(
'file is served up'
,
checkIndexFileIsServedUp
);
it
(
'can logout'
,
logout
);
it
(
'can update'
,
function
()
{
execSync
(
`cloudron update --app
${
LOCATION
}
`
,
EXEC_ARGS
);
});
it
(
'can login'
,
login
);
it
(
'file is listed'
,
checkFileIsListed
.
bind
(
null
,
TEST_FILE_NAME_0
));
it
(
'file is served up'
,
checkFileIsPresent
);
...
...
@@ -184,7 +216,7 @@ describe('Application life cycle test', function () {
it
(
'uninstall app'
,
function
(
done
)
{
// ensure we don't hit NXDOMAIN in the mean time
browser
.
get
(
'about:blank'
).
then
(
function
()
{
execSync
(
`cloudron uninstall --app
${
app
.
id
}
`
,
EXEC_
OPTION
S
);
execSync
(
`cloudron uninstall --app
${
app
.
id
}
`
,
EXEC_
ARG
S
);
done
();
});
});
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment