Skip to content

Commit

Permalink
test: Fix frontend CI (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine authored and breezewish committed Nov 26, 2020
1 parent 434f919 commit b3b056d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,27 @@ jobs:
run: |
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
source /home/runner/.profile
tiup update --nightly
tiup playground nightly --tiflash=0 &
tiup update playground
source /home/runner/.profile
tiup playground v4.0.6 --tiflash=0 &
- name: Build UI
run: |
make ui
env:
NO_MINIMIZE: true
CI: true
REACT_APP_MIXPANEL_TOKEN: ""
- name: Wait TiUP Playground
run: |
chmod u+x scripts/wait_tiup_playground.sh
scripts/wait_tiup_playground.sh 15 20
- name: Debug TiUP
run: |
source /home/runner/.profile
tiup --version
ls /home/runner/.tiup/components/playground/
DATA_PATH=$(ls /home/runner/.tiup/data/)
echo $DATA_PATH
tiup playground display
echo "==== TiDB Log ===="
head -n 3 /home/runner/.tiup/data/$DATA_PATH/tidb-0/tidb.log
echo "==== TiKV Log ===="
Expand Down
22 changes: 22 additions & 0 deletions scripts/wait_tiup_playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Wait unitl `tiup playground` command runs success

INTERVAL=$1
MAX_TIMES=$2

if ([ -z "${INTERVAL}" ] || [ -z "${MAX_TIMES}" ]); then
echo "Usage: command <interval> <max_times>"
exit 1
fi

source /home/runner/.profile

for ((i=0; i<${MAX_TIMES}; i++)); do
tiup playground display
if [ $? -eq 0 ]; then
exit 0
fi
sleep ${INTERVAL}
done

exit 1
1 change: 1 addition & 0 deletions ui/dashboardApp/layout/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ function TiDBSignInForm({ successRoute, onClickAlternative }) {
<Input onInput={clearErrorMsg} prefix={<UserOutlined />} disabled />
</Form.Item>
<Form.Item
data-e2e="password"
name="password"
label={t('signin.form.password')}
{...(errorMsg && {
Expand Down
8 changes: 7 additions & 1 deletion ui/tests/e2e/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ describe('Login', () => {

await ppExpect(page).toFill('input#tidb_signin_password', 'any')
await ppExpect(page).toClick('button#signin_btn')
await ppExpect(page).toMatch('TiDB authentication failed')

const failReason = await page.waitForSelector(
'form#tidb_signin div[data-e2e="password"] div:last-child'
)
const content = await failReason.evaluate((n) => n.innerText)
console.log('fail reason:', content)
expect(content).toContain('TiDB authentication failed')
},
10 * 1000
)
Expand Down

0 comments on commit b3b056d

Please sign in to comment.