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

Cypress test fixes #727

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion cypress/e2e/dashboard/phrases.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe(

cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.get('[data-testid="DashboardPresentationEdit"]').click()
cy.get('[data-testid="dashboard-edit-link"]').click()
cy.contains('Edit phrases').click()
cy.contains('Loading').should('be.visible')
cy.contains('Loading').should('not.exist')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/dashboard/reports.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe(
cy.contains('Explore Languages').click()
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.get('[data-testid="DashboardPresentationReports"]').click()
cy.get('[data-testid="dashboard-reports-link"]').click()
})

it('check page loaded', () => {
Expand Down
43 changes: 23 additions & 20 deletions cypress/e2e/dashboard/speaker.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,48 @@ describe(
})
cy.contains('Explore Languages').click()
})

const testSpeakerName = Date.now().toString()
it('Create Speaker', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.contains('Create').click()
cy.contains('Add a speaker').click()
cy.get('[data-testid="user-menu-btn"]').click()
cy.get('[data-testid="user-dashboard-link"]').click()
cy.get('[data-testid="dashboard-create-link"]').click()
cy.get('[data-testid="create-speaker-link"]').click()

cy.contains('Add Speaker').click()
cy.get('[data-testid="form-submit"]').click()
cy.contains('name must be at least 1 characters').should('be.visible')
cy.contains('A bio is required').should('be.visible')

cy.get('#name').type('qatestspeaker')
cy.get('#name').type(testSpeakerName)
cy.get('#bio').type('qabio test - new speaker')
cy.contains('Add Speaker').click()
cy.contains('Dismiss').should('be.visible')
cy.get('[data-testid="form-submit"]').click()
cy.get('[data-testid="success-close-btn"]').should('exist')
})

it('Edit Speaker', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.contains('Edit').click()
cy.contains('Edit speakers').click()
cy.get('[data-testid="edit-speaker-qatestspeaker"]').click()
cy.get('[data-testid="user-menu-btn"]').click()
cy.get('[data-testid="user-dashboard-link"]').click()
cy.get('[data-testid="dashboard-edit-link"]').click()
cy.get('[data-testid="edit-speakers-link"]').click()
cy.get(`[data-testid="edit-speaker-${testSpeakerName}"]`).click()
cy.get('#bio').type('this is the new value')
cy.contains('Save Changes').click()
cy.get('[data-testid="form-submit"]').click()
cy.get('[data-testid="success-close-btn"]').should('exist')
})

it('Delete Speaker', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.contains('Edit').click()
cy.contains('Edit speakers').click()
cy.get('[data-testid="edit-speaker-qatestspeaker"]').click()
cy.get('[data-testid="user-menu-btn"]').click()
cy.get('[data-testid="user-dashboard-link"]').click()
cy.get('[data-testid="dashboard-edit-link"]').click()
cy.get('[data-testid="edit-speakers-link"]').click()
cy.get(`[data-testid="edit-speaker-${testSpeakerName}"]`).click()
cy.get('#bio')
.invoke('val')
.then((sometext) => sometext === 'this is the new value')
cy.contains('Delete Speaker').click()
cy.get('[data-testid="delete-btn"]').click()
cy.get('[data-testid="DeleteModal"]').contains('Delete').click()
})
},
Expand Down
56 changes: 36 additions & 20 deletions cypress/e2e/songs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,46 @@ describe(

it('10.3 - Click on songs grid view', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains('Learn').click()
cy.contains('Songs').click()
cy.get('ul li').each((_song) => {
cy.wrap(_song).click()
cy.contains('Loading').should('not.exist')

cy.contains('Go to Song', { timeout: 12000 })
cy.get('#CloseDrawerBtn').click()
})
cy.contains('p', 'Learn').should('be.visible')
cy.get('[data-testid="navigation-learn-btn"]').click()
cy.get('[data-testid="navigation-songs-link"]').click()
cy.location('pathname').should(
'match',
`/${Cypress.env('DIALECT')}/songs`,
)
cy.get('[data-testid="song-story-grid-tile"]', { timeout: 10000 }).each(
(_song) => {
cy.wrap(_song).scrollIntoView()
cy.wrap(_song).click()
cy.contains('Loading').should('not.exist')
cy.get('[data-testid="song-link"]').scrollIntoView()
cy.get('[data-testid="song-link"]').should('be.visible')
cy.get('#CloseDrawerBtn').click()
cy.get('[data-testid="song-link"]').should('not.exist')
},
)
})

