decaffeinate: Run post-processing cleanups on assertions_failing_outside_of_test_spec.coffee and 18 other files

This commit is contained in:
decaffeinate
2020-12-03 13:19:39 +06:30
committed by Jennifer Shehane
parent b5af00ff5f
commit f8f094578d
19 changed files with 869 additions and 566 deletions
@@ -1 +1,3 @@
expect(true).to.be.false;
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
expect(true).to.be.false
@@ -1 +1,3 @@
expect(true).to.be.true;
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
expect(true).to.be.true
@@ -1,21 +1,27 @@
/* eslint-disable
mocha/handle-done-callback,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("async", function() {
it("bar fails", function(done) {
this.timeout(100);
describe('async', () => {
it('bar fails', function (done) {
this.timeout(100)
cy.on("fail", function() {});
cy.on('fail', () => {})
//# async caught fail
return foo.bar();
});
// async caught fail
return foo.bar()
})
return it("fails async after cypress command", function(done) {
this.timeout(100);
it('fails async after cypress command', function (done) {
this.timeout(100)
return cy.wait(0);
});
});
return cy.wait(0)
})
})
@@ -1,8 +1,17 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("base url", () => it("can visit", () => cy
.visit("/html")
.contains("Herman Melville")));
describe('base url', () => {
it('can visit', () => {
return cy
.visit('/html')
.contains('Herman Melville')
})
})
@@ -1,25 +1,46 @@
/* eslint-disable
brace-style,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("block hosts", () => it("forces blocked hosts to return 503", () => cy
.visit("http://localhost:3232")
describe('block hosts', () => {
it('forces blocked hosts to return 503', () => {
return cy
.visit('http://localhost:3232')
.window().then(win => new Promise(function(resolve) {
const xhr = new win.XMLHttpRequest;
xhr.open("GET", "http://localhost:3232/req");
xhr.setRequestHeader('Content-Type', 'text/plain');
xhr.send();
return xhr.onload = () => resolve(xhr);
})).its("status").should("eq", 200)
.window().then((win) => {
return new Promise((resolve) => {
const xhr = new win.XMLHttpRequest
.window().then(win => new Promise(function(resolve) {
const xhr = new win.XMLHttpRequest;
xhr.open("GET", "http://localhost:3131/req");
xhr.setRequestHeader('Content-Type', 'text/plain');
xhr.send();
return xhr.onerror = () => //# cross origin requests which return 503
//# result in a zero status code
resolve(xhr);
})).its("status").should("eq", 0)));
xhr.open('GET', 'http://localhost:3232/req')
xhr.setRequestHeader('Content-Type', 'text/plain')
xhr.send()
xhr.onload = () => {
return resolve(xhr)
}
})
}).its('status').should('eq', 200)
.window().then((win) => {
return new Promise((resolve) => {
const xhr = new win.XMLHttpRequest
xhr.open('GET', 'http://localhost:3131/req')
xhr.setRequestHeader('Content-Type', 'text/plain')
xhr.send()
xhr.onerror = () => // cross origin requests which return 503
// result in a zero status code
{
return resolve(xhr)
}
})
}).its('status').should('eq', 0)
})
})
@@ -1,19 +1,35 @@
/* eslint-disable
mocha/no-global-tests,
no-undef,
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const req = win => new Promise(function(resolve, reject) {
const rand = Math.random();
const req = (win) => {
return new Promise((resolve, reject) => {
const rand = Math.random()
const xhr = new win.XMLHttpRequest();
xhr.open("GET", "http://localhost:1515/cached/");
xhr.onload = () => resolve(win);
xhr.onerror = reject;
return xhr.send();
});
const xhr = new win.XMLHttpRequest()
it("makes cached request", () => cy
.visit("http://localhost:1515")
.then(req) //# this creates the disk cache
.then(req)); //# this should not hit our server
xhr.open('GET', 'http://localhost:1515/cached/')
xhr.onload = () => {
return resolve(win)
}
xhr.onerror = reject
return xhr.send()
})
}
it('makes cached request', () => {
return cy
.visit('http://localhost:1515')
.then(req) // this creates the disk cache
.then(req)
}) // this should not hit our server
@@ -1,93 +1,127 @@
/* eslint-disable
brace-style,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
//# the goal of what we want to achieve in regards to caching is this
//# 1. for internal file server requests, do not cache but do set etags
//# 2. for http server requests, respect whatever the 3rd party server sends
//# 3. for any kind of cy.visit always force cache-control: no-cache headers
// the goal of what we want to achieve in regards to caching is this
// 1. for internal file server requests, do not cache but do set etags
// 2. for http server requests, respect whatever the 3rd party server sends
// 3. for any kind of cy.visit always force cache-control: no-cache headers
const send = win => new Cypress.Promise(function(resolve) {
const xhr = new win.XMLHttpRequest;
xhr.open("GET", "/static/foo.js");
xhr.send();
return xhr.onload = () => resolve({
body: xhr.response,
etag: xhr.getResponseHeader("etag"),
cacheControl: xhr.getResponseHeader("cache-control")
});
});
const send = (win) => {
return new Cypress.Promise((resolve) => {
const xhr = new win.XMLHttpRequest
describe("caching", function() {
it("does not cache cy.visit file server requests", () => cy
.request("POST", "http://localhost:1515/write/hi")
.visit("/index.html?local")
.get("h1").should("contain", "hi")
.request("POST", "http://localhost:1515/write/hello")
.visit("/index.html?local")
.get("h1").should("contain", "hello"));
xhr.open('GET', '/static/foo.js')
xhr.send()
it("sets etags on file assets, but no cache-control", () => cy
.writeFile("static/foo.js", "alert('hi')")
.visit("/index.html?local")
.window().then(win => send(win)).then(function(resp1) {
//# make sure our file server is not telling the browser
//# to cache anything
expect(resp1.cacheControl).to.eq("public, max-age=0");
xhr.onload = () => {
return resolve({
body: xhr.response,
etag: xhr.getResponseHeader('etag'),
cacheControl: xhr.getResponseHeader('cache-control'),
})
}
})
}
describe('caching', () => {
it('does not cache cy.visit file server requests', () => {
return cy
.request('POST', 'http://localhost:1515/write/hi')
.visit('/index.html?local')
.get('h1').should('contain', 'hi')
.request('POST', 'http://localhost:1515/write/hello')
.visit('/index.html?local')
.get('h1').should('contain', 'hello')
})
it('sets etags on file assets, but no cache-control', () => {
return cy
.writeFile('static/foo.js', 'alert(\'hi\')')
.visit('/index.html?local')
.window().then((win) => {
return send(win)
}).then((resp1) => {
// make sure our file server is not telling the browser
// to cache anything
expect(resp1.cacheControl).to.eq('public, max-age=0')
return cy
.window().then(win => send(win)).then(function(resp2) {
//# these responses should be identical
expect(resp1).to.deep.eq(resp2);
.window().then((win) => {
return send(win)
}).then((resp2) => {
// these responses should be identical
expect(resp1).to.deep.eq(resp2)
return cy
//# now change our static files' content
.writeFile("static/foo.js", "console.log('bar')")
.window().then(win => send(win)).then(function(resp3) {
//# etags should now no longer match!
expect(resp1.etag).not.to.eq(resp3.etag);
return cy
// now change our static files' content
.writeFile('static/foo.js', 'console.log(\'bar\')')
.window().then((win) => {
return send(win)
}).then((resp3) => {
// etags should now no longer match!
expect(resp1.etag).not.to.eq(resp3.etag)
//# nor should bodies match
expect(resp1.body).not.to.eq(resp3.body);
// nor should bodies match
expect(resp1.body).not.to.eq(resp3.body)
//# but cache control should
return expect(resp1.cacheControl).to.eq(resp3.cacheControl);
});
});
}));
// but cache control should
expect(resp1.cacheControl).to.eq(resp3.cacheControl)
})
})
})
})
it("does not cache cy.visit http server requests", () => //# even though our server sends down cache headers
//# we are explicitly turning them off in the proxy
//# whenever we have to inject new content into the page
cy
.request("POST", "http://localhost:1515/write/hi")
.visit("http://localhost:1515/index.html?http")
.get("h1").should("contain", "hi")
.request("POST", "http://localhost:1515/write/foo")
.visit("http://localhost:1515/index.html?http")
.get("h1").should("contain", "foo"));
it('does not cache cy.visit http server requests', () => // even though our server sends down cache headers
// we are explicitly turning them off in the proxy
// whenever we have to inject new content into the page
{
return cy
.request('POST', 'http://localhost:1515/write/hi')
.visit('http://localhost:1515/index.html?http')
.get('h1').should('contain', 'hi')
.request('POST', 'http://localhost:1515/write/foo')
.visit('http://localhost:1515/index.html?http')
.get('h1').should('contain', 'foo')
})
return it("respects cache control headers from 3rd party http servers", () => cy
.writeFile("static/foo.js", "alert('hi')")
.visit("http://localhost:1515/index.html?http")
.window().then(win => send(win)).then(function(resp1) {
//# we've set express.static to cache assets
expect(resp1.cacheControl).to.eq("public, max-age=3600");
it('respects cache control headers from 3rd party http servers', () => {
return cy
.writeFile('static/foo.js', 'alert(\'hi\')')
.visit('http://localhost:1515/index.html?http')
.window().then((win) => {
return send(win)
}).then((resp1) => {
// we've set express.static to cache assets
expect(resp1.cacheControl).to.eq('public, max-age=3600')
return cy
.window().then(win => send(win)).then(function(resp2) {
//# these responses should be identical
expect(resp1).to.deep.eq(resp2);
.window().then((win) => {
return send(win)
}).then((resp2) => {
// these responses should be identical
expect(resp1).to.deep.eq(resp2)
return cy
//# now change our static files' content
.writeFile("static/foo.js", "console.log('bar')")
.window().then(win => send(win)).then(resp3 => //# but because of the cache-control headers
//# our browser should NOT have made a
//# new http request and therefore all of
//# these should still match
expect(resp1).to.deep.eq(resp3));
});
}));
});
return cy
// now change our static files' content
.writeFile('static/foo.js', 'console.log(\'bar\')')
.window().then((win) => {
return send(win)
}).then((resp3) => // but because of the cache-control headers
// our browser should NOT have made a
// new http request and therefore all of
// these should still match
{
expect(resp1).to.deep.eq(resp3)
})
})
})
})
})
@@ -1,55 +1,82 @@
/* eslint-disable
brace-style,
mocha/handle-done-callback,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("foo", function() {
it("baz fails", () => //# synchronous caught fail
foo.bar());
describe('foo', () => {
it('baz fails', () => // synchronous caught fail
{
return foo.bar()
})
it("bar fails", done => //# async caught fail
foo.bar());
it('bar fails', (done) => // async caught fail
{
return foo.bar()
})
it("quux fails", done => //# commands caught never calling done
//# with no fail handler should immediately die
cy.wrap(null).then(() => foo.bar()));
it('quux fails', (done) => // commands caught never calling done
// with no fail handler should immediately die
{
return cy.wrap(null).then(() => {
return foo.bar()
})
})
it("quux2 fails", function(done) {
cy.on("fail", () => foo.bar());
it('quux2 fails', (done) => {
cy.on('fail', () => {
return foo.bar()
})
//# commands caught never calling done
//# but have a failing handler should die
return cy.wrap(null).then(() => foo.bar());
});
// commands caught never calling done
// but have a failing handler should die
return cy.wrap(null).then(() => {
return foo.bar()
})
})
it("quux3 passes", function(done) {
cy.on("fail", () => done());
it('quux3 passes', (done) => {
cy.on('fail', () => {
return done()
})
//# commands caught with a fail handler
//# and call done should pass
return cy.wrap(null).then(() => foo.bar());
});
// commands caught with a fail handler
// and call done should pass
return cy.wrap(null).then(() => {
return foo.bar()
})
})
it("quux4 passes", function() {
cy.on("fail", function() {});
it('quux4 passes', () => {
cy.on('fail', () => {})
//# commands caught with a fail handler
//# and no done callback will pass if
//# nothing throws in the fail callback
return cy.wrap(null).then(() => foo.bar());
});
// commands caught with a fail handler
// and no done callback will pass if
// nothing throws in the fail callback
return cy.wrap(null).then(() => {
return foo.bar()
})
})
it("quux5 passes", function() {
cy.on("fail", function() {});
it('quux5 passes', () => {
cy.on('fail', () => {})
//# no commands fail handler should pass
return foo.bar();
});
// no commands fail handler should pass
return foo.bar()
})
return it("quux6 passes", function(done) {
cy.on("fail", () => done());
it('quux6 passes', (done) => {
cy.on('fail', () => {
return done()
})
//# no commands fail async handler should pass
return foo.bar();
});
});
// no commands fail async handler should pass
return foo.bar()
})
})
@@ -1,15 +1,23 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("No Running Test", function() {
it("foo", () => cy.noop());
describe('No Running Test', () => {
it('foo', () => {
return cy.noop()
})
it("bar", function() {});
it('bar', () => {})
return context("nested suite", function() {
cy.viewport("iphone-6");
return cy.get("h1");
});
});
context('nested suite', () => {
cy.viewport('iphone-6')
return cy.get('h1')
})
})
@@ -1,51 +1,68 @@
/* eslint-disable
brace-style,
no-fallthrough,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("Cypress static methods + props", function() {
it(".version", () => expect(Cypress.version).to.be.a("string"));
describe('Cypress static methods + props', () => {
it('.version', () => {
expect(Cypress.version).to.be.a('string')
})
it(".platform", function() {
expect(Cypress.platform).to.be.a("string");
return expect(Cypress.platform).to.be.oneOf(["darwin", "linux", "win32"]);
});
it('.platform', () => {
expect(Cypress.platform).to.be.a('string')
it(".arch", () => expect(Cypress.arch).to.be.a("string"));
expect(Cypress.platform).to.be.oneOf(['darwin', 'linux', 'win32'])
})
it(".browser", function() {
const { browser } = Cypress;
it('.arch', () => {
expect(Cypress.arch).to.be.a('string')
})
expect(browser).to.be.an("object");
expect(browser.name).to.be.oneOf(["electron", "chrome", "chromium"]);
expect(browser.displayName).to.be.oneOf(["Electron", "Chrome", "Canary", "Chromium"]);
expect(browser.version).to.be.a("string");
it('.browser', () => {
const { browser } = Cypress
expect(browser).to.be.an('object')
expect(browser.name).to.be.oneOf(['electron', 'chrome', 'chromium'])
expect(browser.displayName).to.be.oneOf(['Electron', 'Chrome', 'Canary', 'Chromium'])
expect(browser.version).to.be.a('string')
// we are parsing major version, so it should be a number
expect(browser.majorVersion).to.be.a("number");
expect(browser.path).to.be.a("string");
expect(browser.majorVersion).to.be.a('number')
expect(browser.path).to.be.a('string')
switch (browser.isHeadless) {
case true:
return expect(browser.isHeaded).to.be.false;
expect(browser.isHeaded).to.be.false
case false:
return expect(browser.isHeaded).to.be.true;
expect(browser.isHeaded).to.be.true
default:
return expect(browser.isHeadless, "browser.isHeadless").not.to.be.undefined;
expect(browser.isHeadless, 'browser.isHeadless').not.to.be.undefined
}
});
})
it(".spec", function() {
const { spec } = Cypress;
it('.spec', () => {
const { spec } = Cypress
expect(spec).to.be.an("object");
expect(spec.name).to.eq("config_passing_spec.coffee");
expect(spec.relative).to.eq("cypress/integration/config_passing_spec.coffee");
return expect(spec.absolute.indexOf("cypress/integration/config_passing_spec.coffee")).to.be.gt(0);
});
expect(spec).to.be.an('object')
expect(spec.name).to.eq('config_passing_spec.coffee')
expect(spec.relative).to.eq('cypress/integration/config_passing_spec.coffee')
return context(".env", () => //# https://github.com/cypress-io/cypress/issues/4952
it(
"doesn't die on <script> tags",
() => expect(Cypress.env('scriptlet')).to.eq("<script>alert('this should not break')</script>")
));
});
expect(spec.absolute.indexOf('cypress/integration/config_passing_spec.coffee')).to.be.gt(0)
})
context('.env', () => // https://github.com/cypress-io/cypress/issues/4952
{
it(
'doesn\'t die on <script> tags',
() => {
expect(Cypress.env('scriptlet')).to.eq('<script>alert(\'this should not break\')</script>')
},
)
})
})
@@ -1,331 +1,396 @@
/* eslint-disable
brace-style,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const { _ } = Cypress;
const { _ } = Cypress
const expectedDomain = Cypress.env('expectedDomain');
const httpUrl = Cypress.env('httpUrl');
const httpsUrl = Cypress.env('httpsUrl');
const otherUrl = Cypress.env('otherUrl');
const otherHttpsUrl = Cypress.env('otherHttpsUrl');
const expectedDomain = Cypress.env('expectedDomain')
const httpUrl = Cypress.env('httpUrl')
const httpsUrl = Cypress.env('httpsUrl')
const otherUrl = Cypress.env('otherUrl')
const otherHttpsUrl = Cypress.env('otherHttpsUrl')
const baseUrlLocation = new Cypress.Location(Cypress.config('baseUrl'));
const baseUrlLocation = new Cypress.Location(Cypress.config('baseUrl'))
//# setcookie sets on the superdomain by default
let setCookieDomain = `.${baseUrlLocation.getSuperDomain()}`;
// setcookie sets on the superdomain by default
let setCookieDomain = `.${baseUrlLocation.getSuperDomain()}`
if (['localhost', '127.0.0.1'].includes(expectedDomain)) {
setCookieDomain = expectedDomain;
setCookieDomain = expectedDomain
}
//# chrome defaults to "unspecified"
let defaultSameSite = undefined;
// chrome defaults to "unspecified"
let defaultSameSite = undefined
if (Cypress.isBrowser('firefox')) {
//# firefox will default to "no_restriction"
//# @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
defaultSameSite = 'no_restriction';
// firefox will default to "no_restriction"
// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
defaultSameSite = 'no_restriction'
}
describe("cookies", function() {
before(function() {
describe('cookies', () => {
before(() => {
if (Cypress.env('noBaseUrl')) {
return;
return
}
//# assert we're running on expected baseurl
return expect(Cypress.env('baseUrl')).to.be.a('string')
// assert we're running on expected baseurl
expect(Cypress.env('baseUrl')).to.be.a('string')
.and.have.length.gt(0)
.and.eq(Cypress.config('baseUrl'));
});
.and.eq(Cypress.config('baseUrl'))
})
beforeEach(() => cy.wrap({foo: "bar"}));
beforeEach(() => {
return cy.wrap({ foo: 'bar' })
})
context("with preserve", function() {
before(() => Cypress.Cookies.defaults({
preserve: "foo1"
}));
context('with preserve', () => {
before(() => {
return Cypress.Cookies.defaults({
preserve: 'foo1',
})
})
it("can get all cookies", function() {
const expectedCookieKeys = ["domain", "name", "value", "path", "secure", "httpOnly", "expiry"];
it('can get all cookies', () => {
const expectedCookieKeys = ['domain', 'name', 'value', 'path', 'secure', 'httpOnly', 'expiry']
if (defaultSameSite) {
//# samesite will only be present if it is defined
expectedCookieKeys.push('sameSite');
// samesite will only be present if it is defined
expectedCookieKeys.push('sameSite')
}
const assertFirstCookie = function(c) {
expect(c.domain).to.eq(setCookieDomain);
expect(c.httpOnly).to.eq(false);
expect(c.name).to.eq("foo");
expect(c.value).to.eq("bar");
expect(c.path).to.eq("/");
expect(c.secure).to.eq(false);
expect(c.expiry).to.be.a("number");
expect(c.sameSite).to.eq(defaultSameSite);
const assertFirstCookie = function (c) {
expect(c.domain).to.eq(setCookieDomain)
expect(c.httpOnly).to.eq(false)
expect(c.name).to.eq('foo')
expect(c.value).to.eq('bar')
expect(c.path).to.eq('/')
expect(c.secure).to.eq(false)
expect(c.expiry).to.be.a('number')
expect(c.sameSite).to.eq(defaultSameSite)
return expect(c).to.have.keys(expectedCookieKeys);
};
expect(c).to.have.keys(expectedCookieKeys)
}
return cy
.clearCookie("foo1")
.setCookie("foo", "bar").then(assertFirstCookie)
.getCookies()
.should("have.length", 1)
.its(0)
.then(assertFirstCookie)
.clearCookies()
.should("be.null")
.setCookie("wtf", "bob", {httpOnly: true, path: "/foo", secure: true})
.getCookie("wtf").then(function(c) {
expect(c.domain).to.eq(setCookieDomain);
expect(c.httpOnly).to.eq(true);
expect(c.name).to.eq("wtf");
expect(c.value).to.eq("bob");
expect(c.path).to.eq("/foo");
expect(c.secure).to.eq(true);
expect(c.expiry).to.be.a("number");
expect(c.sameSite).to.eq(defaultSameSite);
.clearCookie('foo1')
.setCookie('foo', 'bar').then(assertFirstCookie)
.getCookies()
.should('have.length', 1)
.its(0)
.then(assertFirstCookie)
.clearCookies()
.should('be.null')
.setCookie('wtf', 'bob', { httpOnly: true, path: '/foo', secure: true })
.getCookie('wtf').then((c) => {
expect(c.domain).to.eq(setCookieDomain)
expect(c.httpOnly).to.eq(true)
expect(c.name).to.eq('wtf')
expect(c.value).to.eq('bob')
expect(c.path).to.eq('/foo')
expect(c.secure).to.eq(true)
expect(c.expiry).to.be.a('number')
expect(c.sameSite).to.eq(defaultSameSite)
return expect(c).to.have.keys(expectedCookieKeys);}).clearCookie("wtf")
.should("be.null")
.getCookie("doesNotExist")
.should("be.null")
.document()
.its("cookie")
.should("be.empty");
});
expect(c).to.have.keys(expectedCookieKeys)
}).clearCookie('wtf')
.should('be.null')
.getCookie('doesNotExist')
.should('be.null')
.document()
.its('cookie')
.should('be.empty')
})
it("resets cookies between tests correctly", function() {
Cypress.Cookies.preserveOnce("foo2");
it('resets cookies between tests correctly', () => {
Cypress.Cookies.preserveOnce('foo2')
for (let i = 1; i <= 100; i++) {
((i => cy.setCookie("foo" + i, `${i}`)))(i);
(((i) => {
return cy.setCookie(`foo${i}`, `${i}`)
}))(i)
}
return cy.getCookies().should("have.length", 100);
});
return cy.getCookies().should('have.length', 100)
})
it("should be only two left now", () => cy.getCookies().should("have.length", 2));
it('should be only two left now', () => {
return cy.getCookies().should('have.length', 2)
})
return it("handles undefined cookies", () => cy.visit("/cookieWithNoName"));
});
it('handles undefined cookies', () => {
return cy.visit('/cookieWithNoName')
})
})
return context("without preserve", function() {
before(() => Cypress.Cookies.defaults({
preserve: []
}));
context('without preserve', () => {
before(() => {
return Cypress.Cookies.defaults({
preserve: [],
})
})
it("sends set cookies to path", () => cy
it('sends set cookies to path', () => {
return cy
.clearCookies()
.setCookie("asdf", "jkl")
.request("/requestCookies")
.its("body").should("deep.eq", { asdf: "jkl" }));
.setCookie('asdf', 'jkl')
.request('/requestCookies')
.its('body').should('deep.eq', { asdf: 'jkl' })
})
it("handles expired cookies secure", () => cy
.visit("/set")
.getCookie("shouldExpire").should("exist")
.visit("/expirationMaxAge")
.getCookie("shouldExpire").should("not.exist")
.visit("/set")
.getCookie("shouldExpire").should("exist")
.visit("/expirationExpires")
.getCookie("shouldExpire").should("not.exist"));
it('handles expired cookies secure', () => {
return cy
.visit('/set')
.getCookie('shouldExpire').should('exist')
.visit('/expirationMaxAge')
.getCookie('shouldExpire').should('not.exist')
.visit('/set')
.getCookie('shouldExpire').should('exist')
.visit('/expirationExpires')
.getCookie('shouldExpire').should('not.exist')
})
it("issue: #224 sets expired cookies between redirects", () => cy
.visit("/set")
.getCookie("shouldExpire").should("exist")
.visit("/expirationRedirect")
.url().should("include", "/logout")
.getCookie("shouldExpire").should("not.exist")
it('issue: #224 sets expired cookies between redirects', () => {
return cy
.visit('/set')
.getCookie('shouldExpire').should('exist')
.visit('/expirationRedirect')
.url().should('include', '/logout')
.getCookie('shouldExpire').should('not.exist')
.visit("/set")
.getCookie("shouldExpire").should("exist")
.request("/expirationRedirect")
.getCookie("shouldExpire").should("not.exist"));
.visit('/set')
.getCookie('shouldExpire').should('exist')
.request('/expirationRedirect')
.getCookie('shouldExpire').should('not.exist')
})
it("issue: #1321 failing to set or parse cookie", () => //# this is happening because the original cookie was set
//# with a secure flag, and then expired without the secure
//# flag.
cy
it('issue: #1321 failing to set or parse cookie', () => // this is happening because the original cookie was set
// with a secure flag, and then expired without the secure
// flag.
{
return cy
.visit(`${httpsUrl}/setOneHourFromNowAndSecure`)
.getCookies().should("have.length", 1)
.getCookies().should('have.length', 1)
//# secure cookies should have been attached
// secure cookies should have been attached
.request(`${httpsUrl}/requestCookies`)
.its("body").should("deep.eq", { shouldExpire: "oneHour" })
.its('body').should('deep.eq', { shouldExpire: 'oneHour' })
//# secure cookies should not have been attached
// secure cookies should not have been attached
.request(`${httpUrl}/requestCookies`)
.its("body").should("deep.eq", {})
.its('body').should('deep.eq', {})
.visit(`${httpsUrl}/expirationMaxAge`)
.getCookies().should("be.empty"));
.getCookies().should('be.empty')
})
it("issue: #2724 does not fail on invalid cookies", () => cy.request(`${httpsUrl}/invalidCookies`));
it('issue: #2724 does not fail on invalid cookies', () => {
return cy.request(`${httpsUrl}/invalidCookies`)
})
//# https://github.com/cypress-io/cypress/issues/5453
it("can set and clear cookie", function() {
cy.setCookie('foo', 'bar');
cy.clearCookie('foo');
return cy.getCookie('foo').should('be.null');
});
// https://github.com/cypress-io/cypress/issues/5453
it('can set and clear cookie', () => {
cy.setCookie('foo', 'bar')
cy.clearCookie('foo')
return cy.getCookie('foo').should('be.null')
})
return [
'visit',
'request'
].forEach(cmd => context(`in a cy.${cmd}`, function() {
//# https://github.com/cypress-io/cypress/issues/5894
it("can successfully send cookies as a Cookie header", () => cy[cmd]({
url: `/requestCookies${cmd === 'visit' ? 'Html' : ''}`,
headers: {
Cookie: 'a=b;b=c;c=s%3APtCc3lNiuqN0AtR9ffgKUnUsDzR5n_4B.qzFDJDvqx8PZNvmOkmcexDs7fRJLOel56Z8Ii6PL%2BFo'
},
method: cmd === 'visit' ? 'POST' : 'PATCH'
})
.then(function(res) {
if (cmd === 'visit') {
return cy.get('body').then(body => JSON.parse(body.text()));
}
return res.body;}).then(cookies => expect(cookies).to.deep.eq({
a: 'b',
b: 'c',
c: 's:PtCc3lNiuqN0AtR9ffgKUnUsDzR5n_4B.qzFDJDvqx8PZNvmOkmcexDs7fRJLOel56Z8Ii6PL+Fo'
})));
'request',
].forEach((cmd) => {
context(`in a cy.${cmd}`, () => {
// https://github.com/cypress-io/cypress/issues/5894
it('can successfully send cookies as a Cookie header', () => {
return cy[cmd]({
url: `/requestCookies${cmd === 'visit' ? 'Html' : ''}`,
headers: {
Cookie: 'a=b;b=c;c=s%3APtCc3lNiuqN0AtR9ffgKUnUsDzR5n_4B.qzFDJDvqx8PZNvmOkmcexDs7fRJLOel56Z8Ii6PL%2BFo',
},
method: cmd === 'visit' ? 'POST' : 'PATCH',
})
.then((res) => {
if (cmd === 'visit') {
return cy.get('body').then((body) => {
return JSON.parse(body.text())
})
}
//# https://github.com/cypress-io/cypress/issues/6890
it("ignores invalid set-cookie headers that contain control chars", function() {
cy[cmd]("/invalidControlCharCookie");
return res.body
}).then((cookies) => {
expect(cookies).to.deep.eq({
a: 'b',
b: 'c',
c: 's:PtCc3lNiuqN0AtR9ffgKUnUsDzR5n_4B.qzFDJDvqx8PZNvmOkmcexDs7fRJLOel56Z8Ii6PL+Fo',
})
})
})
return cy.request("/requestCookies")
.then(res => res.body).then(cookies => expect(cookies).to.deep.eq({
_valid: 'true'
}));
});
// https://github.com/cypress-io/cypress/issues/6890
it('ignores invalid set-cookie headers that contain control chars', () => {
cy[cmd]('/invalidControlCharCookie')
context("with Domain = superdomain", function() {
const requestCookiesUrl = `${Cypress.config('baseUrl')}/requestCookies`;
const setDomainCookieUrl = `${Cypress.config('baseUrl')}/setDomainCookie?domain=${setCookieDomain}`;
return cy.request('/requestCookies')
.then((res) => {
return res.body
}).then((cookies) => {
expect(cookies).to.deep.eq({
_valid: 'true',
})
})
})
it("is set properly with no redirects", function() {
cy[cmd](setDomainCookieUrl);
context('with Domain = superdomain', () => {
const requestCookiesUrl = `${Cypress.config('baseUrl')}/requestCookies`
const setDomainCookieUrl = `${Cypress.config('baseUrl')}/setDomainCookie?domain=${setCookieDomain}`
cy.getCookies()
.then(function(cookies) {
expect(cookies).to.have.length(1);
return expect(cookies[0]).to.include({
name: 'domaincookie',
value: 'foo'
});
});
it('is set properly with no redirects', () => {
cy[cmd](setDomainCookieUrl)
cy.request(requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' });
return cy.request('POST', requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' });
});
cy.getCookies()
.then((cookies) => {
expect(cookies).to.have.length(1)
return it("is set properly with redirects", function() {
cy[cmd](`${setDomainCookieUrl}&redirect=/requestCookiesHtml`);
expect(cookies[0]).to.include({
name: 'domaincookie',
value: 'foo',
})
})
cy.getCookies()
.then(function(cookies) {
expect(cookies).to.have.length(1);
return expect(cookies[0]).to.include({
name: 'domaincookie',
value: 'foo'
});
});
cy.request(requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' })
if (cmd === 'visit') {
cy.url().should('include', requestCookiesUrl);
cy.contains('domaincookie');
}
return cy.request('POST', requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' })
})
cy.request(requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' });
return cy.request('POST', requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' });
});
});
it('is set properly with redirects', () => {
cy[cmd](`${setDomainCookieUrl}&redirect=/requestCookiesHtml`)
context("with SameSite", () => [
{ header: 'None', sameSite: 'no_restriction' },
{ header: 'Strict', sameSite: 'strict' },
{ header: 'Lax', sameSite: 'lax' }
].forEach(({ header, sameSite }) => it(`${header} is set and sent with subsequent requests`, function() {
const name = `ss${header}`;
cy.getCookie(name).should('be.null');
cy.getCookies()
.then((cookies) => {
expect(cookies).to.have.length(1)
let sameSiteUrl = `/samesite/${header}`;
let cookieDumpUrl = "/requestCookies";
expect(cookies[0]).to.include({
name: 'domaincookie',
value: 'foo',
})
})
if (header === "None") {
//# None should only be sent + set with HTTPS requests
cookieDumpUrl = [httpsUrl, cookieDumpUrl].join('');
sameSiteUrl = [httpsUrl, sameSiteUrl].join('');
}
if (cmd === 'visit') {
cy.url().should('include', requestCookiesUrl)
cy.contains('domaincookie')
}
cy[cmd](sameSiteUrl);
cy.request(requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' })
cy.getCookie(name).should('include', {
name,
value: 'someval',
sameSite
});
return cy.request('POST', requestCookiesUrl).its('body').should('include', { 'domaincookie': 'foo' })
})
})
cy.visit(`${cookieDumpUrl}Html`)
.then(res => cy.get('body').then(body => JSON.parse(body.text()))).then(body => expect(body).to.have.property(name).and.eq('someval'));
context('with SameSite', () => {
return [
{ header: 'None', sameSite: 'no_restriction' },
{ header: 'Strict', sameSite: 'strict' },
{ header: 'Lax', sameSite: 'lax' },
].forEach(({ header, sameSite }) => {
it(`${header} is set and sent with subsequent requests`, () => {
const name = `ss${header}`
return cy.request(cookieDumpUrl)
.then(({ body }) => expect(body).to.have.property(name).and.eq('someval'));
})));
cy.getCookie(name).should('be.null')
return [
['HTTP', otherUrl],
['HTTPS', otherHttpsUrl],
].forEach(([protocol, altUrl]) => {
return context(`when redirected to a ${protocol} URL`, () => [
['different domain', 7],
['same domain', 8]
].forEach(([title, n]) => it(`can set cookies on lots of redirects, ending with ${title}`, function() {
const altDomain = (new Cypress.Location(altUrl)).getHostName();
let sameSiteUrl = `/samesite/${header}`
let cookieDumpUrl = '/requestCookies'
let expectedGetCookiesArray = [];
_.times(n + 1, i => {
return ['foo', 'bar'].forEach(function(tag) {
const expectedCookie = {
"name": `name${tag}${i}`,
"value": `val${tag}${i}`,
"path": "/",
"domain": (i % 2) === (8 - n) ? expectedDomain : altDomain,
"secure": false,
"httpOnly": false,
};
if (defaultSameSite) {
expectedCookie.sameSite = defaultSameSite;
if (header === 'None') {
// None should only be sent + set with HTTPS requests
cookieDumpUrl = [httpsUrl, cookieDumpUrl].join('')
sameSiteUrl = [httpsUrl, sameSiteUrl].join('')
}
return expectedGetCookiesArray.push(expectedCookie);
});
});
cy[cmd](sameSiteUrl)
expectedGetCookiesArray = _.reverse(_.sortBy(expectedGetCookiesArray, _.property('name')));
cy.getCookie(name).should('include', {
name,
value: 'someval',
sameSite,
})
// sanity check
cy.clearCookies({ domain: null });
cy.getCookies({ domain: null }).should('have.length', 0);
cy.visit(`${cookieDumpUrl}Html`)
.then((res) => {
return cy.get('body').then((body) => {
return JSON.parse(body.text())
})
}).then((body) => {
expect(body).to.have.property(name).and.eq('someval')
})
cy[cmd](`/setCascadingCookies?n=${n}&a=${altUrl}&b=${Cypress.env('baseUrl')}`);
return cy.request(cookieDumpUrl)
.then(({ body }) => {
expect(body).to.have.property(name).and.eq('someval')
})
})
})
})
return cy.getCookies({ domain: null }).then(function(cookies) {
//# reverse them so they'll be in the order they were set
cookies = _.reverse(_.sortBy(cookies, _.property('name')));
return [
['HTTP', otherUrl],
['HTTPS', otherHttpsUrl],
].forEach(([protocol, altUrl]) => {
context(`when redirected to a ${protocol} URL`, () => {
return [
['different domain', 7],
['same domain', 8],
].forEach(([title, n]) => {
it(`can set cookies on lots of redirects, ending with ${title}`, () => {
const altDomain = (new Cypress.Location(altUrl)).getHostName()
return expect(cookies).to.deep.eq(expectedGetCookiesArray);
});
})));
});
}));
});
});
let expectedGetCookiesArray = []
_.times(n + 1, (i) => {
return ['foo', 'bar'].forEach((tag) => {
const expectedCookie = {
'name': `name${tag}${i}`,
'value': `val${tag}${i}`,
'path': '/',
'domain': (i % 2) === (8 - n) ? expectedDomain : altDomain,
'secure': false,
'httpOnly': false,
}
if (defaultSameSite) {
expectedCookie.sameSite = defaultSameSite
}
return expectedGetCookiesArray.push(expectedCookie)
})
})
expectedGetCookiesArray = _.reverse(_.sortBy(expectedGetCookiesArray, _.property('name')))
// sanity check
cy.clearCookies({ domain: null })
cy.getCookies({ domain: null }).should('have.length', 0)
cy[cmd](`/setCascadingCookies?n=${n}&a=${altUrl}&b=${Cypress.env('baseUrl')}`)
return cy.getCookies({ domain: null }).then((cookies) => {
// reverse them so they'll be in the order they were set
cookies = _.reverse(_.sortBy(cookies, _.property('name')))
expect(cookies).to.deep.eq(expectedGetCookiesArray)
})
})
})
})
})
})
})
})
})
@@ -1,137 +1,168 @@
/* eslint-disable
brace-style,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const httpUrl = Cypress.env('httpUrl');
const httpsUrl = Cypress.env('httpsUrl');
const httpUrl = Cypress.env('httpUrl')
const httpsUrl = Cypress.env('httpsUrl')
describe("cookies", function() {
beforeEach(() => cy.wrap({foo: "bar"}));
describe('cookies', () => {
beforeEach(() => {
return cy.wrap({ foo: 'bar' })
})
context("with preserve", function() {
before(() => Cypress.Cookies.defaults({
preserve: "foo1"
}));
context('with preserve', () => {
before(() => {
return Cypress.Cookies.defaults({
preserve: 'foo1',
})
})
it("can get all cookies", function() {
const expectedKeys = ["domain", "name", "value", "path", "secure", "httpOnly", "expiry"];
it('can get all cookies', () => {
const expectedKeys = ['domain', 'name', 'value', 'path', 'secure', 'httpOnly', 'expiry']
if (Cypress.isBrowser('firefox')) {
expectedKeys.push('sameSite');
expectedKeys.push('sameSite')
}
return cy
.clearCookie("foo1")
.setCookie("foo", "bar").then(function(c) {
expect(c.domain).to.eq("localhost");
expect(c.httpOnly).to.eq(false);
expect(c.name).to.eq("foo");
expect(c.value).to.eq("bar");
expect(c.path).to.eq("/");
expect(c.secure).to.eq(false);
expect(c.expiry).to.be.a("number");
.clearCookie('foo1')
.setCookie('foo', 'bar').then((c) => {
expect(c.domain).to.eq('localhost')
expect(c.httpOnly).to.eq(false)
expect(c.name).to.eq('foo')
expect(c.value).to.eq('bar')
expect(c.path).to.eq('/')
expect(c.secure).to.eq(false)
expect(c.expiry).to.be.a('number')
return expect(c).to.have.keys(expectedKeys);}).getCookies()
.should("have.length", 1)
.then(function(cookies) {
const c = cookies[0];
expect(c).to.have.keys(expectedKeys)
}).getCookies()
.should('have.length', 1)
.then((cookies) => {
const c = cookies[0]
expect(c.domain).to.eq("localhost");
expect(c.httpOnly).to.eq(false);
expect(c.name).to.eq("foo");
expect(c.value).to.eq("bar");
expect(c.path).to.eq("/");
expect(c.secure).to.eq(false);
expect(c.expiry).to.be.a("number");
expect(c.domain).to.eq('localhost')
expect(c.httpOnly).to.eq(false)
expect(c.name).to.eq('foo')
expect(c.value).to.eq('bar')
expect(c.path).to.eq('/')
expect(c.secure).to.eq(false)
expect(c.expiry).to.be.a('number')
return expect(c).to.have.keys(expectedKeys);}).clearCookies()
.should("be.null")
.setCookie("wtf", "bob", {httpOnly: true, path: "/foo", secure: true})
.getCookie("wtf").then(function(c) {
expect(c.domain).to.eq("localhost");
expect(c.httpOnly).to.eq(true);
expect(c.name).to.eq("wtf");
expect(c.value).to.eq("bob");
expect(c.path).to.eq("/foo");
expect(c.secure).to.eq(true);
expect(c.expiry).to.be.a("number");
expect(c).to.have.keys(expectedKeys)
}).clearCookies()
.should('be.null')
.setCookie('wtf', 'bob', { httpOnly: true, path: '/foo', secure: true })
.getCookie('wtf').then((c) => {
expect(c.domain).to.eq('localhost')
expect(c.httpOnly).to.eq(true)
expect(c.name).to.eq('wtf')
expect(c.value).to.eq('bob')
expect(c.path).to.eq('/foo')
expect(c.secure).to.eq(true)
expect(c.expiry).to.be.a('number')
return expect(c).to.have.keys(expectedKeys);}).clearCookie("wtf")
.should("be.null")
.getCookie("doesNotExist")
.should("be.null")
.document()
.its("cookie")
.should("be.empty");
});
expect(c).to.have.keys(expectedKeys)
}).clearCookie('wtf')
.should('be.null')
.getCookie('doesNotExist')
.should('be.null')
.document()
.its('cookie')
.should('be.empty')
})
it("resets cookies between tests correctly", function() {
Cypress.Cookies.preserveOnce("foo2");
it('resets cookies between tests correctly', () => {
Cypress.Cookies.preserveOnce('foo2')
for (let i = 1; i <= 100; i++) {
((i => cy.setCookie("foo" + i, `${i}`)))(i);
(((i) => {
return cy.setCookie(`foo${i}`, `${i}`)
}))(i)
}
return cy.getCookies().should("have.length", 100);
});
return cy.getCookies().should('have.length', 100)
})
it("should be only two left now", () => cy.getCookies().should("have.length", 2));
it('should be only two left now', () => {
return cy.getCookies().should('have.length', 2)
})
return it("handles undefined cookies", () => cy.visit(`${httpUrl}/cookieWithNoName`));
});
it('handles undefined cookies', () => {
return cy.visit(`${httpUrl}/cookieWithNoName`)
})
})
return context("without preserve", function() {
before(() => Cypress.Cookies.defaults({
preserve: []
}));
context('without preserve', () => {
before(() => {
return Cypress.Cookies.defaults({
preserve: [],
})
})
it("sends cookies to localhost:2121", () => cy
it('sends cookies to localhost:2121', () => {
return cy
.clearCookies()
.setCookie("asdf", "jkl")
.setCookie('asdf', 'jkl')
.request(`${httpUrl}/requestCookies`)
.its("body").should("deep.eq", { asdf: "jkl" }));
.its('body').should('deep.eq', { asdf: 'jkl' })
})
it("handles expired cookies secure", () => cy
it('handles expired cookies secure', () => {
return cy
.visit(`${httpUrl}/set`)
.getCookie("shouldExpire").should("exist")
.getCookie('shouldExpire').should('exist')
.visit(`${httpUrl}/expirationMaxAge`)
.getCookie("shouldExpire").should("not.exist")
.getCookie('shouldExpire').should('not.exist')
.visit(`${httpUrl}/set`)
.getCookie("shouldExpire").should("exist")
.getCookie('shouldExpire').should('exist')
.visit(`${httpUrl}/expirationExpires`)
.getCookie("shouldExpire").should("not.exist"));
.getCookie('shouldExpire').should('not.exist')
})
it("issue: #224 sets expired cookies between redirects", () => cy
it('issue: #224 sets expired cookies between redirects', () => {
return cy
.visit(`${httpUrl}/set`)
.getCookie("shouldExpire").should("exist")
.getCookie('shouldExpire').should('exist')
.visit(`${httpUrl}/expirationRedirect`)
.url().should("include", "/logout")
.getCookie("shouldExpire").should("not.exist")
.url().should('include', '/logout')
.getCookie('shouldExpire').should('not.exist')
.visit(`${httpUrl}/set`)
.getCookie("shouldExpire").should("exist")
.getCookie('shouldExpire').should('exist')
.request(`${httpUrl}/expirationRedirect`)
.getCookie("shouldExpire").should("not.exist"));
.getCookie('shouldExpire').should('not.exist')
})
it("issue: #1321 failing to set or parse cookie", () => //# this is happening because the original cookie was set
//# with a secure flag, and then expired without the secure
//# flag.
cy
it('issue: #1321 failing to set or parse cookie', () => // this is happening because the original cookie was set
// with a secure flag, and then expired without the secure
// flag.
{
return cy
.visit(`${httpsUrl}/setOneHourFromNowAndSecure`)
.getCookies().should("have.length", 1)
.getCookies().should('have.length', 1)
//# secure cookies should have been attached
// secure cookies should have been attached
.request(`${httpsUrl}/requestCookies`)
.its("body").should("deep.eq", { shouldExpire: "oneHour" })
.its('body').should('deep.eq', { shouldExpire: 'oneHour' })
//# secure cookies should not have been attached
// secure cookies should not have been attached
.request(`${httpUrl}/requestCookies`)
.its("body").should("deep.eq", {})
.its('body').should('deep.eq', {})
.visit(`${httpsUrl}/expirationMaxAge`)
.getCookies().should("be.empty"));
.getCookies().should('be.empty')
})
return it("issue: #2724 does not fail on invalid cookies", () => cy.request(`${httpsUrl}/invalidCookies`));
});
});
it('issue: #2724 does not fail on invalid cookies', () => {
return cy.request(`${httpsUrl}/invalidCookies`)
})
})
})
@@ -1,13 +1,29 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("localhost", () => it("can visit", () => cy.visit("http://app.localhost:4848")));
describe('localhost', () => {
it('can visit', () => {
return cy.visit('http://app.localhost:4848')
})
})
describe("com.au", () => it("can visit", () => cy.visit("http://foo.bar.baz.com.au:4848")));
describe('com.au', () => {
it('can visit', () => {
return cy.visit('http://foo.bar.baz.com.au:4848')
})
})
describe("herokuapp.com", () => it("can visit", function() {
cy.visit("https://cypress-example.herokuapp.com");
return cy.contains("Getting Started with Node on Heroku");
}));
describe('herokuapp.com', () => {
it('can visit', () => {
cy.visit('https://cypress-example.herokuapp.com')
return cy.contains('Getting Started with Node on Heroku')
})
})
@@ -1,13 +1,29 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("localhost", () => it("can visit", () => cy.visit("http://app.localhost:4848")));
describe('localhost', () => {
it('can visit', () => {
return cy.visit('http://app.localhost:4848')
})
})
describe("com.au", () => it("can visit", () => cy.visit("http://foo.bar.baz.com.au:4848")));
describe('com.au', () => {
it('can visit', () => {
return cy.visit('http://foo.bar.baz.com.au:4848')
})
})
describe("herokuapp.com", () => it("can visit", function() {
cy.visit("https://cypress-example.herokuapp.com");
return cy.contains("Getting Started with Node on Heroku");
}));
describe('herokuapp.com', () => {
it('can visit', () => {
cy.visit('https://cypress-example.herokuapp.com')
return cy.contains('Getting Started with Node on Heroku')
})
})
@@ -1,18 +1,27 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("ending early", function() {
it("does not end early", function() {});
describe('ending early', () => {
it('does not end early', () => {})
return it("does end early", function(done) {
it('does end early', (done) => {
cy
.noop({})
.then(() => Cypress.Promise.delay(1000)).noop({})
.wrap({});
.noop({})
.then(() => {
return Cypress.Promise.delay(1000)
}).noop({})
.wrap({})
return setTimeout(() => done()
, 500);
});
});
return setTimeout(() => {
return done()
}
, 500)
})
})
@@ -1,6 +1,10 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("stdout_specfile_display_spec", () => it("passes", function() {}));
describe('stdout_specfile_display_spec', () => {
it('passes', () => {})
})
@@ -1,6 +1,10 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("stdout_specfile_display_spec", () => it("passes", function() {}));
describe('stdout_specfile_display_spec', () => {
it('passes', () => {})
})
@@ -1,6 +1,15 @@
/* eslint-disable
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
describe("stdout_specfile_display_spec", () => it("passes", () => cy.screenshot()));
describe('stdout_specfile_display_spec', () => {
it('passes', () => {
return cy.screenshot()
})
})
@@ -1,9 +1,16 @@
/* eslint-disable
mocha/no-global-tests,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
it("nests the file based on spec path", function() {
cy.screenshot({ capture: "runner" });
return cy.readFile("cypress/screenshots/nested-1/nested-2/screenshot_nested_file_spec.coffee/nests the file based on spec path.png", 'base64');
});
it('nests the file based on spec path', () => {
cy.screenshot({ capture: 'runner' })
return cy.readFile('cypress/screenshots/nested-1/nested-2/screenshot_nested_file_spec.coffee/nests the file based on spec path.png', 'base64')
})