test: remove irrelevant test (#1172)

Since the migration on lifecycle events, the websockets are no longer
taken into account to detect navigation success with networkidle events.
This commit is contained in:
Andrey Lushnikov 2017-10-27 02:14:25 -07:00 committed by GitHub
parent e11dbd7be6
commit d9acf1ead5
2 changed files with 0 additions and 61 deletions

View File

@ -1,28 +0,0 @@
<script>
function createClient() {
const client = new WebSocket(`ws://${location.host}`);
client.addEventListener('open', () => console.log('opened'));
client.addEventListener('close', () => console.log('closed'));
return client;
}
function createAndDestroyClientAfterDelay(delay = 50) {
const client = createClient();
return new Promise(resolve => {
setTimeout(() => {
client.close();
resolve();
}, delay);
});
}
async function main() {
await createAndDestroyClientAfterDelay();
await createAndDestroyClientAfterDelay();
await createAndDestroyClientAfterDelay();
await createAndDestroyClientAfterDelay();
await fetch('fetch-request.js');
}
main().then(() => console.log('done!'));
</script>

View File

@ -1016,39 +1016,6 @@ describe('Page', function() {
// Expect navigation to succeed.
expect(response.ok).toBe(true);
}));
it('should wait for websockets to succeed navigation', SX(async function() {
const responses = [];
// Hold on to the fetch request without answering.
server.setRoute('/fetch-request.js', (req, res) => responses.push(res));
const fetchResourceRequested = server.waitForRequest('/fetch-request.js');
// Navigate to a page which loads immediately and then opens a bunch of
// websocket connections and then a fetch request.
const navigationPromise = page.goto(PREFIX + '/websocket.html', {
waitUntil: 'networkidle0',
});
// Track when the navigation gets completed.
let navigationFinished = false;
navigationPromise.then(() => navigationFinished = true);
// Wait for the page's 'load' event.
await new Promise(fulfill => page.once('load', fulfill));
expect(navigationFinished).toBe(false);
// Wait for the resource to be requested.
await fetchResourceRequested;
// Expect navigation still to be not finished.
expect(navigationFinished).toBe(false);
// Respond to the request.
for (const response of responses) {
response.statusCode = 404;
response.end(`File not found`);
}
const response = await navigationPromise;
// Expect navigation to succeed.
expect(response.ok).toBe(true);
}));
it('should not leak listeners during navigation', SX(async function() {
let warning = null;
const warningHandler = w => warning = w;