-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
1,147 additions
and
290 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
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 |
---|---|---|
|
@@ -51,5 +51,6 @@ yarn-error.log* | |
# Sentry | ||
.sentryclirc | ||
|
||
# Sentry | ||
.sentryclirc | ||
# Cypress | ||
cypress/videos | ||
cypress/screenshots |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
video: false, | ||
e2e: { | ||
baseUrl: 'http://localhost:3000' | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
'cypress/globals': true | ||
}, | ||
plugins: ['cypress'], | ||
extends: ['../.eslintrc.js', 'plugin:cypress/recommended'] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference types="cypress" /> | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
|
||
getBySel( | ||
dataTestAttribute: string, | ||
args?: any | ||
): Chainable<JQuery<HTMLElement>> | ||
getBySelLike( | ||
dataTestPrefixAttribute: string, | ||
args?: any | ||
): Chainable<JQuery<HTMLElement>> | ||
waitShellVisible(): Chainable<JQuery<HTMLElement>> | ||
} | ||
} | ||
} | ||
|
||
export {} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe('App home', () => { | ||
beforeEach(() => { | ||
cy.visit('/app') | ||
cy.waitShellVisible() | ||
}) | ||
|
||
it('shows main navigation buttons', () => { | ||
cy.getBySel('local-radio').should('be.visible') | ||
cy.getBySel('by-genre').should('be.visible') | ||
cy.getBySel('by-location').should('be.visible') | ||
cy.getBySel('by-language').should('be.visible') | ||
cy.getBySel('custom-search').should('be.visible') | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
describe('Geolocation error', () => { | ||
beforeEach(() => { | ||
cy.visit('/app') | ||
cy.waitShellVisible() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.intercept('api/geolocation', { | ||
statusCode: 303, | ||
body: { error: 'Service unavailable' }, | ||
delay: 500 | ||
}).as('geolocation') | ||
}) | ||
|
||
it('shows progress modal', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.get('@modal') | ||
.should('be.visible') | ||
.should('contain.text', 'Determining your location') | ||
|
||
cy.get('[role=progressbar]').as('progressbar') | ||
|
||
cy.get('@progressbar').should('be.visible') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@progressbar').should('not.exist') | ||
}) | ||
|
||
it('shows failed modal', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal').contains(/Sorry, couldn't get your location/i) | ||
|
||
cy.get('@modal').find('button').contains(/close/i).as('close_btn') | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/choose the location/i) | ||
.as('choose_btn') | ||
|
||
cy.get('@close_btn').should('be.visible') | ||
cy.get('@choose_btn').should('be.visible') | ||
}) | ||
|
||
it('removes failed modal', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal').find('button').contains(/close/i).as('close_btn') | ||
|
||
cy.get('@close_btn').click() | ||
|
||
cy.get('@modal').should('not.exist') | ||
}) | ||
|
||
it('goes to manual location', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/choose the location/i) | ||
.click() | ||
|
||
cy.location('pathname').should('match', /\/app\/by-location$/) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
const countryCode = { | ||
code: 'RS', | ||
cont: 'EU', | ||
flag: '🇷🇸', | ||
name: 'Serbia' | ||
} | ||
describe('Geolocation success', () => { | ||
beforeEach(() => { | ||
cy.visit('/app') | ||
cy.waitShellVisible() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.intercept('api/geolocation', { | ||
statusCode: 200, | ||
body: countryCode, | ||
delay: 500 | ||
}).as('geolocation') | ||
}) | ||
|
||
it('shows progress modal', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.get('@modal') | ||
.should('be.visible') | ||
.should('contain.text', 'Determining your location') | ||
|
||
cy.get('[role=progressbar]').as('progressbar') | ||
|
||
cy.get('@progressbar').should('be.visible') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@progressbar').should('not.exist') | ||
}) | ||
|
||
it('shows success modal', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal').contains(/Your location is/i) | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/different location/i) | ||
.should('be.visible') | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/let's go/i) | ||
.should('be.visible') | ||
|
||
cy.get('@modal').contains(countryCode.flag).should('be.visible') | ||
cy.get('@modal').contains(countryCode.name).should('be.visible') | ||
}) | ||
|
||
it('goes to manual location', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/choose different location/i) | ||
.click() | ||
|
||
cy.location('pathname').should('match', /\/app\/by-location$/) | ||
}) | ||
|
||
it('goes to found country ip', () => { | ||
cy.getBySel('local-radio').click() | ||
|
||
cy.getBySel('location-modal').as('modal') | ||
|
||
cy.wait('@geolocation') | ||
|
||
cy.get('@modal') | ||
.find('button') | ||
.contains(/let's go/i) | ||
.click() | ||
|
||
// example: https://live-radio.vercel.app/app/by-location/EU/RS | ||
const location = new RegExp( | ||
`/app/by-location/${countryCode.cont}/${countryCode.code}$` | ||
) | ||
|
||
cy.location('pathname', { timeout: 20000 }).should('match', location) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
describe('Landing page', () => { | ||
it('shows login buttons', () => { | ||
cy.visit('/') | ||
|
||
cy.getBySel('login').contains(/sign in or register/i) | ||
|
||
cy.getBySel('anonymous') | ||
.contains(/anonymous user/i) | ||
.click() | ||
|
||
cy.location('pathname').should('match', /\/app$/) | ||
}) | ||
}) |
Oops, something went wrong.
65d695e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
next-radio – ./
live-radio.vercel.app
next-radio-git-master-ivandotv.vercel.app
next-radio-ivandotv.vercel.app