Skip to content

Commit 0c5ddb9

Browse files
Merge pull request #479 from CedricProfessionnel/credentialsTest
Credentials test (Feature Aws Part)
2 parents fd311c7 + f3cdd53 commit 0c5ddb9

File tree

8 files changed

+83
-40
lines changed

8 files changed

+83
-40
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import enterCredentialsCognitoS3 from "../utils/credentials-test/enter-credentials-cognito-s3"
2+
import enterCredentialsUser from "../utils/credentials-test/enter-credentials-user"
3+
import commandLocalStorage from "../utils/cypress-command/local-storage"
4+
import commandSetLanguage from "../utils/cypress-command/set-language"
5+
commandLocalStorage()
6+
commandSetLanguage()
7+
8+
Cypress.config("defaultCommandTimeout", 3000)
9+
if (Cypress.env().AWS_IDENTITY_POOL_ID)
10+
describe("Credentials test", () => {
11+
before("Prepare tests", () => {
12+
cy.log("should be able to join the web site")
13+
cy.visit(`http://localhost:6001`)
14+
cy.setLanguage("en")
15+
})
16+
17+
beforeEach("Restore local storage", () => {
18+
cy.restoreLocalStorage()
19+
})
20+
21+
enterCredentialsCognitoS3()
22+
enterCredentialsUser()
23+
24+
afterEach("Save local storage", () => {
25+
cy.saveLocalStorage()
26+
})
27+
})

cypress/integration/aws-test/export-aws.spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import enterCredentialsCognitoS3 from "../utils/credentials-test/enter-credentials-cognito-s3"
2-
import enterCredentialsUser from "../utils/credentials-test/enter-credentials-user"
31
import commandSetLanguage from "../utils/cypress-command/set-language"
2+
import commandCredentialsAws from "../utils/cypress-command/credentials-aws"
43
import goToImportPage from "../utils/go-to-import-page"
54
import removeAWSFile from "../utils/remove-cypress-file-in-aws"
65

76
commandSetLanguage()
7+
commandCredentialsAws()
88

