-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from systemseed/testcafe
Clean up TestCafe setup
- Loading branch information
Showing
11 changed files
with
1,596 additions
and
233 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
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,13 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"globals": { | ||
"fixture": false, | ||
"test": false, | ||
"process": false, | ||
"window": false, | ||
"console": false | ||
} | ||
} |
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,12 +1,14 @@ | ||
{ | ||
"name": "systemseed.com-testcafe", | ||
"name": "falcon-testcafe", | ||
"version": "1.0.0", | ||
"description": "End-to-End tests for systemseed.com", | ||
"description": "End-to-End tests for Falcon", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"babel-eslint": "^10.0.2", | ||
"eslint": "^6.2.0" | ||
}, | ||
"dependencies": { | ||
"faker": "^4.1.0", | ||
"testcafe": "^1.0.1" | ||
"testcafe": "^1.4.1" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { Selector } from 'testcafe'; | ||
import { Selector, RequestLogger } from 'testcafe'; | ||
import * as config from '../utils/config'; | ||
import { getRequestResult } from '../utils/helpers'; | ||
|
||
// Enable logging of all get requests during while running this fixture. | ||
const logger = RequestLogger({ method: 'get' }); | ||
|
||
fixture('Logo') | ||
.page(config.frontendURL).httpAuth(config.httpAuth).beforeEach(config.beforeEach); | ||
.page(config.frontendURL) | ||
.httpAuth(config.httpAuth) | ||
.beforeEach(config.beforeEach) | ||
.requestHooks(logger); | ||
|
||
test | ||
('Logo is visible', async t => { | ||
const logo = Selector('a.falcon-logo > img'); | ||
await t.expect(logo.exists).ok('Get in Touch! Logo is visible.'); | ||
const logoUrl = await logo.getAttribute('src'); | ||
test('Logo is visible', async t => { | ||
const logo = Selector('a.falcon-logo > img'); | ||
await t.expect(logo.exists).ok('The site logo is visible.'); | ||
const logoUrl = await logo.getAttribute('src'); | ||
|
||
await t.expect(getRequestResult(logoUrl)).eql(200, 'Logo is loaded.'); | ||
}); | ||
// Check that actual image file was successfully loaded during page rendering. | ||
await t.expect(logger.contains( | ||
record => record.request.url === logoUrl && record.response.statusCode === 200) | ||
).ok(); | ||
}); | ||
|
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.