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

Event test #662

Merged
merged 1 commit into from
Oct 14, 2019
Merged
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
119 changes: 115 additions & 4 deletions cypress/integration/events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,119 @@
import { EventsPage } from '../page-objects/events-page'
describe('[Events]', () => {
const SKIP_TIMEOUT = { timeout: 300 }
const todaysDate = Cypress.moment().format('YYYY-MM-DD')
before(() => {
return cy.deleteDocuments(
'v2_events',
'title',
'==',
'Create an Event test',
)
})

context('events', () => {
it('should navigate without login', () => {
beforeEach(() => {
cy.visit('/events')
const eventsPage = new EventsPage()
cy.logout()
})

describe('[List events]', () => {
// const howtoUrl = '/how-to/make-glasslike-beams'
// const coverFileRegex = /howto-beams-glass-0-3.jpg/

it('[By Everyone]', () => {
cy.log('The Create button is unavailable')
cy.get('[data-cy=create]').should('not.exist')

cy.log('No tag is selected')
// - Create button is unavailable
// - No tag is selected
// - No location is inputted
// - More Events button is hidden
// - Some latest events are shown
// - The summary of an event is shown, including: date, title, organizer, location and tag
// - Click on the event's button
// - Check if it takes users to the event's page in a new tab"
})

it('[By Authenticated]', () => {
cy.login('howto_reader@test.com', 'test1234')
cy.log('Create button is available')
cy.get('[data-cy=create]')
.click()
.url()
.should('include', '/events/create')
})
})

describe('[Filter with Tag]', () => {
it('[By Everyone]', () => {
cy.log('Select a tag')
// - Select a tag on the dropdown list
// - Check if only relevant events are shown
// - Remove the selected tag
// - Expect all events are shown again"
})
})

describe('[Filter by Location]', () => {
it('[By Everyone]', () => {
cy.log('Select the Location')
// - Select the text box, Search for a Location
// - Type a location incompletely
// - Select the desired location from the suggestion list
// - Check if only relevant events are shown
// - Remove the location
// - Expet all events are shown again"
})
})

describe('[Create an event]', () => {
it('[By Anonymous]', () => {
cy.visit('/events/create')
.url()
.should('not.include', '/create')
})

it('[By Authenticated]', () => {
cy.visit('/events')
cy.login('howto_creator@test.com', 'test1234')
cy.get('[data-cy=create]').click()

cy.log('Fill up the intro')
cy.get('[data-cy=title]').type('Create an Event test')
cy.get('[data-cy=date]').type(todaysDate)
cy.get('[data-cy=location]').type('Rio de Janeiro, Brazil')
cy.get('.ap-name')
.contains('Rio')
.click()
cy.get('[data-cy=tag-select]').click()
cy.get('[data-cy=url]').type(
'https://www.meetup.com/pt-BR/cities/br/rio_de_janeiro/',
)
cy.get('Publish').click()
})
})

describe('[Edit an event]', () => {
it('[By Anonymous]', () => {
cy.visit('/events')
// ...
})

it('[By Authenticated]', () => {
cy.visit('/events')
// ...
})
})

describe('[Read an event]', () => {
it('[By Anonymous]', () => {
cy.visit('/events')
// ...
})

it('[By Authenticated]', () => {
cy.visit('/events')
// ...
})
})
})
1 change: 1 addition & 0 deletions src/components/LocationSearch/LocationSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class LocationSearch extends React.Component<IProps, IState> {
<>
{/* the first input uses our styled input component and has ref to subscribe to value changes */}
<Input
data-cy="location"
placeholder={this.props.placeholder}
style={styleVariant === 'filter' ? FilterStyle : SelectorStyle}
ref={this.userInputRef}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Events/Content/EventsCreate/EventsCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class EventsCreate extends React.Component<IProps, IState> {
<Field
id="title"
name="title"
data-cy="title"
validate={value => this.validateTitle(value)}
validateFields={[]}
component={InputField}
Expand All @@ -128,6 +129,7 @@ export class EventsCreate extends React.Component<IProps, IState> {
</Label>
<Field
name="date"
data-cy="date"
validateFields={[]}
validate={required}
component={InputField}
Expand Down Expand Up @@ -171,6 +173,7 @@ export class EventsCreate extends React.Component<IProps, IState> {
<Label htmlFor="location">Link to your event *</Label>
<Field
name="url"
data-cy="url"
validateFields={[]}
validate={value => this.validateUrl(value)}
component={InputField}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Events/Content/EventsList/EventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export class EventsList extends React.Component<any> {
<Flex>
<AuthWrapper>
<Link to={'/events/create'}>
<Button variant="primary">Create an event</Button>
<Button variant="primary" data-cy={'create'}>
Create an event
</Button>
</Link>
</AuthWrapper>
</Flex>
Expand Down