fix notifications test

This commit is contained in:
Nolan Lawson 2018-02-18 17:28:08 -08:00
parent 982d172e36
commit 014f23887f
7 changed files with 13 additions and 10 deletions

View File

@ -4,7 +4,8 @@ async function waitForMastodonToStart () {
while (true) {
try {
let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json())
if (json.uri) {
let html = await ((await fetch('http://127.0.0.1:3035/packs/common.js')).text())
if (json.uri && html) {
break
}
} catch (err) {

View File

@ -8,7 +8,7 @@ describe('Basic spec', () => {
})
it('navigates to about', () => {
cy.get('nav a').contains('Settings').click()
cy.get('nav a[aria-label=Settings]').click()
cy.url().should('contain', '/settings')
cy.get('a').contains('About').click()
cy.url().should('contain', '/settings/about')
@ -21,7 +21,7 @@ describe('Basic spec', () => {
})
it('navigates to settings/instances', () => {
cy.get('nav a').contains('Settings').click()
cy.get('nav a[aria-label=Settings]').click()
cy.url().should('contain', '/settings')
cy.get('a').contains('Instances').click()
cy.url().should('contain', '/settings/instances')

View File

@ -24,12 +24,12 @@ describe('Login spec', () => {
it('Logs out', () => {
cy.login('foobar@localhost:3000', 'foobarfoobar')
cy.get('nav a').contains('Settings').click()
cy.get('nav a[aria-label=Settings]').click()
cy.get('a').contains('Instances').click()
cy.get('a').contains('localhost:3000').click()
cy.url().should('contain', '/settings/instances/localhost:3000')
cy.get('button').contains('Log out').click()
cy.get('button').contains('OK').click()
cy.get('#modal-dialog button').contains('OK').click()
cy.url().should('contain', '/settings/instances')
cy.contains("You're not logged in to any instances")
})

View File

@ -44,7 +44,7 @@ describe('Basic timeline spec', () => {
})
it('Shows notifications', () => {
cy.get('nav a').contains('Notifications').click()
cy.get('nav a[aria-label=Notifications]').click()
cy.url().should('contain', '/notifications')
cy.validateTimeline(notifications)
@ -52,14 +52,14 @@ describe('Basic timeline spec', () => {
})
it('Shows the local timeline', () => {
cy.get('nav a').contains('Local').click()
cy.get('nav a[aria-label=Local]').click()
cy.url().should('contain', '/local')
cy.validateTimeline(localTimeline)
})
it('Shows the federated timeline', () => {
cy.get('nav a').contains('Community').click()
cy.get('nav a[aria-label=Community]').click()
cy.url().should('contain', '/community')
cy.get('a').contains('Federated').click()
cy.url().should('contain', '/federated')

View File

@ -64,5 +64,6 @@ Cypress.Commands.add('validateTimeline', (timeline) => {
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'followed you')
}
cy.getNthVirtualArticle(i).scrollIntoView()
cy.get('.loading-footer').should('not.exist')
})
})

View File

@ -8,13 +8,14 @@
"serve": "node server.js",
"build": "npm run globalize-css && npm run build-sass && npm run build-svg && sapper build && npm run deglobalize-css",
"start": "cross-env NODE_ENV=production node server.js",
"build-and-start": "run-s build start",
"build-svg": "node ./bin/build-svg.js",
"build-sass": "node ./bin/build-sass.js",
"build-sass-watch": "node ./bin/build-sass.js --watch",
"run-mastodon": "node ./bin/run-mastodon",
"cy:run": "cypress run",
"cy:open": "cypress open",
"test": "run-p --race run-mastodon dev test-mastodon",
"test": "run-p --race run-mastodon build-and-start test-mastodon",
"test-mastodon": "run-s wait-for-mastodon-to-start cy:run",
"wait-for-mastodon-to-start": "node bin/wait-for-mastodon-to-start.js",
"globalize-css": "node ./bin/globalize-css.js",

View File

@ -122,7 +122,7 @@
if (page === name) {
res += ' (current page)'
}
if (name === 'notifications') {
if (name === 'notifications' && $numberOfNotifications) {
res += ` (${$numberOfNotifications})`
}
return res