it('10.4 - Check list view songs', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains('Learn').click()
cy.contains('Songs').click()
cy.contains('Use list view').click()
cy.get('.pb-16 > .w-full >').each((_song) => {
cy.wrap(_song).scrollIntoView()
cy.wrap(_song).should('be.enabled')
cy.wrap(_song).click()
cy.contains('Go to Song').scrollIntoView()
cy.contains('Go to Song')
cy.get('#CloseDrawerBtn').click()
})
cy.contains('p', 'Learn').should('be.visible')
cy.get('[data-testid="navigation-learn-btn"]').click()
cy.get('[data-testid="navigation-songs-link"]').click()
cy.location('pathname').should(
'match',
`/${Cypress.env('DIALECT')}/songs`,
)
cy.get('[data-testid="grid-off-btn"]').click()
cy.get('[data-testid="song-story-list-row"]', { timeout: 10000 }).each(
(_song) => {
cy.wrap(_song).scrollIntoView()
cy.wrap(_song).should('be.enabled')
cy.wrap(_song).click()
cy.get('[data-testid="song-link"]').scrollIntoView()
cy.get('[data-testid="song-link"]').should('be.visible')
cy.get('#CloseDrawerBtn').click()
},
)
})
},
) // end of describe
50 changes: 31 additions & 19 deletions cypress/e2e/stories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,41 @@ describe(

it('10.1 - Click on stories grid view', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains('Learn').click()
cy.contains('Stories').click()
cy.get('ul li', { timeout: 10000 }).each((_song) => {
cy.wrap(_song).click()
cy.contains('Go to Story', { timeout: 12000 })
cy.get('#CloseDrawerBtn').click()
cy.contains('Go to Story').should('not.exist')
})
cy.contains('p', 'Learn').should('be.visible')
cy.get('[data-testid="navigation-learn-btn"]').click()
cy.get('[data-testid="navigation-stories-link"]').click()
cy.location('pathname').should('eq', `/${Cypress.env('DIALECT')}/stories`)
cy.get('[data-testid="song-story-grid-tile"]', { timeout: 10000 }).each(
(_story) => {
cy.wrap(_story).scrollIntoView()
cy.wrap(_story).click()

cy.get('[data-testid="story-link"]').scrollIntoView()
cy.get('[data-testid="story-link"]').should('be.visible')
cy.get('#CloseDrawerBtn').click()
cy.get('[data-testid="story-link"]').should('not.exist')
},
)
})

