Skip to content

Commit

Permalink
Try to run the test
Browse files Browse the repository at this point in the history
  • Loading branch information
alphabiz-se4 committed Jan 22, 2022
1 parent e86b599 commit 45bb25a
Show file tree
Hide file tree
Showing 14 changed files with 1,824 additions and 36 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/online-experiments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: online-experiments
env:
name: staging_environment

concurrency: staging_environment

on:
push:
paths:
- "**/online-experiments.yml"
#
jobs:
test-1:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
os: [ubuntu-latest]
node-version: [14]
environment:
name: CICD
env:
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
PHONE_NUMBER_ACCOUNT: ${{ secrets.PHONE_NUMBER_ACCOUNT }}
PHONE_NUMBER_TOKEN: ${{ secrets.PHONE_NUMBER_TOKEN }}
TEST1_EMAIL: ${{ secrets.TEST1_EMAIL }}
TEST2_EMAIL: ${{ secrets.TEST2_EMAIL }}
TEST3_EMAIL: ${{ secrets.TEST3_EMAIL }}
TEST1_PHONE_NUMBER: ${{ secrets.TEST1_PHONE_NUMBER }}
TEST2_PHONE_NUMBER: ${{ secrets.TEST2_PHONE_NUMBER }}
TEST3_PHONE_NUMBER: ${{ secrets.TEST3_PHONE_NUMBER }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
TEST_RESET_PASSWORD: ${{ secrets.TEST_RESET_PASSWORD }}
steps:
- name: Get short SHA 🔑
id: slug
run: |
echo "::set-output name=sha7::${GITHUB_SHA::7}"
shell: bash

- name: Checkout ${{ steps.slug.outputs.sha7 }} ⬇️
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://npm.pkg.github.com"
scope: "@zeeis"
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT }}

- name: Get last commit date
id: vars
run: |
git fetch --prune --unshallow
echo "::set-output name=date::$(git log -1 --date=format:'%Y%m%d' --format='%cd')"
echo "::set-output name=tag::$(git describe --abbrev=0 --tags)"
shell: bash

- name: Checkout vars-date ${{ steps.vars.outputs.date }} ⬇️
run: |
echo "${{ steps.vars.outputs.date }}"
echo "${{ steps.vars.outputs.tag }}"
- name: Install dependencies 👨🏻‍💻
run: yarn install

- name: E2E Test 🧪
run: yarn test:e2e:ci

- name: Upload Test Results 🗃
if: always()
uses: actions/upload-artifact@v2
with:
name: "output1"
path: test/output/**
12 changes: 12 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"baseUrl": "http://localhost:8080/",
"fixturesFolder": "test/cypress/fixtures",
"integrationFolder": "test/cypress/integration",
"pluginsFile": "test/cypress/plugins/index.js",
"screenshotsFolder": "test/output/cypress",
"supportFile": "test/cypress/support/index.js",
"videosFolder": "test/cypress/videos",
"video": false,
"retries": 2,
"experimentalSessionSupport": true
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"productName": "Alphabiz",
"author": "Alphabiz Team <[email protected]>",
"scripts": {
"test:e2e": "cross-env E2E_TEST=true start-test \"http-server spa/\" http-get://localhost:8080 \"cypress open\"",
"test:e2e:ci": "cross-env E2E_TEST=true start-test \"http-server spa -s/\" http-get://localhost:8080 \"cypress run --browser chrome\"",
"test:appium": "appium --log ./test/output/release/appium.log",
"test:release": "jest test/jest/release/main.spec.js --c=./test/jest/release/jest.config.js",
"test:release:creditsUpload": "jest test/jest/release/creditsUpload.spec.js --c=./test/jest/release/jest.config.js",
Expand All @@ -16,10 +18,15 @@
"appium": "^1.22.2",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.4.6",
"cross-env": "^7.0.3",
"cypress": "^9.3.1",
"cypress-file-upload": "^5.0.8",
"dotenv": "^14.1.0",
"http-server": "^14.1.0",
"jest": "^27.4.7",
"mail-listener2": "^0.3.1",
"mailparser": "^3.4.0",
"start-server-and-test": "^1.14.0",
"ts-jest": "^27.1.3",
"twilio": "^3.73.0",
"webdriverio": "^7.16.13"
Expand Down
53 changes: 53 additions & 0 deletions test/cypress/fixtures/userData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{
"isEmail": 1,
"email": "test2Email",
"phone": "test2PhoneNumber",
"password": "password",
"changeEmail": "test1Email",
"changePhone": "test1PhoneNumber",
"modifyName": "test1",
"resetPassword": "resetPassword",
"isTestInvitationCode": 1,
"isSentInvitationCode": 1,
"isSentToEmail": 1,
"sentInvitationCode": "test2Email",
"invitationCodeStatus": "used"
},
{
"isEmail": 1,
"email": "test2Email",
"password": "password",
"modifyName": "test2",
"resetPassword": "resetPassword",
"isTestInvitationCode": 0,
"isSentInvitationCode": 1,
"isSentToEmail": 1,
"sentInvitationCode": "test3Email",
"invitationCodeStatus": "used"
},
{
"isEmail": 1,
"email": "test3Email",
"password": "password",
"modifyName": "test3",
"resetPassword": "resetPassword",
"isTestInvitationCode": 0,
"isSentInvitationCode": 1,
"isSentToEmail": 0,
"sentInvitationCode": "test2PhoneNumber",
"invitationCodeStatus": "used"
},
{
"isEmail": 0,
"phone": "test2PhoneNumber",
"password": "password",
"modifyName": "test4",
"resetPassword": "resetPassword",
"isTestInvitationCode": 0,
"isSentInvitationCode": 0,
"isSentToEmail": 0,
"sentInvitationCode": "test2Email",
"invitationCodeStatus": "invited"
}
]
26 changes: 26 additions & 0 deletions test/cypress/integration/BasicSettings.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference path="cypress" />
/// <reference path="../support/index.d.ts" />

describe('LanguageSelection', () => {
beforeEach(() => {
cy.visit('/')
cy.get('[aria-label="Menu"]').click()
cy.contains('Settings').click()
cy.contains('Basic').click()
})
it('.should() - 判断基础设置-语言切换简体中文是否有效', () => {
cy.get('[data-cy="select-direct"]').click()
cy.contains('简体中文').click()
cy.get('header > .text-h5').contains('基础设置').click()
})
it('.should() - 判断基础设置-语言切换繁体中文是否有效', () => {
cy.get('[data-cy="select-direct"]').click()
cy.contains('繁體中文').click()
cy.get('header > .text-h5').contains('基礎設置').click()
})
it('.should() - 判断基础设置-语言切换English是否有效', () => {
cy.get('[data-cy="select-direct"]').click()
cy.contains('English').click()
cy.get('header > .text-h5').contains('Basic').click()
})
})
Loading

0 comments on commit 45bb25a

Please sign in to comment.