Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
David Goessmann
logging-scratch-gui
Commits
2389c093
Commit
2389c093
authored
7 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Add integration test for deleting sound
parent
a8ea0ff5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/helpers/selenium-helper.js
+9
-2
9 additions, 2 deletions
test/helpers/selenium-helper.js
test/integration/test.js
+10
-5
10 additions, 5 deletions
test/integration/test.js
with
19 additions
and
7 deletions
test/helpers/selenium-helper.js
+
9
−
2
View file @
2389c093
...
@@ -4,7 +4,7 @@ import bindAll from 'lodash.bindall';
...
@@ -4,7 +4,7 @@ import bindAll from 'lodash.bindall';
import
'
chromedriver
'
;
// register path
import
'
chromedriver
'
;
// register path
import
webdriver
from
'
selenium-webdriver
'
;
import
webdriver
from
'
selenium-webdriver
'
;
const
{
By
,
until
}
=
webdriver
;
const
{
By
,
until
,
Button
}
=
webdriver
;
class
SeleniumHelper
{
class
SeleniumHelper
{
constructor
()
{
constructor
()
{
...
@@ -15,7 +15,8 @@ class SeleniumHelper {
...
@@ -15,7 +15,8 @@ class SeleniumHelper {
'
findByText
'
,
'
findByText
'
,
'
findByXpath
'
,
'
findByXpath
'
,
'
getDriver
'
,
'
getDriver
'
,
'
getLogs
'
'
getLogs
'
,
'
rightClickText
'
]);
]);
}
}
...
@@ -42,6 +43,12 @@ class SeleniumHelper {
...
@@ -42,6 +43,12 @@ class SeleniumHelper {
return
this
.
findByText
(
text
,
scope
).
then
(
el
=>
el
.
click
());
return
this
.
findByText
(
text
,
scope
).
then
(
el
=>
el
.
click
());
}
}
rightClickText
(
text
,
scope
)
{
return
this
.
findByText
(
text
,
scope
).
then
(
el
=>
this
.
driver
.
actions
()
.
click
(
el
,
Button
.
RIGHT
)
.
perform
());
}
clickButton
(
text
)
{
clickButton
(
text
)
{
return
this
.
clickXpath
(
`//button[contains(text(), '
${
text
}
')]`
);
return
this
.
clickXpath
(
`//button[contains(text(), '
${
text
}
')]`
);
}
}
...
...
This diff is collapsed.
Click to expand it.
test/integration/test.js
+
10
−
5
View file @
2389c093
...
@@ -8,7 +8,8 @@ const {
...
@@ -8,7 +8,8 @@ const {
findByText
,
findByText
,
findByXpath
,
findByXpath
,
getDriver
,
getDriver
,
getLogs
getLogs
,
rightClickText
}
=
new
SeleniumHelper
();
}
=
new
SeleniumHelper
();
const
uri
=
path
.
resolve
(
__dirname
,
'
../../build/index.html
'
);
const
uri
=
path
.
resolve
(
__dirname
,
'
../../build/index.html
'
);
...
@@ -34,7 +35,6 @@ describe('costumes, sounds and variables', () => {
...
@@ -34,7 +35,6 @@ describe('costumes, sounds and variables', () => {
await
driver
.
quit
();
await
driver
.
quit
();
});
});
test
(
'
Blocks report when clicked in the toolbox
'
,
async
()
=>
{
test
(
'
Blocks report when clicked in the toolbox
'
,
async
()
=>
{
await
driver
.
get
(
`file://
${
uri
}
`
);
await
driver
.
get
(
`file://
${
uri
}
`
);
await
clickText
(
'
Blocks
'
);
await
clickText
(
'
Blocks
'
);
...
@@ -75,15 +75,20 @@ describe('costumes, sounds and variables', () => {
...
@@ -75,15 +75,20 @@ describe('costumes, sounds and variables', () => {
test
(
'
Adding a sound
'
,
async
()
=>
{
test
(
'
Adding a sound
'
,
async
()
=>
{
await
driver
.
get
(
`file://
${
uri
}
`
);
await
driver
.
get
(
`file://
${
uri
}
`
);
await
clickText
(
'
Sounds
'
);
await
clickText
(
'
Sounds
'
);
// Delete the sound
await
rightClickText
(
'
meow
'
,
soundsTabScope
);
await
clickText
(
'
delete
'
,
soundsTabScope
);
await
driver
.
switchTo
().
alert
()
.
accept
();
// Add a sound
await
clickText
(
'
Add Sound
'
);
await
clickText
(
'
Add Sound
'
);
const
el
=
await
findByXpath
(
"
//input[@placeholder='what are you looking for?']
"
);
const
el
=
await
findByXpath
(
"
//input[@placeholder='what are you looking for?']
"
);
await
el
.
sendKeys
(
'
chom
'
);
await
el
.
sendKeys
(
'
chom
'
);
await
clickText
(
'
chomp
'
);
// Should close the modal, then click the sounds in the selector
await
clickText
(
'
chomp
'
);
// Should close the modal, then click the sounds in the selector
await
clickText
(
'
meow
'
,
soundsTabScope
);
await
clickText
(
'
chomp
'
,
soundsTabScope
);
await
clickText
(
'
chomp
'
,
soundsTabScope
);
await
clickXpath
(
'
//button[@title="Play"]
'
);
await
clickXpath
(
'
//button[@title="Play"]
'
);
await
clickText
(
'
meow
'
,
soundsTabScope
);
await
clickXpath
(
'
//button[@title="Play"]
'
);
await
clickText
(
'
Louder
'
);
await
clickText
(
'
Louder
'
);
await
clickText
(
'
Softer
'
);
await
clickText
(
'
Softer
'
);
...
...
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