it('10.2 - Check list view stories', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains('Learn').click()
cy.contains('Stories').click()
cy.contains('Use list view').click()
cy.get('.pb-16 > .w-full >', { timeout: 10000 }).each((_song) => {
cy.wrap(_song).should('be.enabled')
cy.wrap(_song).click()
cy.contains('Loading').should('not.exist')
cy.contains('Go to Story').scrollIntoView()
cy.contains('Go to Story').should('be.visible')
cy.get('#CloseDrawerBtn').click()
})
cy.contains('p', 'Learn').should('be.visible')
cy.get('[data-testid="navigation-learn-btn"]').click()
cy.get('[data-testid="navigation-stories-link"]').click()
cy.location('pathname').should('eq', `/${Cypress.env('DIALECT')}/stories`)
cy.get('[data-testid="grid-off-btn"]').click()
cy.get('[data-testid="song-story-list-row"]', { timeout: 10000 }).each(
(_story) => {
cy.wrap(_story).scrollIntoView()
cy.wrap(_story).should('be.enabled')
cy.wrap(_story).click()

cy.get('[data-testid="story-link"]').scrollIntoView()
cy.get('[data-testid="story-link"]').should('be.visible')
cy.get('#CloseDrawerBtn').click()
},
)
})
},
) // end of describe
9 changes: 8 additions & 1 deletion src/components/Dashboard/DashboardPresentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,35 @@ function DashboardPresentation({ children, currentUser, site, logout }) {
const primaryNavigationItems = (currentSitename) => {
const navigation = [
{
testid: 'dashboard-home-link',
name: 'Dashboard',
href: `/${currentSitename}/dashboard`,
icon: 'Dashboard',
auth: MEMBER,
},
{
testid: 'dashboard-create-link',
name: 'Create',
href: `/${currentSitename}/dashboard/create`,
icon: 'Create',
auth: ASSISTANT,
},
{
testid: 'dashboard-edit-link',
name: 'Edit',
href: `/${currentSitename}/dashboard/edit`,
icon: 'Pencil',
auth: ASSISTANT,
},
{
testid: 'dashboard-media-link',
name: 'Media',
href: `/${currentSitename}/dashboard/media`,
icon: 'Microphone',
auth: ASSISTANT,
},
{
testid: 'dashboard-reports-link',
name: 'Reports',
href: `/${currentSitename}/dashboard/reports`,
icon: 'Reports',
Expand All @@ -104,7 +109,7 @@ const primaryNavigationItems = (currentSitename) => {
return (
<RequireAuth key={item.name} siteMembership={item.auth}>
<Link
data-testid={`DashboardPresentation${item.name}`}
data-testid={item.testid}
to={item.href}
className={`group flex items-center p-2 text-sm font-medium rounded-lg ${
match
Expand All @@ -130,6 +135,7 @@ const secondaryNavigationItems = (sites) => {
if (sites?.length > 0) {
sites.forEach((site) =>
secondaryNavigation.push({
testid: `${site?.sitename}-link`,
name: `${site?.title} site`,
href: `/${site?.sitename}`,
icon: 'BackArrow',
Expand All @@ -154,6 +160,7 @@ const secondaryNavigationItems = (sites) => {
{secondaryNavigation.map((item) => (
<Link
key={item.name}
data-testid={item.testid}
to={item.href}
className="group flex items-center p-2 text-sm font-medium rounded-lg text-charcoal-200 hover:bg-charcoal-500 hover:text-white"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function DashboardCategoriesData() {

const tileContent = [
{
testid: 'create-category-link',
icon: 'Create',
name: 'Add a Category',
description: 'Add a new category to your dictionary',
Expand Down
9 changes: 9 additions & 0 deletions src/components/DashboardCreate/DashboardCreateData.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function DashboardCreateData({ urlPrefix = '' }) {

const createTiles = {
WORD: {
testid: 'create-word-link',
icon: 'Word',
name: 'Create a word',
description: 'Add a new word to your dictionary',
Expand All @@ -23,6 +24,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: ASSISTANT,
},
PHRASE: {
testid: 'create-phrase-link',
icon: 'Phrase',
name: 'Create a phrase',
description: 'Add a new phrase to your dictionary',
Expand All @@ -31,6 +33,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: ASSISTANT,
},
SONG: {
testid: 'create-song-link',
icon: 'Song',
name: 'Create a song',
description: 'Add a new song to your site',
Expand All @@ -39,6 +42,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: ASSISTANT,
},
STORY: {
testid: 'create-story-link',
icon: 'Story',
name: 'Create a story',
description: 'Add a new story to your site',
Expand All @@ -47,6 +51,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: ASSISTANT,
},
SPEAKER: {
testid: 'create-speaker-link',
icon: 'Speak',
name: 'Add a speaker',
description: 'Add a new speaker to your site',
Expand All @@ -55,6 +60,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: EDITOR,
},
CATEGORY: {
testid: 'create-category-link',
icon: 'Category',
name: 'Add a category',
description: 'Add a new category to your dictionary',
Expand All @@ -63,6 +69,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: LANGUAGE_ADMIN,
},
WIDGET: {
testid: 'create-widget-link',
icon: 'Widget',
name: 'Create a widget',
description: "Add a new widget to your site's collection",
Expand All @@ -71,6 +78,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: LANGUAGE_ADMIN,
},
PAGE: {
testid: 'create-page-link',
icon: 'WebPages',
name: 'Create a custom page',
description: 'Add a new page to your site',
Expand All @@ -79,6 +87,7 @@ function DashboardCreateData({ urlPrefix = '' }) {
auth: LANGUAGE_ADMIN,
},
GALLERY: {
testid: 'create-gallery-link',
icon: 'Images',
name: 'Create a gallery',
description: 'Add a new image gallery to your site',
Expand Down
Loading
Loading