Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable offline test #6224

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 0 additions & 81 deletions cypress/e2e/offline._cy.js

This file was deleted.

86 changes: 86 additions & 0 deletions cypress/e2e/offline.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/// <reference types="cypress" />

// https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/server-communication__offline/cypress/integration/offline-spec.js

// const goOffline = () => {
// cy.log('**go offline**')
// .then(() => {
// return Cypress.automation('remote:debugger:protocol', {
// command: 'Network.enable',
// });
// })
// .then(() => {
// return Cypress.automation('remote:debugger:protocol', {
// command: 'Network.emulateNetworkConditions',
// params: {
// offline: true,
// latency: -1,
// downloadThroughput: -1,
// uploadThroughput: -1,
// },
// });
// });
// };

// const goOnline = () => {
// // disable offline mode, otherwise we will break our tests :)
// cy.log('**go online**')
// .then(() => {
// // https://chromedevtools.github.io/devtools-protocol/1-3/Network/#method-emulateNetworkConditions
// return Cypress.automation('remote:debugger:protocol', {
// command: 'Network.emulateNetworkConditions',
// params: {
// offline: false,
// latency: -1,
// downloadThroughput: -1,
// uploadThroughput: -1,
// },
// });
// })
// .then(() => {
// return Cypress.automation('remote:debugger:protocol', {
// command: 'Network.disable',
// });
// });
// };

describe('offline', () => {
describe('site', { browser: '!firefox' }, () => {
// make sure we get back online, even if a test fails
// otherwise the Cypress can lose the browser connection
it('should run', () => {
expect(true).to.be.true;
});
// beforeEach(goOnline);
// afterEach(goOnline);

// it('shows /migrate/ page', () => {
// const url = '/migrate/';
// const text = 'Migrate';

// cy.visit(url);
// cy.get('h1').contains(text);

// goOffline();

// cy.visit(url);
// cy.get('h1').contains(text);

// // click `guides` link
// cy.get('a[title="guides"]').click();
// cy.get('h1').contains('Guides');
// });

// it('open print dialog when accessing /printable url', () => {
// const url = '/migrate/printable';
// cy.visit(url, {
// onBeforeLoad: (win) => {
// cy.stub(win, 'print');
// },
// });
// cy.window().then((win) => {
// expect(win.print).to.be.calledOnce;
// });
// });
});
});