* create new pack, handle user follow buttons, use pack on article page, remove initializeUserFollowButts * init all follow button types, add pack to tag index and podcast episode pages * add pack to all relevant pages, listen for newly inserted follow buttons * change to searchParams to remove follow button initializer calls * fix bug with tag page, add pack to notifications page * fix issue with follow back inner text * update cypress specs * run the followbuttons code on sponsors page * remove extra foreach * add test for follow from article sidebar * add test for follow and unfollow tag * add test for the tag index page * add spec for organisation profile follow * add tests for follow buttons in search results * add tests for notification follows * commit missed file - woops * show login modal if user is logged out when they click * add cypress tests for logged out state * change tag button initialization * remove data-button-initialized * init follow buttons from base pack * handle the case where multiple follow buttons exist on a page for the same user * account for instantclick and userdata not being defined, lower coverage for jest * use getInstantClick * fix issue with set initialisation * only listen for mutations in areas we know follow buttons may be added dynamically * small refactors
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
describe('Follow author from article sidebar', () => {
|
|
beforeEach(() => {
|
|
cy.testSetup();
|
|
cy.viewport('macbook-16');
|
|
cy.fixture('users/articleEditorV1User.json').as('user');
|
|
|
|
cy.get('@user').then((user) => {
|
|
cy.loginAndVisit(user, '/').then(() => {
|
|
cy.findAllByRole('link', { name: 'Test article' })
|
|
.first()
|
|
.click({ force: true });
|
|
|
|
cy.get('[data-follow-clicks-initialized]');
|
|
cy.findByRole('heading', { name: 'Test article' });
|
|
});
|
|
});
|
|
});
|
|
|
|
it('Follows and unfollows an author from the sidebar', () => {
|
|
cy.intercept('/follows').as('followRequest');
|
|
|
|
cy.findByRole('complementary', { name: 'Author details' }).within(() => {
|
|
cy.findByRole('button', { name: 'Follow' }).as('followButton');
|
|
cy.get('@followButton').click();
|
|
|
|
cy.wait('@followRequest');
|
|
cy.get('@followButton').should('have.text', 'Following');
|
|
|
|
cy.get('@followButton').click();
|
|
cy.wait('@followRequest');
|
|
cy.get('@followButton').should('have.text', 'Follow');
|
|
});
|
|
});
|
|
});
|