diff --git a/cypress/integration/01-basic-spec.js b/cypress/integration/01-basic-spec.js index 7efd9da..34c4791 100644 --- a/cypress/integration/01-basic-spec.js +++ b/cypress/integration/01-basic-spec.js @@ -1,4 +1,4 @@ -describe('Basic spec', () => { +describe('01-basic-spec.js', () => { beforeEach(() => { cy.visit('/') cy.wait(500) diff --git a/cypress/integration/02-login-spec.js b/cypress/integration/02-login-spec.js index b993cf7..45e76a5 100644 --- a/cypress/integration/02-login-spec.js +++ b/cypress/integration/02-login-spec.js @@ -1,4 +1,4 @@ -describe('Login spec', () => { +describe('02-login-spec.js', () => { beforeEach(() => { cy.visit('/') cy.wait(500) diff --git a/cypress/integration/03-basic-timeline-spec.js b/cypress/integration/03-basic-timeline-spec.js index 1c2fbb8..3e079f2 100644 --- a/cypress/integration/03-basic-timeline-spec.js +++ b/cypress/integration/03-basic-timeline-spec.js @@ -1,9 +1,8 @@ const times = require('lodash/times') -describe('Basic timeline spec', () => { +describe('03-basic-timeline-spec.js', () => { beforeEach(() => { cy.login('foobar@localhost:3000', 'foobarfoobar') - cy.visit('/') cy.wait(500) }) diff --git a/cypress/integration/04-pinned-statuses.js b/cypress/integration/04-pinned-statuses.js index fe75b89..6e5407b 100644 --- a/cypress/integration/04-pinned-statuses.js +++ b/cypress/integration/04-pinned-statuses.js @@ -1,7 +1,6 @@ -describe('Pinned statuses', () => { +describe('04-pinned-statuses.js', () => { beforeEach(() => { cy.login('foobar@localhost:3000', 'foobarfoobar') - cy.visit('/') cy.wait(500) }) diff --git a/cypress/integration/05-status-types.js b/cypress/integration/05-status-types.js new file mode 100644 index 0000000..7723732 --- /dev/null +++ b/cypress/integration/05-status-types.js @@ -0,0 +1,52 @@ +describe('05-status-types.js', () => { + beforeEach(() => { + cy.login('foobar@localhost:3000', 'foobarfoobar') + cy.wait(500) + }) + + it("shows direct vs followers-only vs regular", () => { + cy.getNthVirtualArticle(1).should('have.attr', 'aria-label', 'Status by admin') + cy.getNthVirtualArticle(1).find('.status-content').should('contain', 'notification of unlisted message') + cy.getNthVirtualArticle(1).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Boost') + .and('not.have.attr', 'disabled') + + cy.getNthVirtualArticle(2).should('have.attr', 'aria-label', 'Status by admin') + cy.getNthVirtualArticle(2).find('.status-content').should('contain', 'notification of followers-only message') + cy.getNthVirtualArticle(2).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Cannot be boosted because this is followers-only') + .and('have.attr', 'disabled') + + cy.getNthVirtualArticle(3).should('have.attr', 'aria-label', 'Direct message by admin') + cy.getNthVirtualArticle(3).find('.status-content').should('contain', 'notification of direct message') + cy.getNthVirtualArticle(3).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Cannot be boosted because this is a direct message') + .and('have.attr', 'disabled') + }) + + it("shows direct vs followers-only vs regular in notifications", () => { + cy.visit('/notifications') + cy.wait(500) + + cy.getNthVirtualArticle(2).should('have.attr', 'aria-label', 'Status by admin') + cy.getNthVirtualArticle(2).find('.status-content').should('contain', 'notification of unlisted message') + cy.getNthVirtualArticle(2).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Boost') + .and('not.have.attr', 'disabled') + + cy.getNthVirtualArticle(3).should('have.attr', 'aria-label', 'Status by admin') + cy.getNthVirtualArticle(3).find('.status-content').should('contain', 'notification of followers-only message') + cy.getNthVirtualArticle(3).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Cannot be boosted because this is followers-only') + .and('have.attr', 'disabled') + + cy.getNthVirtualArticle(4).should('have.attr', 'aria-label', 'Direct message by admin') + cy.getNthVirtualArticle(4).find('.status-content').should('contain', 'notification of direct message') + cy.getNthVirtualArticle(4).find('.status-toolbar button:nth-child(2)') + .should('have.attr', 'aria-label', 'Cannot be boosted because this is a direct message') + .and('have.attr', 'disabled') + + + }) + +}) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 7a7759a..ea8c67e 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -56,22 +56,22 @@ Cypress.Commands.add('getNthVirtualArticle', (n) => { Cypress.Commands.add('validateTimeline', (timeline) => { timeline.forEach((status, i) => { if (status.content) { - cy.getNthVirtualArticle(i).get('.status-content p').should('contain', status.content) + cy.getNthVirtualArticle(i).find('.status-content p').should('contain', status.content) } if (status.spoiler) { - cy.getNthVirtualArticle(i).get('.status-spoiler p').should('contain', status.spoiler) + cy.getNthVirtualArticle(i).find('.status-spoiler p').should('contain', status.spoiler) } if (status.followedBy) { - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.followedBy) - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'followed you') + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', status.followedBy) + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', 'followed you') } if (status.rebloggedBy) { - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.rebloggedBy) - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'boosted') + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', status.rebloggedBy) + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', 'boosted') } if (status.favoritedBy) { - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.favoritedBy) - cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'favorited') + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', status.favoritedBy) + cy.getNthVirtualArticle(i).find('.status-header span').should('contain', 'favorited') } cy.wait(50) cy.getNthVirtualArticle(i).scrollIntoView() diff --git a/routes/_components/IconButton.html b/routes/_components/IconButton.html index 3c08ce0..948a00e 100644 --- a/routes/_components/IconButton.html +++ b/routes/_components/IconButton.html @@ -3,6 +3,7 @@ aria-label="{{label}}" aria-pressed="{{!!pressed}}" class="icon-button {{pressed ? 'pressed' : ''}} {{big ? 'big-icon' : ''}}" + disabled="{{disabled}}" on:click > @@ -13,6 +14,7 @@