-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test skeletons and fix not being able to amend dates properly. Unforuntately due to a limitation / bug in the datepicker being used it was not possible to start with the existing dates the user had selected previously. Instead the user has to pick their date afresh each time.
- Loading branch information
1 parent
6cefbd3
commit 1650f02
Showing
8 changed files
with
125 additions
and
83 deletions.
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
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 |
---|---|---|
@@ -1,24 +1,87 @@ | ||
it('should work', () => { | ||
cy.visit('/') | ||
cy.get('#name').should('be.focused').type('Dan') | ||
cy.contains('button', 'NEXT').click() | ||
before(() => { | ||
cy.clock() | ||
}) | ||
|
||
describe('when an organiser wants to schedule a social', () => { | ||
it('they can do so', () => { | ||
cy.visit('/') | ||
cy.get('#name').should('be.focused').type('Dan') | ||
cy.contains('button', 'NEXT').click() | ||
|
||
cy.url().should('include', '/you') | ||
cy.get('.calendar-date').last().click() | ||
cy.contains('button', 'NEXT').click() | ||
|
||
cy.url().should('include', '/everyone') | ||
cy.get('.invitee').should('contain.text', 'Dan') | ||
cy.get('.streaming-status').should('contain.text', 'Live-streaming updates') | ||
|
||
cy.task('updateSocial', '1970-01-02') | ||
cy.reload() // This shouldn't be necessary but HTTP2 isn't supported by Cypress so streaming doesn't work | ||
cy.get('.invitee').should('contain.text', 'Max') | ||
|
||
cy.wait(1000) // Fix weird re-render that changes date format and resets checked state | ||
cy.get('#best-dates [type="radio"]').first().check() | ||
cy.contains('button', 'NEXT').click() | ||
|
||
cy.url().should('include', '/decision') | ||
cy.contains('Your social is on') | ||
}) | ||
}) | ||
|
||
cy.url().should('include', '/you') | ||
cy.get('.calendar-date').last().click() | ||
cy.contains('button', 'NEXT').click() | ||
describe('when an invitee has chosen their availability', () => { | ||
beforeEach(() => { | ||
cy.task('createSocial', { | ||
invitees: { | ||
organiserID: { | ||
dates: ['1970-01-02', '1970-01-03', '1970-01-04'], | ||
name: 'Olaf', | ||
}, | ||
inviteeID: { | ||
dates: ['1970-01-02', '1970-01-03'], | ||
name: 'Ingrid', | ||
}, | ||
}, | ||
organizer: 'organiserID', | ||
}).as('social') | ||
cy.setCookie('userId', 'inviteeID') | ||
}) | ||
|
||
cy.url().should('include', '/everyone') | ||
cy.get('.invitee').should('contain.text', 'Dan') | ||
cy.get('.streaming-status').should('contain.text', 'Live-streaming updates') | ||
it('they can go back and amend it', function () { | ||
cy.visit(`/${this.social.id}/everyone`) | ||
cy.contains('BACK').click() | ||
|
||
cy.task('updateSocial', '2025-01-01') | ||
cy.reload() // This shouldn't be necessary but HTTP2 isn't supported by Cypress so streaming doesn't work | ||
cy.get('.invitee').should('contain.text', 'Max') | ||
// Force a wait for the page to re-render, think this may be caused by the SvelteKit server does intiial render in current time. | ||
cy.contains('January 1970').should('exist') | ||
cy.contains('.calendar-date', /^3$/).click() | ||
cy.contains('.calendar-date', /^4$/).click() | ||
|
||
cy.wait(1000) // Fix weird re-render that changes date format and resets checked state | ||
cy.get('#best-dates [type="radio"]').first().check() | ||
cy.contains('button', 'NEXT').click() | ||
cy.contains('NEXT').click() | ||
cy.get('#best-dates') | ||
.table() | ||
.should('deep.equal', [ | ||
['', 'Rank', 'Date', 'Available Invitees', 'Invitees Total'], | ||
['', '1', 'Saturday, 3 January', '🤴🧙♂️', '2/2'], | ||
['', '2', 'Sunday, 4 January', '🤴🧙♂️', '2/2'], | ||
['', '3', 'Friday, 2 January', '🤴', '1/2'], | ||
]) | ||
}) | ||
}) | ||
|
||
describe('when a decision has been made', () => { | ||
it.skip('anyone can go back and amend it', () => {}) | ||
|
||
it.skip("redirects invitees who haven't seen it yet", () => {}) | ||
}) | ||
|
||
describe('when an invitee joins the social', () => { | ||
// Can't test this until Cypress supports HTTP/2. | ||
it.skip('updates the everyone page in real time', () => {}) | ||
|
||
// Not sure how to test this yet. | ||
it.skip('send push notifications to invitees who have enabled them', () => {}) | ||
}) | ||
|
||
cy.url().should('include', '/decision') | ||
cy.contains('Your social is on') | ||
describe('when an invitee from another timezone joins the social', () => { | ||
it.skip('shows them the same dates as others disregarding timezones entirely', () => {}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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