-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(test): implement e2e test with testcafe #3
- Loading branch information
1 parent
698fff6
commit 71e30e0
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// import { Selector, ClientFunction } from 'testcafe' | ||
import { Selector } from 'testcafe' | ||
|
||
// fixture`Getting Started`.page`http://devexpress.github.io/testcafe/example` | ||
fixture`Getting Started`.page`http://localhost:3000` | ||
|
||
test('index page', async (t) => { | ||
await t | ||
// Use the assertion to check if the actual header text is equal to the expected one | ||
.expect(Selector('h1').innerText) | ||
.eql('Get Started') | ||
}) | ||
|
||
// test('login layout without Drawer', async (t) => { | ||
// const drawer = Selector('[data-testid="drawer"]').exists | ||
// await t.expect(drawer).notOk | ||
// }) | ||
|
||
// test('login with wrong account', async (t) => { | ||
// await t | ||
// .typeText('[data-testid="input-account"]', '[email protected]') | ||
// .typeText('[data-testid="input-password"]', 'zxcvbnm') | ||
// .click('[data-testid="submit"]') | ||
// .expect(Selector('[data-testid="error"]').innerText) | ||
// .eql('Error: 帳號不存在或密碼錯誤,請重新輸入。') | ||
// }) | ||
|
||
// test('login success', async (t) => { | ||
// await t | ||
// .typeText('[data-testid="input-account"]', '[email protected]') | ||
// .typeText('[data-testid="input-password"]', 'zxcvbnm') | ||
// .click('[data-testid="submit"]') | ||
|
||
// const getLocation = ClientFunction(() => document.location.href) | ||
// await t.expect(getLocation()).contains('http://localhost:3000/') | ||
// }) |