Skip to content

Commit 2afa28c

Browse files
committed
update test
1 parent c5daf29 commit 2afa28c

23 files changed

Lines changed: 214 additions & 140 deletions

client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "starhackit-ui",
33
"title": "StarHackIt",
4-
"version": "10.40.0",
4+
"version": "10.41.0",
55
"private": true,
66
"description": "React + node starter kit. A fullstack boilerplate with authentication and authorisation",
77
"license": "NLPL",
@@ -86,6 +86,7 @@
8686
"lodash-webpack-plugin": "0.11.6",
8787
"mini-css-extract-plugin": "1.6.0",
8888
"mocha": "8.4.0",
89+
"puppeteer": "10.2.0",
8990
"sinon": "10.0.0",
9091
"style-loader": "2.0.0",
9192
"ts-loader": "9.1.2",

client/src/app_user/profile/profileModule.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ export default function (context) {
6666
const response = await this.opUpdate.fetch(payload);
6767
merge(profileStore, response);
6868
context.alertStack.add(
69-
<Alert.Info message={tr.t("Profile updated")} />
69+
<Alert
70+
data-alert-profile-updated
71+
severity="success"
72+
message={tr.t("Profile updated")}
73+
/>
7074
);
7175
}) /*,
7276
uploadPicture: action(async event => {
@@ -79,12 +83,12 @@ export default function (context) {
7983
try {
8084
await rest.upload("document/profile_picture", data);
8185
context.alertStack.add(
82-
<Alert.Info message={tr.t("Picture uploaded")} />
86+
<Alert severity="success" message={tr.t("Picture uploaded")} />
8387
);
8488
} catch (error) {
8589
console.error("uploadPicture ", error);
8690
context.alertStack.add(
87-
<Alert.Danger message={tr.t("Cannot upload file")} />
91+
<Alert severity="error" message={tr.t("Cannot upload file")} />
8892
);
8993
}
9094
})*/,

