Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
b4dfbc0e
Commit
b4dfbc0e
authored
Oct 20, 2020
by
BryceLTaylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Project Rows tests from Tap to Jest
parent
19edd363
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
93 deletions
+59
-93
test/integration-legacy/smoke-testing/test_project_rows.js
test/integration-legacy/smoke-testing/test_project_rows.js
+0
-93
test/integration/project-rows.test.js
test/integration/project-rows.test.js
+59
-0
No files found.
test/integration-legacy/smoke-testing/test_project_rows.js
deleted
100644 → 0
View file @
19edd363
/*
* Checks that the some of the homepage rows on the homepage are displayed and
* contents have the right URLs to redirect to
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Most-Important-Workflows
*/
const
SeleniumHelper
=
require
(
'
../selenium-helpers.js
'
);
const
helper
=
new
SeleniumHelper
();
var
tap
=
require
(
'
tap
'
);
const
webdriver
=
require
(
'
selenium-webdriver
'
);
const
driver
=
helper
.
buildDriver
(
'
www-smoke test_project_rows
'
);
var
rootUrl
=
process
.
env
.
ROOT_URL
||
'
https://scratch.ly
'
;
// number of tests in the plan
tap
.
plan
(
4
);
tap
.
tearDown
(
function
()
{
// quit the instance of the browser
driver
.
quit
();
});
tap
.
beforeEach
(
function
()
{
// load the page with the driver
return
driver
.
get
(
rootUrl
);
});
// checks that the title of the first row is Featured Projects
tap
.
test
(
'
checkFeaturedProjectsRowTitleWhenSignedOut
'
,
function
(
t
)
{
var
xPathLink
=
'
//div[@class="box"]/div[@class="box-header"]/h4
'
;
driver
.
findElement
(
webdriver
.
By
.
xpath
(
xPathLink
))
.
then
(
function
(
element
)
{
element
.
getText
(
'
h4
'
)
.
then
(
function
(
text
)
{
// expected value of the title text
var
expectedText
=
'
Featured Projects
'
;
t
.
equal
(
text
,
expectedText
);
t
.
end
();
});
});
});
// checks that the link for a project makes sense
tap
.
test
(
'
checkFeaturedProjectsRowLinkWhenSignedOut
'
,
function
(
t
)
{
var
xPathLink
=
'
//div[contains(@class, "thumbnail")
'
+
'
and contains(@class, "project") and contains(@class, "slick-slide")
'
+
'
and contains(@class, "slick-active")]/a[@class="thumbnail-image"]
'
;
driver
.
wait
(
webdriver
.
until
.
elementLocated
(
webdriver
.
By
.
xpath
(
xPathLink
)))
.
then
(
function
(
element
)
{
element
.
getAttribute
(
'
href
'
)
.
then
(
function
(
url
)
{
// expected pattern for the project URL
// since I don't know the length of the project ID number
var
expectedUrlRegExp
=
new
RegExp
(
'
/projects/.*[0-9].*/?
'
);
t
.
match
(
url
,
expectedUrlRegExp
);
t
.
end
();
});
});
});
// checks that the title of the 2nd row is Featured Studios
tap
.
test
(
'
checkFeaturedStudiosRowWhenSignedOut
'
,
function
(
t
)
{
var
xPathLink
=
'
//div[@class="box"][2]/div[@class="box-header"]/h4
'
;
driver
.
findElement
(
webdriver
.
By
.
xpath
(
xPathLink
))
.
then
(
function
(
element
)
{
element
.
getText
(
'
h4
'
)
.
then
(
function
(
text
)
{
var
expectedText
=
'
Featured Studios
'
;
t
.
equal
(
text
,
expectedText
);
t
.
end
();
});
});
});
// checks that the link for a studio makes sense
tap
.
test
(
'
checkFeaturedStudiosRowLinkWhenSignedOut
'
,
function
(
t
)
{
var
xPathLink
=
'
//div[contains(@class, "thumbnail") and contains(@class, "gallery")
'
+
'
and contains(@class, "slick-slide")
'
+
'
and contains(@class, "slick-active")]/a[@class="thumbnail-image"]
'
;
driver
.
findElement
(
webdriver
.
By
.
xpath
(
xPathLink
))
.
then
(
function
(
element
)
{
element
.
getAttribute
(
'
href
'
)
.
then
(
function
(
url
)
{
var
expectedUrlRegExp
=
new
RegExp
(
'
/studios/.*[0-9].*/?
'
);
t
.
match
(
url
,
expectedUrlRegExp
);
t
.
end
();
});
});
});
test/integration/project-rows.test.js
0 → 100644
View file @
b4dfbc0e
const
SeleniumHelper
=
require
(
'
./selenium-helpers.js
'
);
const
{
clickXpath
,
findByXpath
,
buildDriver
}
=
new
SeleniumHelper
();
let
remote
=
process
.
env
.
SMOKE_REMOTE
||
false
;
let
rootUrl
=
process
.
env
.
ROOT_URL
||
'
https://scratch.ly
'
;
if
(
remote
)
{
jest
.
setTimeout
(
60000
);
}
else
{
jest
.
setTimeout
(
10000
);
}
let
driver
;
describe
(
'
www-integration project rows
'
,
()
=>
{
beforeAll
(
async
()
=>
{
driver
=
await
buildDriver
(
'
www-integration project rows
'
);
// driver.get(rootUrl);
});
beforeEach
(
async
()
=>
{
await
driver
.
get
(
rootUrl
);
});
afterAll
(
async
()
=>
await
driver
.
quit
());
test
(
'
Featured Projects row title
'
,
async
()
=>
{
let
projects
=
await
findByXpath
(
'
//div[@class="box"]/div[@class="box-header"]/h4
'
);
let
projectsText
=
await
projects
.
getText
();
await
expect
(
projectsText
).
toEqual
(
'
Featured Projects
'
);
});
test
(
'
Featured Project link
'
,
async
()
=>
{
await
clickXpath
(
'
//div[@class="box"][descendant::text()="Featured Projects"]
'
+
'
//div[contains(@class, "thumbnail")][1]/a[@class="thumbnail-image"]
'
);
let
gfOverlay
=
await
findByXpath
(
'
//div[@class="stage-wrapper_stage-wrapper_2bejr box_box_2jjDp"]
'
);
let
gfOverlayDisplayed
=
await
gfOverlay
.
isDisplayed
();
await
expect
(
gfOverlayDisplayed
).
toBe
(
true
);
});
test
(
'
Featured Studios row title
'
,
async
()
=>
{
let
studios
=
await
findByXpath
(
'
//div[@class="box"][2]/div[@class="box-header"]/h4
'
);
let
studiosText
=
await
studios
.
getText
();
await
expect
(
studiosText
).
toEqual
(
'
Featured Studios
'
);
});
test
(
'
Featured Studios link
'
,
async
()
=>
{
await
clickXpath
(
'
//div[@class="box"][descendant::text()="Featured Studios"]
'
+
'
//div[contains(@class, "thumbnail")][1]/a[@class="thumbnail-image"]
'
);
let
galleryInfo
=
await
findByXpath
(
'
//div[contains(@class, "gallery-info")]
'
);
let
galleryInfoDisplayed
=
await
galleryInfo
.
isDisplayed
();
await
expect
(
galleryInfoDisplayed
).
toBe
(
true
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment