-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
49 additions
and
14 deletions.
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 |
---|---|---|
|
@@ -85,3 +85,8 @@ dist | |
sw.* | ||
|
||
package-lock.json | ||
|
||
# cypress | ||
test/e2e/screenshots/ | ||
test/e2e/videos/ | ||
|
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
}, | ||
|
||
"devDependencies": { | ||
"cypress": "5.6.0", | ||
"cypress": "^6.0.1", | ||
"eslint-plugin-cypress": "^2.11.2" | ||
} | ||
} |
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
15 changes: 9 additions & 6 deletions
15
template/modules/cypress/test/e2e/integration/login/login.spec.js
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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
/** | ||
* @FYI https://deepexi.yuque.com/docs/share/6537d0c9-6d70-4302-a37d-ba388fd74a15?# 《Cypress 实战》 | ||
* @FYI https://deepexi.yuque.com/docs/share/6537d0c9-6d70-4302-a37d-ba388fd74a15?# 《Cypress 实战总结》 | ||
*/ | ||
describe('login', function () { | ||
before(() => { | ||
cy.fixture('user').as('user') | ||
|
||
cy.visit('/') | ||
cy.viewport(600, 800) | ||
}) | ||
|
||
it('login', function () { | ||
const {code, username, password} = this.user | ||
|
||
cy.hash().should('eq', '#/login?redirect=%2F') | ||
|
||
cy.get('input[placeholder=租户Id]').type(code) | ||
cy.get('input[placeholder="用户名 / 邮箱"]').fill(username) | ||
cy.get('input[placeholder=密码]').fill(`${password}{enter}`) | ||
// cy.contains('登录').click() // enter 代替 click | ||
cy.get('input[placeholder=密码]').fill(`${password}`) | ||
|
||
cy.contains('登录') | ||
.then($el => { | ||
$el.on('click', e => e.preventDefault()) | ||
}) | ||
.click() | ||
|
||
cy.hash().should('eq', '#/') | ||
}) | ||
}) |
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
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
Binary file not shown.