Skip to content

Commit

Permalink
FW-5734-fixes existing tests to latest code (#631)
Browse files Browse the repository at this point in the history
* fixes existing tests to latest code

* fixing category and speaker tests
  • Loading branch information
chrisfpcc authored Oct 10, 2024
1 parent ee2db4f commit 0fa75a9
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 41 deletions.
3 changes: 1 addition & 2 deletions cypress/e2e/dashboard/category.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ describe(
cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down Expand Up @@ -47,6 +45,7 @@ describe(
cy.get('#title').type('qatestcategory')
cy.get('#description').type('qabio test - new speaker')
cy.contains('Create category').click()
cy.contains('Dismiss').should('be.visible')
})

it('Delete Category', () => {
Expand Down
6 changes: 1 addition & 5 deletions cypress/e2e/dashboard/galleries.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ describe(
cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down Expand Up @@ -45,9 +43,7 @@ describe(
cy.get('#titleTranslation').type('qatestgallery')

cy.contains('Add image').click()
cy.get('ul > li').each((_li) => {
cy.wrap(_li).click()
})
cy.get('[data-testid="media-select-btn"]').first().click()
cy.contains('Insert').click()
cy.contains('Create gallery').click()
cy.contains('Sign Out').click()
Expand Down
8 changes: 6 additions & 2 deletions cypress/e2e/dashboard/media.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe(
'https://fpcc-dev.auth.ca-central-1.amazoncognito.com',
() => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down Expand Up @@ -48,6 +46,12 @@ describe(
cy.contains('Media').click()
cy.contains('Audio').click()
cy.contains('Download')
cy.get('td audio:first')
.invoke('attr', 'src')
.then((audiofile) => {
const audio = new Audio(audiofile)
audio.play()
})
cy.go(-1)
cy.contains('Manage your images').parent().click()
cy.contains('Download')
Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/dashboard/pages.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ describe(
},
() => {
beforeEach(() => {
cy.on('uncaught:exception', () => false)
cy.viewport(1024, 768)
})

Expand All @@ -21,8 +20,6 @@ describe(
cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down Expand Up @@ -50,8 +47,6 @@ describe(
cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down
4 changes: 0 additions & 4 deletions cypress/e2e/dashboard/phrases.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ describe(
cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
// lets try an incorrect password
cy.get('#signInFormPassword').type(`${password}{enter}`, {
Expand Down Expand Up @@ -56,8 +54,6 @@ describe(
cy.contains('Finish').click()
cy.get('#title').type(name2)
cy.middlestuff('Add phrase translation')
cy.get('div[id="NavUser"] button').click()
cy.contains('Sign out').click()
})

it('8.1a - delete phrase', () => {
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/dashboard/reports.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe(
},
() => {
beforeEach(() => {
cy.on('uncaught:exception', () => false)
Cypress.Commands.add('checkHeaderCSS', (fontWeightStrength) => {
if (fontWeightStrength[0] === 'Build your own') {
cy.get('[data-testid="sortby-title-btn"] > span').should(
Expand Down
3 changes: 0 additions & 3 deletions cypress/e2e/dashboard/songs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ describe(
},
() => {
beforeEach(() => {
cy.on('uncaught:exception', () => false)
cy.viewport(1920, 1080)
cy.visit(`${Cypress.env('baseUrl')}`)

cy.contains('Sign in').click()
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.on('uncaught:exception', () => false)

cy.get('#signInFormUsername').type(email, { force: true })
cy.get('#signInFormPassword').type(`${password}{enter}`, {
force: true,
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/dashboard/speaker.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe(
cy.get('#name').type('qatestspeaker')
cy.get('#bio').type('qabio test - new speaker')
cy.contains('Add Speaker').click()
cy.contains('Dismiss').should('be.visible')
})

it('Delete Speaker', () => {
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/dashboard/stories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ describe(

cy.contains('Next step').click()

for (let i = 0; i < 3; i += 1) {
for (let i = 0; i < 1; i += 1) {
cy.contains('Add page').click()
cy.contains('Save').should('be.visible')
cy.get('.grid > :nth-child(2) > .bg-white > .w-full').type(
'asdfasdfafs',
)
cy.get(':nth-child(3) > .bg-white > .w-full').type('asdfasdfaf')
cy.get('div.public-DraftStyleDefault-block').eq(0).type('asdfasdfafs')
cy.get('div.public-DraftStyleDefault-block').eq(1).type('asdfasdfaf')
cy.contains('Save').click()
}
cy.contains('Next step').click()
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/dashboard/wordup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe(
cy.contains('Finish').click()
cy.contains('Dismiss').should('not.exist')
})
cy.on('uncaught:exception', () => false)
cy.viewport(1024, 768)
cy.visit(`${Cypress.env('baseUrl')}`)
cy.contains('Sign in').click()
Expand Down Expand Up @@ -71,13 +70,11 @@ describe(
cy.contains('Finish').click()
cy.get('#title').type(name)
cy.middlestuff('Add word translation')
cy.get('div[id="NavUser"] button').click()
cy.contains('Sign out').click()
})

it('7.1a - delete word', () => {
cy.contains('Explore Languages').click()
cy.get('div[id="NavUser"] button').click()
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.contains('Edit words and phrases').click()
cy.get('[data-testid="SearchInput"]').type(`${name}{enter}`)
Expand Down
30 changes: 21 additions & 9 deletions cypress/e2e/login/immersion.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,50 @@ describe(
},
() => {
beforeEach(() => {
cy.on('uncaught:exception', () => false)
cy.viewport(1024, 768)
cy.visit(`${Cypress.env('baseUrl')}/nuxeo/login.jsp`)
cy.viewport(1920, 1080)
cy.visit(`${Cypress.env('baseUrl')}`)
cy.contains('Sign in').click()

cy.login(
Cypress.env('CYPRESS_FV_USERNAME'),
Cypress.env('CYPRESS_FV_PASSWORD'),
)
cy.origin(`${Cypress.env('CYPRESS_ORIGIN')}`, () => {
Cypress.Commands.add('login', (email, password) => {
cy.get('#signInFormUsername').type(email, { force: true })
cy.get('#signInFormPassword').type(`${password}{enter}`, {
force: true,
})
})

cy.visit(`${Cypress.env('baseUrl')}/${Cypress.env('DIALECT')}`)
cy.login(
Cypress.env('CYPRESS_FV_USERNAME'),
Cypress.env('CYPRESS_FV_PASSWORD'),
)
cy.url().should('contain', '')
})
})

it('Check button exists', () => {
cy.visit(`${Cypress.env('baseUrl')}`)
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Immersion Mode').should('exist')
})

it('enable it, check, then disable it', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()

cy.contains('Immersion Mode').click()
cy.contains('Dictionary').click()
cy.contains('qwel̓qwal̓éit').should('exist')

cy.contains('cn').click()
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()

cy.contains('Immersion Mode').click()
cy.contains('Dictionary').click()
cy.contains('qwel̓qwal̓éit').should('not.exist')
})

it('check dashboard', () => {
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains(`${Cypress.env('CYPRESS_FV_INITIALS')}`).click()
cy.contains('Dashboard').click()
cy.get('[href="/lilwat/dashboard/edit"]').click()
Expand Down
21 changes: 20 additions & 1 deletion cypress/e2e/search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ describe(
cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`)
cy.contains('Learn').click()
cy.contains('Songs').click()
cy.get('.bg-center > .group-hover:opacity-75 > .text-lg')
cy.get('div.text-lg')
.eq(0)
.invoke('text')
.then((_text) => {
cy.log(_text)
Expand All @@ -36,5 +37,23 @@ describe(
cy.get('[data-testid="SearchInput"]').type(`${_text}{enter}`)
})
})

it('global search from homepage', () => {
cy.visit(`${Cypress.env('baseUrl')}`)
cy.contains('SEARCH FIRSTVOICES').click()
cy.get(`table`).find('tr').should('have.length.greaterThan', 1)

cy.get('[data-testid="word-filter-btn"]').click()
cy.get(`table`).find('tr').should('have.length.greaterThan', 1)

cy.get('[data-testid="phrase-filter-btn"]').click()
cy.get(`table`).find('tr').should('have.length.greaterThan', 1)

cy.get('[data-testid="song-filter-btn"]').click()
cy.get(`table`).find('tr').should('have.length.greaterThan', 1)

cy.get('[data-testid="story-filter-btn"]').click()
cy.get(`table`).find('tr').should('have.length.greaterThan', 1)
})
},
) // end of describe

0 comments on commit 0fa75a9

Please sign in to comment.