Skip to content

Commit 82ff851

Browse files
committed
test: stop cypress following redirects
1 parent f5f975f commit 82ff851

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

cypress/integration/default/appdir.spec.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
describe('appDir', () => {
22
it('renders ISR appdir pages as HTML by default', () => {
3-
cy.request('/blog/erica/').then((response) => {
3+
cy.request({ url: '/blog/erica/', followRedirect: false }).then((response) => {
44
expect(response.headers['content-type']).to.match(/^text\/html/)
55
})
66
})
77

88
it('renders static appdir pages as HTML by default', () => {
9-
cy.request('/blog/erica/first-post/').then((response) => {
9+
cy.request({ url: '/blog/erica/first-post/', followRedirect: false }).then((response) => {
1010
expect(response.headers['content-type']).to.match(/^text\/html/)
1111
})
1212
})
1313

1414
it('renders dynamic appdir pages as HTML by default', () => {
15-
cy.request('/blog/erica/random-post/').then((response) => {
15+
cy.request({ url: '/blog/erica/random-post/', followRedirect: false }).then((response) => {
1616
expect(response.headers['content-type']).to.match(/^text\/html/)
1717
})
1818
})
@@ -23,6 +23,7 @@ describe('appDir', () => {
2323
headers: {
2424
RSC: '1',
2525
},
26+
followRedirect: false,
2627
}).then((response) => {
2728
expect(response.headers).to.have.property('content-type', 'application/octet-stream')
2829
})
@@ -34,6 +35,7 @@ describe('appDir', () => {
3435
headers: {
3536
RSC: '1',
3637
},
38+
followRedirect: false,
3739
}).then((response) => {
3840
expect(response.headers).to.have.property('content-type', 'application/octet-stream')
3941
})
@@ -45,29 +47,30 @@ describe('appDir', () => {
4547
headers: {
4648
RSC: '1',
4749
},
50+
followRedirect: false,
4851
}).then((response) => {
4952
expect(response.headers).to.have.property('content-type', 'application/octet-stream')
5053
})
5154
})
5255

5356
it('correctly redirects HTML requests for ISR pages', () => {
54-
cy.request('/blog/erica').then((response) => {
55-
expect(response.status).to.equal('308')
57+
cy.request({ url: '/blog/erica', followRedirect: false }).then((response) => {
58+
expect(response.status).to.equal(308)
5659
expect(response.headers).to.have.property('location', '/blog/erica/')
5760
})
5861
})
5962

6063
// This needs trailing slash handling to be fixed
6164
it.skip('correctly redirects HTML requests for static pages', () => {
62-
cy.request('/blog/erica/first-post').then((response) => {
63-
expect(response.status).to.equal('308')
65+
cy.request({ url: '/blog/erica/first-post', followRedirect: false }).then((response) => {
66+
expect(response.status).to.equal(308)
6467
expect(response.headers).to.have.property('location', '/blog/erica/first-post/')
6568
})
6669
})
6770

6871
it('correctly redirects HTML requests for dynamic pages', () => {
69-
cy.request('/blog/erica/random-post').then((response) => {
70-
expect(response.status).to.equal('308')
72+
cy.request({ url: '/blog/erica/random-post', followRedirect: false }).then((response) => {
73+
expect(response.status).to.equal(308)
7174
expect(response.headers).to.have.property('location', '/blog/erica/random-post/')
7275
})
7376
})

0 commit comments

Comments
 (0)