fix notifications test
This commit is contained in:
parent
982d172e36
commit
014f23887f
|
@ -4,7 +4,8 @@ async function waitForMastodonToStart () {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json())
|
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
|
break
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Basic spec', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('navigates to about', () => {
|
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.url().should('contain', '/settings')
|
||||||
cy.get('a').contains('About').click()
|
cy.get('a').contains('About').click()
|
||||||
cy.url().should('contain', '/settings/about')
|
cy.url().should('contain', '/settings/about')
|
||||||
|
@ -21,7 +21,7 @@ describe('Basic spec', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('navigates to settings/instances', () => {
|
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.url().should('contain', '/settings')
|
||||||
cy.get('a').contains('Instances').click()
|
cy.get('a').contains('Instances').click()
|
||||||
cy.url().should('contain', '/settings/instances')
|
cy.url().should('contain', '/settings/instances')
|
||||||
|
|
|
@ -24,12 +24,12 @@ describe('Login spec', () => {
|
||||||
|
|
||||||
it('Logs out', () => {
|
it('Logs out', () => {
|
||||||
cy.login('foobar@localhost:3000', 'foobarfoobar')
|
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('Instances').click()
|
||||||
cy.get('a').contains('localhost:3000').click()
|
cy.get('a').contains('localhost:3000').click()
|
||||||
cy.url().should('contain', '/settings/instances/localhost:3000')
|
cy.url().should('contain', '/settings/instances/localhost:3000')
|
||||||
cy.get('button').contains('Log out').click()
|
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.url().should('contain', '/settings/instances')
|
||||||
cy.contains("You're not logged in to any instances")
|
cy.contains("You're not logged in to any instances")
|
||||||
})
|
})
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe('Basic timeline spec', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Shows notifications', () => {
|
it('Shows notifications', () => {
|
||||||
cy.get('nav a').contains('Notifications').click()
|
cy.get('nav a[aria-label=Notifications]').click()
|
||||||
cy.url().should('contain', '/notifications')
|
cy.url().should('contain', '/notifications')
|
||||||
|
|
||||||
cy.validateTimeline(notifications)
|
cy.validateTimeline(notifications)
|
||||||
|
@ -52,14 +52,14 @@ describe('Basic timeline spec', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Shows the local timeline', () => {
|
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.url().should('contain', '/local')
|
||||||
|
|
||||||
cy.validateTimeline(localTimeline)
|
cy.validateTimeline(localTimeline)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Shows the federated timeline', () => {
|
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.url().should('contain', '/community')
|
||||||
cy.get('a').contains('Federated').click()
|
cy.get('a').contains('Federated').click()
|
||||||
cy.url().should('contain', '/federated')
|
cy.url().should('contain', '/federated')
|
||||||
|
|
|
@ -64,5 +64,6 @@ Cypress.Commands.add('validateTimeline', (timeline) => {
|
||||||
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'followed you')
|
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'followed you')
|
||||||
}
|
}
|
||||||
cy.getNthVirtualArticle(i).scrollIntoView()
|
cy.getNthVirtualArticle(i).scrollIntoView()
|
||||||
|
cy.get('.loading-footer').should('not.exist')
|
||||||
})
|
})
|
||||||
})
|
})
|
|
@ -8,13 +8,14 @@
|
||||||
"serve": "node server.js",
|
"serve": "node server.js",
|
||||||
"build": "npm run globalize-css && npm run build-sass && npm run build-svg && sapper build && npm run deglobalize-css",
|
"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",
|
"start": "cross-env NODE_ENV=production node server.js",
|
||||||
|
"build-and-start": "run-s build start",
|
||||||
"build-svg": "node ./bin/build-svg.js",
|
"build-svg": "node ./bin/build-svg.js",
|
||||||
"build-sass": "node ./bin/build-sass.js",
|
"build-sass": "node ./bin/build-sass.js",
|
||||||
"build-sass-watch": "node ./bin/build-sass.js --watch",
|
"build-sass-watch": "node ./bin/build-sass.js --watch",
|
||||||
"run-mastodon": "node ./bin/run-mastodon",
|
"run-mastodon": "node ./bin/run-mastodon",
|
||||||
"cy:run": "cypress run",
|
"cy:run": "cypress run",
|
||||||
"cy:open": "cypress open",
|
"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",
|
"test-mastodon": "run-s wait-for-mastodon-to-start cy:run",
|
||||||
"wait-for-mastodon-to-start": "node bin/wait-for-mastodon-to-start.js",
|
"wait-for-mastodon-to-start": "node bin/wait-for-mastodon-to-start.js",
|
||||||
"globalize-css": "node ./bin/globalize-css.js",
|
"globalize-css": "node ./bin/globalize-css.js",
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
if (page === name) {
|
if (page === name) {
|
||||||
res += ' (current page)'
|
res += ' (current page)'
|
||||||
}
|
}
|
||||||
if (name === 'notifications') {
|
if (name === 'notifications' && $numberOfNotifications) {
|
||||||
res += ` (${$numberOfNotifications})`
|
res += ` (${$numberOfNotifications})`
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in a new issue