99
if (Cypress.env().AWS_IDENTITY_POOL_ID)
1010
describe("aws test", () => {
@@ -13,8 +13,7 @@ if (Cypress.env().AWS_IDENTITY_POOL_ID)
1313
cy.visit(`http://localhost:6001`)
1414
cy.wait(400)
1515
cy.setLanguage()
16-
enterCredentialsCognitoS3()
17-
enterCredentialsUser()
16+
cy.createCredentialsAws()
1817
goToImportPage()
1918
})
2019

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
11
const enterCredentialsCognitoS3 = () => {
2-
var credentials = Cypress.env()
32
cy.get('input[placeholder="XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab"]')
43
.focus()
5-
.type(credentials.AWS_IDENTITY_POOL_ID)
4+
.type(Cypress.env().AWS_IDENTITY_POOL_ID)
65
cy.get('input[placeholder="XX-XXXX-X"]')
76
.first()
87
.focus()
9-
.type(credentials.AWS_AUTH_REGION)
8+
.type(Cypress.env().AWS_AUTH_REGION)
109
cy.get('input[placeholder="XX-XXXX-X_12ab34cd9"]')
1110
.focus()
12-
.type(credentials.AWS_USER_POOL_ID)
11+
.type(Cypress.env().AWS_USER_POOL_ID)
1312
cy.get('input[placeholder="26-char alphanumeric string"]')
1413
.focus()
15-
.type(credentials.AWS_USER_POOL_WEB_CLIENT_ID)
14+
.type(Cypress.env().AWS_USER_POOL_WEB_CLIENT_ID)
1615
cy.get('input[placeholder="Name of the bucket"]')
1716
.focus()
18-
.type(credentials.AWS_STORAGE_BUCKET)
17+
.type(Cypress.env().AWS_STORAGE_BUCKET)
1918
cy.get('input[placeholder="XX-XXXX-X"]')
2019
.last()
2120
.focus()
22-
.type(credentials.AWS_STORAGE_REGION)
21+
.type(Cypress.env().AWS_STORAGE_REGION)
2322
cy.get('input[class="MuiInputBase-input MuiInput-input"]')
2423
.last()
2524
.focus()
26-
.type(credentials.COGNITO_USER_PASS_LENGTH)
27-
if (credentials.COGNITO_USER_PASS_REQUIRE_LOWERCASE == "TRUE") {
28-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(0).click()
25+
.type(Cypress.env().COGNITO_USER_PASS_LENGTH)
26+
if (Cypress.env().COGNITO_USER_PASS_REQUIRE_LOWERCASE === "TRUE") {
27+
cy.get('input[id="RequireLowercaseYes"]').click().focus().blur()
2928
} else {
30-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(1).click()
29+
cy.get('input[id="RequireLowercaseNo"]').click().focus().blur()
3130
}
32-
if (credentials.COGNITO_USER_PASS_REQUIRE_UPPERCASE == "TRUE") {
33-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(2).click()
31+
if (Cypress.env().COGNITO_USER_PASS_REQUIRE_UPPERCASE === "TRUE") {
32+
cy.get('input[id="RequireUppercaseYes"]').click().focus().blur()
3433
} else {
35-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(3).click()
34+
cy.get('input[id="RequireUppercaseNo"]').click().focus().blur()
3635
}
37-
if (credentials.COGNITO_USER_PASS_REQUIRE_NUMBER == "TRUE") {
38-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(4).click()
36+
if (Cypress.env().COGNITO_USER_PASS_REQUIRE_NUMBER === "TRUE") {
37+
cy.get('input[id="RequireNumberYes"]').click().focus().blur()
3938
} else {
40-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(5).click()
39+
cy.get('input[id="RequireNumberNo"]').click().focus().blur()
4140
}
42-
if (credentials.COGNITO_USER_PASS_REQUIRE_SYMBOL == "TRUE") {
43-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(6).click()
41+
if (Cypress.env().COGNITO_USER_PASS_REQUIRE_SYMBOL === "TRUE") {
42+
cy.get('input[id="RequireSymbolYes"]').click().focus().blur()
4443
} else {
45-
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(7).click()
44+
cy.get('input[id="RequireSymbolNo"]').click().focus().blur()
4645
}
4746
}
4847

4948
const test = () => {
50-
cy.log("should be able to set s3 config")
51-
cy.contains("Add Authentification").click()
52-
cy.contains("AWS - Cognito").click()
53-
enterCredentialsCognitoS3()
54-
cy.contains("Complete").click()
49+
it("Enter credentials cognito-s3", () => {
50+
cy.log("should be able to set s3 config")
51+
cy.contains("Add Authentification").click()
52+
cy.contains("AWS - Cognito").click()
53+
enterCredentialsCognitoS3()
54+
cy.contains("Complete").click()
55+
})
5556
}
5657

5758
export default test
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const enterCredentialsUser = () => {
2-
var credentials = Cypress.env()
3-
cy.get('input[id="username"]').focus().type(credentials.COGNITO_USER_NAME)
4-
cy.get('input[id="password"]').focus().type(credentials.COGNITO_USER_PASS)
2+
cy.get('input[id="username"]').focus().type(Cypress.env().COGNITO_USER_NAME)
3+
cy.get('input[id="password"]').focus().type(Cypress.env().COGNITO_USER_PASS)
54
}
65
const test = () => {
7-
cy.log("should be able to set user cognito config")
8-
cy.contains("Cognito").click()
9-
enterCredentialsUser()
10-
cy.get(
11-
'button[class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-70 MuiButton-containedPrimary MuiButton-fullWidth"]'
12-
).click()
6+
it("Enter credentials user cognito", () => {
7+
cy.log("should be able to set user cognito config")
8+
cy.contains("Cognito").click()
9+
enterCredentialsUser()
10+
cy.get("button[id='sign-in']").click()
11+
cy.get("button[id='sign-in']", { timeout: 30000 }).should("not.exist")
12+
})
1313
}
1414
export default test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"electron-builder-notarize": "^1.2.0",
7474
"eslint-plugin-cypress": "^2.11.2",
7575
"gh-pages": "^2.1.1",
76-
"material-survey": "^1.0.40",
7776
"parcel": "^1.12.4",
7877
"prettier": "^2.2.1",
7978
"react": "^16.8.6",
@@ -109,6 +108,7 @@
109108
"jac-format": "^1.1.3",
110109
"js-md5": "^0.7.3",
111110
"mime-types": "^2.1.28",
111+
"material-survey": "^1.0.41",
112112
"moment": "^2.24.0",
113113
"nan": "^2.14.1",
114114
"posthog-js": "^1.0.4",

src/components/AddAuthFromTemplateDialog/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,28 @@ const forms = {
104104
title: "Require a lowercase letter in password",
105105
type: "boolean",
106106
isRequired: true,
107+
id: "RequireLowercase",
107108
},
108109
{
109110
name: "auth.cognito.password.requireUppercase",
110111
title: "Require a uppercase letter in password",
111112
type: "boolean",
112113
isRequired: true,
114+
id: "RequireUppercase",
113115
},
114116
{
115117
name: "auth.cognito.password.requireNumbers",
116118
title: "Require a number in password",
117119
type: "boolean",
118120
isRequired: true,
121+
id: "RequireNumber",
119122
},
120123
{
121124
name: "auth.cognito.password.requireSymbols",
122125
title: "Require a symbol in password",
123126
type: "boolean",
124127
isRequired: true,
128+
id: "RequireSymbol",
125129
},
126130
],
127131
},

src/components/LoginDrawer/SignIn.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export default ({ onRequireCompleteSignUp }) => {
134134
variant="contained"
135135
color="primary"
136136
className={classes.submit}
137+
id="sign-in"
137138
>
138139
{t("sign-in")}
139140
</Button>

yarn.lock

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14240,7 +14240,7 @@ matcher@^3.0.0:
1424014240
dependencies:
1424114241
escape-string-regexp "^4.0.0"
1424214242

14243-
material-survey@^1.0.34, material-survey@^1.0.40:
14243+
material-survey@^1.0.34:
1424414244
version "1.0.40"
1424514245
resolved "https://registry.yarnpkg.com/material-survey/-/material-survey-1.0.40.tgz#35c650826fe94d69a6c40e08a120abb51a40d03c"
1424614246
integrity sha512-im5elNvoetmsRaafw/92YAyBXalQKXAjBwJDnJiwV23z6GBZ4dcjdMrUkIGXxZRsFrdy2/yrap0haB6mfNUzSg==
@@ -14251,6 +14251,17 @@ material-survey@^1.0.34, material-survey@^1.0.40:
1425114251
react-select "^3.0.8"
1425214252
surveyjs-expression-eval "^1.0.2"
1425314253

14254+
material-survey@^1.0.41:
14255+
version "1.0.41"
14256+
resolved "https://registry.yarnpkg.com/material-survey/-/material-survey-1.0.41.tgz#6e9db6601aa991bda1175ea2e47b3692be925bd9"
14257+
integrity sha512-WlfMw2twMpZ9THevzPMaDsiTMrzA2SRK8ferhobRL1XHqwtG9MlMHpLzRxe2df54vJUMTk98JFASOO3sTNkCmg==
14258+
dependencies:
14259+
k-choice-sort "^1.0.9"
14260+
lodash "^4.17.11"
14261+
react-dropzone "^8.0.1"
14262+
react-select "^3.0.8"
14263+
surveyjs-expression-eval "^1.0.2"
14264+
1425414265
md5-hex@^3.0.1:
1425514266
version "3.0.1"
1425614267
resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-3.0.1.tgz#be3741b510591434b2784d79e556eefc2c9a8e5c"

0 commit comments

Comments
 (0)