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
1a76ecf9
Unverified
Commit
1a76ecf9
authored
May 25, 2021
by
Bryce Taylor
Committed by
GitHub
May 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4545 from BryceLTaylor/moce-project-rows-tests
Move Project Rows tests from Tap to Jest
parents
0ccf28e3
d6a9c8d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
94 deletions
+60
-94
test/integration-legacy/smoke-testing/test_project_rows.js
test/integration-legacy/smoke-testing/test_project_rows.js
+0
-93
test/integration/homepage-rows.test.js
test/integration/homepage-rows.test.js
+59
-0
test/integration/project-page.test.js
test/integration/project-page.test.js
+1
-1
No files found.
test/integration-legacy/smoke-testing/test_project_rows.js
deleted
100644 → 0
View file @
0ccf28e3
/*
* 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/homepage-rows.test.js
0 → 100644
View file @
1a76ecf9
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
(
20000
);
}
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
guiPlayer
=
await
findByXpath
(
'
//div[@class="guiPlayer"]
'
);
let
guiPlayerDisplayed
=
await
guiPlayer
.
isDisplayed
();
await
expect
(
guiPlayerDisplayed
).
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
);
});
});
test/integration/project-page.test.js
View file @
1a76ecf9
...
...
@@ -14,7 +14,7 @@ let projectUrl = rootUrl + '/projects/' + projectId;
if
(
remote
){
jest
.
setTimeout
(
60000
);
}
else
{
jest
.
setTimeout
(
1
0000
);
jest
.
setTimeout
(
2
0000
);
}
let
driver
;
...
...
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