Skip to content

Commit b52280a

Browse files
authored
fix: Merge pull request #465 from CedricProfessionnel/3UpToDate
Refactor Cognito Test
2 parents b692b2e + aa108de commit b52280a

File tree

21 files changed

+2676
-4648
lines changed

21 files changed

+2676
-4648
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
cypress/integration/*
2-
cypress/utils/*
2+
cypress/utils/*
3+
logs/*
4+
cypress/screenshots/*

.github/workflows/test.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
with:
1414
node-version: 12
1515
- name: Run Prettier Test
16-
run: npx prettier --check "src/**/*.js"
16+
run: npx prettier --check .
1717
- name: Run Lint Test
1818
run: |
1919
# TODO this takes 1-2 mins to install, run eslint w/o installing
@@ -38,3 +38,18 @@ jobs:
3838
record: true
3939
env:
4040
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
41+
CYPRESS_AWS_IDENTITY_POOL_ID: ${{ secrets.CYPRESS_AWS_IDENTITY_POOL_ID }}
42+
CYPRESS_AWS_AUTH_REGION: ${{ secrets.CYPRESS_AWS_AUTH_REGION }}
43+
CYPRESS_AWS_USER_POOL_ID: ${{ secrets.CYPRESS_AWS_USER_POOL_ID }}
44+
CYPRESS_AWS_USER_POOL_WEB_CLIENT_ID: ${{ secrets.CYPRESS_AWS_USER_POOL_WEB_CLIENT_ID }}
45+
CYPRESS_AWS_MANDATORY_SIGN_IN: ${{ secrets.CYPRESS_AWS_MANDATORY_SIGN_IN }}
46+
CYPRESS_AWS_AUTHENTICATION_FLOW_TYPE: ${{ secrets.CYPRESS_AWS_AUTHENTICATION_FLOW_TYPE }}
47+
CYPRESS_AWS_STORAGE_BUCKET: ${{ secrets.CYPRESS_AWS_STORAGE_BUCKET }}
48+
CYPRESS_AWS_STORAGE_REGION: ${{ secrets.CYPRESS_AWS_STORAGE_REGION }}
49+
CYPRESS_COGNITO_USER_NAME: ${{ secrets.CYPRESS_COGNITO_USER_NAME }}
50+
CYPRESS_COGNITO_USER_PASS: ${{ secrets.CYPRESS_COGNITO_USER_PASS }}
51+
CYPRESS_COGNITO_USER_PASS_LENGTH: ${{ secrets.CYPRESS_COGNITO_USER_PASS_LENGTH }}
52+
CYPRESS_COGNITO_USER_PASS_REQUIRE_LOWERCASE: ${{ secrets.CYPRESS_COGNITO_USER_PASS_REQUIRE_LOWERCASE }}
53+
CYPRESS_COGNITO_USER_PASS_REQUIRE_UPPERCASE: ${{ secrets.CYPRESS_COGNITO_USER_PASS_REQUIRE_UPPERCASE }}
54+
CYPRESS_COGNITO_USER_PASS_REQUIRE_NUMBER: ${{ secrets.CYPRESS_COGNITO_USER_PASS_REQUIRE_NUMBER }}
55+
CYPRESS_COGNITO_USER_PASS_REQUIRE_SYMBOL: ${{ secrets.CYPRESS_COGNITO_USER_PASS_REQUIRE_SYMBOL }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ dist
3131
desktop/node_modules
3232

3333
/lib
34-
3534
src/components/WebApp/myAWSconfig.js
3635
package-lock.json
3736
src/components/WebApp/myAWSconfig.js
3837
.env
3938
.cache
40-
39+
logs
4140
# eventually we'll commit these
4241
cypress/snapshots
42+
cypress/screenshots
4343

4444
.idea
4545
*.db

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
build/*
33
dist/*
44
lib/*
5+
logs/*
56
node_modules/*
67
.env
8+
.env.example
79
yarn-error.log
810
cypress/snapshots/*
911
cypress/videos/*

cypress/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
videos
1+
videos
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
import enterCredentialsCognitoS3 from "./utils/credentials-test/enter-credentials-cognito-s3"
2-
import enterCredentialsUser from "./utils/credentials-test/enter-credentials-user"
3-
import setLanguage from "./utils/set-language"
4-
import goToImportPage from "./utils/go-to-import-page"
5-
import removeAWSFile from "./utils/remove-cypress-file-in-aws"
6-
import "regenerator-runtime/runtime"
1+
import enterCredentialsCognitoS3 from "../utils/credentials-test/enter-credentials-cognito-s3"
2+
import enterCredentialsUser from "../utils/credentials-test/enter-credentials-user"
3+
import setLanguage from "../utils/set-language"
4+
import goToImportPage from "../utils/go-to-import-page"
5+
import removeAWSFile from "../utils/remove-cypress-file-in-aws"
6+
77
if (Cypress.env().AWS_IDENTITY_POOL_ID)
88
describe("aws test", () => {
9-
it("Try to export a natif project to aws", () => {
9+
before("Prepare tests", () => {
1010
cy.log("should be able to join the web site")
1111
cy.visit(`http://localhost:6001`)
12-
1312
cy.wait(400)
1413
setLanguage()
1514
enterCredentialsCognitoS3()
1615
enterCredentialsUser()
1716
goToImportPage()
17+
})
1818

19+
it("Try to export a natif project to aws", () => {
1920
cy.log("should be able to use export project")
2021
cy.wait(200)
2122
cy.contains("Export to S3 (Cognito)").click()
@@ -31,13 +32,16 @@ if (Cypress.env().AWS_IDENTITY_POOL_ID)
3132
cy.wait(200)
3233
cy.contains("CypressTest1")
3334
cy.contains("Close").click()
35+
})
3436

37+
afterEach("Clean AWS", () => {
3538
removeAWSFile("CypressTest1")
3639

3740
cy.log("should not be able to see the new project")
38-
cy.wait(2000)
41+
cy.wait(200)
3942
cy.contains("Export to S3 (Cognito)").click()
4043
cy.wait(200)
4144
cy.contains("CypressTest1").should("not.exist")
45+
cy.contains("Close").click()
4246
})
4347
})

cypress/integration/collaborative-session.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("Create and Visit Collaborative Session", () => {
88
.focus()
99
.type("English")
1010
.type("{enter}")
11-
cy.contains("New File").click()
11+
cy.contains("New File", { timeout: 50000 }).click()
1212
})
1313
createAndVisitCollaborativeSession()
1414
clickOn100SamplesInACollaborativeSession()

cypress/integration/udt-test.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import createNewFile from "./utils/interface-test/create-new-file"
22
import imageClassification from "./utils/interface-test/image-classification"
33
import imageSegmentation from "./utils/interface-test/image-segmentation"
44
import keyboardShortcuts from "./utils/interface-test/keyboard-shortcuts"
5-
import labelHelp from "./utils/interface-test/label-help"
65
import namedEntityRecognition from "./utils/interface-test/named-entity-recognition"
76
import pasteImageUrlsWithCSV from "./utils/interface-test/paste-image-urls-with-csv"
87
import pasteImageUrls from "./utils/interface-test/paste-image-urls"
@@ -21,7 +20,6 @@ describe("Udt test", () => {
2120
imageClassification()
2221
imageSegmentation()
2322
keyboardShortcuts()
24-
labelHelp()
2523
namedEntityRecognition()
2624
pasteImageUrlsWithCSV()
2725
pasteImageUrls()

cypress/integration/utils/credentials-test/enter-credentials-cognito-s3.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ const enterCredentialsCognitoS3 = () => {
2525
.focus()
2626
.type(credentials.COGNITO_USER_PASS_LENGTH)
2727
if (credentials.COGNITO_USER_PASS_REQUIRE_LOWERCASE == "TRUE") {
28-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(0).click()
28+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(0).click()
2929
} else {
30-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(1).click()
30+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(1).click()
3131
}
3232
if (credentials.COGNITO_USER_PASS_REQUIRE_UPPERCASE == "TRUE") {
33-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(2).click()
33+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(2).click()
3434
} else {
35-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(3).click()
35+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(3).click()
3636
}
3737
if (credentials.COGNITO_USER_PASS_REQUIRE_NUMBER == "TRUE") {
38-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(4).click()
38+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(4).click()
3939
} else {
40-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(5).click()
40+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(5).click()
4141
}
4242
if (credentials.COGNITO_USER_PASS_REQUIRE_SYMBOL == "TRUE") {
43-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(6).click()
43+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(6).click()
4444
} else {
45-
cy.get('input[class="PrivateSwitchBase-input-63"]').eq(7).click()
45+
cy.get('input[class="PrivateSwitchBase-input-65"]').eq(7).click()
4646
}
4747
}
4848

cypress/integration/utils/credentials-test/enter-credentials-user.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const test = () => {
88
cy.contains("Cognito").click()
99
enterCredentialsUser()
1010
cy.get(
11-
'button[class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-68 MuiButton-containedPrimary MuiButton-fullWidth"]'
11+
'button[class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-submit-70 MuiButton-containedPrimary MuiButton-fullWidth"]'
1212
).click()
13-
cy.wait(2000)
1413
}
1514
export default test

0 commit comments

Comments
 (0)