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
7a50c048
Commit
7a50c048
authored
Sep 30, 2020
by
BryceLTaylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move join integration tests to Jest, add some tests
parent
f00d4b0b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
32 deletions
+91
-32
test/integration-legacy/smoke-testing/test-join.js
test/integration-legacy/smoke-testing/test-join.js
+0
-32
test/integration/join.test.js
test/integration/join.test.js
+91
-0
No files found.
test/integration-legacy/smoke-testing/test-join.js
deleted
100644 → 0
View file @
f00d4b0b
const
SeleniumHelper
=
require
(
'
../selenium-helpers.js
'
);
const
helper
=
new
SeleniumHelper
();
var
tap
=
require
(
'
tap
'
);
const
test
=
tap
.
test
;
const
driver
=
helper
.
buildDriver
(
'
www-smoke test-login-failures
'
);
const
{
clickText
,
findByXpath
}
=
helper
;
var
rootUrl
=
process
.
env
.
ROOT_URL
||
'
https://scratch.ly
'
;
tap
.
plan
(
1
);
tap
.
tearDown
(
function
()
{
driver
.
quit
();
});
tap
.
beforeEach
(
function
()
{
return
driver
.
get
(
rootUrl
);
});
// Skipping this test while launching new join flow.
// TODO: Add new smoke tests for the new Join flow!
test
(
'
Clicking Join Scratch opens scratchr2 iframe
'
,
{
skip
:
true
},
t
=>
{
clickText
(
'
Join Scratch
'
)
.
then
(()
=>
findByXpath
(
'
//iframe[contains(@class, "mod-registration")]
'
))
.
then
(()
=>
t
.
end
());
});
test/integration/join.test.js
0 → 100644
View file @
7a50c048
const
SeleniumHelper
=
require
(
'
./selenium-helpers.js
'
);
const
{
findByXpath
,
clickXpath
,
buildDriver
}
=
new
SeleniumHelper
();
let
remote
=
process
.
env
.
SMOKE_REMOTE
||
false
;
let
rootUrl
=
process
.
env
.
ROOT_URL
||
'
https://scratch.ly
'
;
let
takenUsername
=
process
.
env
.
SMOKE_USERNAME
;
if
(
remote
){
jest
.
setTimeout
(
60000
);
}
else
{
jest
.
setTimeout
(
10000
);
}
let
driver
;
describe
(
'
www-integration join flow
'
,
()
=>
{
beforeAll
(
async
()
=>
{
driver
=
await
buildDriver
(
'
www-integration join flow
'
);
await
driver
.
get
(
rootUrl
);
});
afterAll
(
async
()
=>
await
driver
.
quit
());
beforeEach
(
async
()
=>
{
driver
.
get
(
rootUrl
);
await
clickXpath
(
'
//a[@class="registrationLink"]
'
);
});
test
(
'
click Join opens join modal
'
,
async
()
=>
{
let
joinModal
=
await
findByXpath
(
'
//div[@class = "join-flow-outer-content"]
'
);
let
modalVisible
=
await
joinModal
.
isDisplayed
();
await
expect
(
modalVisible
).
toBe
(
true
);
});
test
(
'
username validation message appears
'
,
async
()
=>
{
await
clickXpath
(
'
//input[contains(@name, "username")]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-message")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toEqual
(
'
Don
\'
t use your real name
'
);
});
test
(
'
password validation message appears
'
,
async
()
=>
{
await
clickXpath
(
'
//input[contains(@name, "password")]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-message")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toContain
(
'
Write it down so you remember.
'
);
});
test
(
'
password validation message appears
'
,
async
()
=>
{
await
clickXpath
(
'
//input[contains(@name, "passwordConfirm")]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-message")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toEqual
(
'
Type password again
'
);
});
test
(
'
username validation: too short
'
,
async
()
=>
{
let
textInput
=
await
findByXpath
(
'
//input[contains(@name, "username")]
'
);
await
textInput
.
click
();
await
textInput
.
sendKeys
(
'
ab
'
);
await
clickXpath
(
'
//div[@class = "join-flow-outer-content"]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-error")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toContain
(
'
Must be 3 letters or longer
'
);
});
test
(
'
username validation: username taken
'
,
async
()
=>
{
let
textInput
=
await
findByXpath
(
'
//input[contains(@name, "username")]
'
);
await
textInput
.
click
();
await
textInput
.
sendKeys
(
takenUsername
);
await
clickXpath
(
'
//div[@class = "join-flow-outer-content"]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-error")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toContain
(
'
Username taken.
'
);
});
test
(
'
username validation: bad word
'
,
async
()
=>
{
let
textInput
=
await
findByXpath
(
'
//input[contains(@name, "username")]
'
);
await
textInput
.
click
();
await
textInput
.
sendKeys
(
'
qnb02mclepghwic9
'
);
await
clickXpath
(
'
//div[@class = "join-flow-outer-content"]
'
);
let
message
=
await
findByXpath
(
'
//div[contains(@class, "validation-error")]
'
);
let
messageText
=
await
message
.
getText
();
await
expect
(
messageText
).
toContain
(
'
Username not allowed
'
);
});
});
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