MaskingTechnology / comify

Comic based social network built with Jitar
GNU Affero General Public License v3.0
3 stars 1 forks source link

UI tests #260

Closed basmasking closed 3 months ago

basmasking commented 3 months ago

Currently we only have a singe test UI test. Now we know how to write them, we need to start adding them.

basmasking commented 3 months ago

The lessons I have learned so far for these tests is about the application context and how to provide the identity for the tests. The quick draft I made is found below.

const identity: CreatorView =
{
    id: '1',
    fullName: 'My identity',
    nickname: 'myidentity',
    joinedAt: '2021-01-01T00:00:00Z',
    postCount: 1,
    followerCount: 0,
    followingCount: 0
};

function setIdentity(identity?: CreatorView)
{
    return identity;
}

const context = { identity, setIdentity };

describe('Timeline feature', async () =>
{
    it('Should render the timeline for the user', async () =>
    {
        render(
            <AppContext.Provider value={context}>
                <MemoryRouter initialEntries={["/timeline"]}>
                    <Routes />
                </MemoryRouter>
            </AppContext.Provider>
        );
    });
});
basmasking commented 3 months ago

Today we had a discussion about the added value of the UI tests. And the discussion let to the provisional conclusion; there is no need for UI tests at this point.

We came to this conclusion based on the following arguments.

  1. Up to now, we do not have any UI test, and so far, nothing significant has been broken after merging any branch.
  2. The business logic we have is all captured in the domain layer, and the UI is merely the interface for the user to interact with our domain services. The domain itself is tested thoroughly, limiting the value of testing the same logic from the UI.
  3. The only logic in the UI that can be tested is clicking some buttons, scrolling and pulling the screen. This is not yet fully finalised and the implementation keeps changing a lot, making the tests a burden at this point in time.

We will look at the UI tests in a later stage of the project again to see if there is any benefit for them at that point. We will consider at least the 3 points above as input for the discussion. The most likely time to look at them is by the time that we are feature complete for our first MVP.

basmasking commented 3 months ago

The implementation we added for the Home screen (#217) will be removed from main in this story.