This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #196 from cloudinary/APPS-7306-add-devtools-networ…
…k-test Apps 7306 add devtools network test
- Loading branch information
Showing
2 changed files
with
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { describeCommon, sampleAppUrl } from '../TestHelper'; | ||
import { BrowserUtils } from '../..'; | ||
|
||
interface NetworkLog { | ||
url: string; | ||
status: number; | ||
} | ||
|
||
/** | ||
* DevTools - Start network audit | ||
*/ | ||
describeCommon('startNetworkAudit', () => { | ||
it('successfully start and read network audit', () => { | ||
const expectedLog: NetworkLog = { url: 'http://placekitten.com/480/480', status: 200 }; | ||
const networkLogs: Array<NetworkLog> = []; | ||
|
||
browser.on('Network.responseReceived', (params: any) => { | ||
networkLogs.push({ | ||
url: params.response.url, | ||
status: Number(params.response.status), | ||
}); | ||
}); | ||
|
||
BrowserUtils.navigateToUrl(sampleAppUrl); | ||
|
||
BrowserUtils.waitUntil( | ||
() => { | ||
return networkLogs.some((log) => log.url === expectedLog.url && Number(log.status) === expectedLog.status); | ||
}, | ||
`Expected log [${JSON.stringify(expectedLog)}] was not found`, | ||
5000 | ||
); | ||
}); | ||
}); |
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