client/test/nightwatch/test/testLogin.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("Login", function () {
66
client.page
77
.login()
88
.navigate()
9-
.waitForElementVisible(".login-page", 5000)
9+
.waitForElementVisible("@loginPage", 5000)
1010
.setValue("@emailInput", "alice")
1111
.click("@submit")
1212
.waitForElementVisible(".username", 5000)
@@ -19,7 +19,7 @@ describe("Login", function () {
1919
client.page
2020
.login()
2121
.navigate()
22-
.waitForElementVisible(".login-page", 5000)
22+
.waitForElementVisible("@loginPage", 5000)
2323
.setValue("@emailInput", "alice")
2424
.setValue("@passwordInput", "pass")
2525
.click("@submit")
@@ -33,20 +33,20 @@ describe("Login", function () {
3333
client.page
3434
.login()
3535
.navigate()
36-
.waitForElementVisible(".login-page", 5000)
36+
.waitForElementVisible("@loginPage", 5000)
3737
.setValue("@passwordInput", "password")
3838
.click("@submit")
3939
.waitForElementVisible(".password", 5000)
4040
.assert.containsText(
4141
".local-login-form",
42-
"Username must be at least 3 characters"
42+
"Username must be at least 2 characters"
4343
);
4444
});
4545
it("login with incorrect password", function (client) {
4646
client.page
4747
.login()
4848
.navigate()
49-
.waitForElementVisible(".login-page", 5000)
49+
.waitForElementVisible("@loginPage", 5000)
5050
.setValue("@emailInput", "alice")
5151
.setValue("@passwordInput", "wrongpassword")
5252
.click("@submit")
@@ -57,7 +57,7 @@ describe("Login", function () {
5757
client.page
5858
.login()
5959
.navigate()
60-
.waitForElementVisible("div[data-login-page=true]", 5000)
60+
.waitForElementVisible("@loginPage", 5000)
6161
.setValue("@emailInput", "alice")
6262
.setValue("@passwordInput", "password")
6363
.click("@submit")

client/test/nightwatch/test/testLoginSocial.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { githubUserName, gitHubPassword } = process.env;
55
const { googleUserName, googlePassword } = process.env;
66
const { facebookUserName, facebookPassword } = process.env;
77

8-
describe("Social Login", function () {
8+
describe.skip("Social Login", function () {
99
afterEach(function (client, done) {
1010
client.page.logout().logout(done);
1111
});

client/test/nightwatch/test/testProfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ describe("Profile", function () {
1515
.waitForElementVisible(".profile-page", 15e3)
1616
.setValue("@biographyInput", "My Bio")
1717
.click("@submit")
18-
.waitForElementVisible(".alert", 10e3);
18+
.waitForElementVisible("div[data-alert-profile-updated=true]", 10e3);
1919
//.assert.title('My Profile - StarHackIt')
2020
});
2121

22-
it("save biography too long", function (client) {
22+
it.skip("save biography too long", function (client) {
2323
client.page
2424
.profile()
2525
.navigate()
2626
.waitForElementVisible("@biographyInput", 15e3)
2727
.setValue("@biographyInput", "abcdefhigk")
28-
.click("@submit")
29-
.waitForElementVisible(".alert", 15e3);
30-
client.pause(5e3);
28+
.click("@submit");
29+
//.waitForElementVisible(".alert", 15e3);
30+
client.pause(500e3);
3131
});
3232
});
Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,72 @@
1-
const chance = require('chance')();
1+
const chance = require("chance")();
22

3-
describe('Register', function () {
4-
const username = `${chance.first()}${chance.first()}${chance.last()}`;
5-
const email = `${username}@mail.com`;
6-
it('register an account', function (client) {
7-
client.page.register().navigate()
8-
.waitForElementVisible('.register-form', 5000)
9-
.setValue('@emailInput', email)
10-
.setValue('@usernameInput', username)
11-
.setValue('@passwordInput', 'password')
12-
.click('@submit')
13-
.waitForElementVisible('.registration-request-complete', 5000)
14-
});
15-
it('register an account with the same username', function (client) {
3+
describe("Register", function () {
4+
const username = `${chance.first()}${chance.first()}${chance.last()}`;
5+
const email = `${username}@mail.com`;
6+
it("register an account", function (client) {
7+
client.page
8+
.register()
9+
.navigate()
10+
.waitForElementVisible(".register-form", 5000)
11+
.setValue("@emailInput", email)
12+
.setValue("@usernameInput", username)
13+
.setValue("@passwordInput", "password")
14+
.click("@submit")
15+
.waitForElementVisible(".registration-request-complete", 5000);
16+
});
17+
it("register an account with the same username", function (client) {
18+
client.page
19+
.register()
20+
.navigate()
21+
.waitForElementVisible(".register-form", 5000)
22+
.setValue("@emailInput", "alice@mail.com")
23+
.setValue("@usernameInput", "alice")
24+
.setValue("@passwordInput", "password")
25+
.click("@submit")
26+
.waitForElementVisible(".register-error-view", 5000);
1627

17-
client.page.register().navigate()
18-
.waitForElementVisible('.register-form', 5000)
19-
.setValue('@emailInput', "alice@mail.com")
20-
.setValue('@usernameInput', "alice")
21-
.setValue('@passwordInput', 'password')
22-
.click('@submit')
23-
.waitForElementVisible('.register-error-view', 5000)
28+
client.assert.containsText(
29+
".register-form",
30+
"The username is already used"
31+
);
32+
});
33+
it("missing username", function (client) {
34+
client.page
35+
.register()
36+
.navigate()
37+
.waitForElementVisible(".register-form", 5000)
38+
.setValue("@emailInput", "alice@mail.com")
39+
.setValue("@passwordInput", "password")
40+
.click("@submit");
2441

25-
client.assert.containsText('.register-form', 'The username is already used')
26-
});
27-
it('missing username', function (client) {
28-
client.page.register().navigate()
29-
.waitForElementVisible('.register-form', 5000)
30-
.setValue('@emailInput', 'alice@mail.com')
31-
.setValue('@passwordInput', 'password')
32-
.click('@submit');
42+
client.assert.containsText(
43+
".register-form",
44+
"Username must be at least 2 characters"
45+
);
46+
});
47+
it("missing email", function (client) {
48+
client.page
49+
.register()
50+
.navigate()
51+
.waitForElementVisible(".register-form", 5000)
52+
.setValue("@usernameInput", "alice")
53+
.setValue("@passwordInput", "password")
54+
.click("@submit");
3355

34-
client.assert.containsText('.register-form', 'Username must be at least 3 characters')
35-
});
36-
it('missing email', function (client) {
37-
client.page.register().navigate()
38-
.waitForElementVisible('.register-form', 5000)
39-
.setValue('@usernameInput', 'alice')
40-
.setValue('@passwordInput', 'password')
41-
.click('@submit');
56+
client.assert.containsText(".register-form", "Email is not a valid email");
57+
});
58+
it("missing password", function (client) {
59+
client.page
60+
.register()
61+
.navigate()
62+
.waitForElementVisible(".register-form", 5000)
63+
.setValue("@usernameInput", "alice")
64+
.setValue("@emailInput", "alice@mail.com")
65+
.click("@submit");
4266

43-
client.assert.containsText('.register-form', 'Email is not a valid email')
44-
});
45-
it('missing password', function (client) {
46-
client.page.register().navigate()
47-
.waitForElementVisible('.register-form', 5000)
48-
.setValue('@usernameInput', 'alice')
49-
.setValue('@emailInput', 'alice@mail.com')
50-
.click('@submit');
51-
52-
client.assert.containsText('.register-form', 'Password must be at least 6 characters')
53-
});
67+
client.assert.containsText(
68+
".register-form",
69+
"Password must be at least 6 characters"
70+
);
71+
});
5472
});

deploy/playbook/group_vars/all/vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ grucloud_image: "fredericheem/grucloud-cli:v1.23.0"
1313
docker_base_url: "http:/v1.41"
1414
# Docker image tag names
1515
api_image: "fredericheem/api"
16-
api_tag: v10.40.0
16+
api_tag: v10.41.0
1717

1818
web_image: "fredericheem/ui"
19-
web_tag: v10.40.0
19+
web_tag: v10.41.0
2020

2121
firewall_state: started
2222
firewall_enabled_at_boot: true

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
build:
2626
context: ./server
2727
dockerfile: Dockerfile
28-
image: fredericheem/api:v10.40.0
28+
image: fredericheem/api:v10.41.0
2929
expose:
3030
- "9000"
3131
ports:
@@ -53,7 +53,7 @@ services:
5353
dockerfile: Dockerfile
5454
args:
5555
BUILD_VERSION: "docker compose alpha build"
56-
image: fredericheem/ui:v10.40.0
56+
image: fredericheem/ui:v10.41.0
5757
expose:
5858
- "3000"
5959
ports:

server/.mocharc.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"watch-files": ["src/**/*.js"],
3-
"extension": ["js"],
4-
"exclude": "node_modules",
5-
"reporter": "spec",
6-
"timeout": 300e3,
7-
"ui": "bdd",
8-
"bail": true,
9-
"recursive": true
10-
}
2+
"watch-files": ["src/**/*.js"],
3+
"extension": ["js"],
4+
"exclude": "node_modules",
5+
"reporter": "spec",
6+
"timeout": 300e3,
7+
"ui": "bdd",
8+
"bail": false,
9+
"recursive": true
10+
}

server/config/default.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,5 @@
4242
"pass": "11111111111111111111"
4343
}
4444
}
45-
},
46-
"infra": {
47-
"docker": { "baseURL": "http://localhost/v1.40" },
48-
"localOutputPath": "output",
49-
"localInputPath": "input",
50-
"containerImage": "fredericheem/grucloud-cli:v1.23.0"
5145
}
5246
}

0 commit comments

Comments
 (0)