Skip to content

Commit

Permalink
fix(e2e): improve test stabily with the same sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Sep 6, 2023
1 parent 98ac25e commit 78ce8b0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
47 changes: 42 additions & 5 deletions javascript/apps/taiga-e2e/src/e2e/project/settings/members.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,57 @@ import {
} from '@test/support/helpers/settings.helpers';
import { createWorkspaceRequest } from '@test/support/helpers/workspace.helpers';

const workspace = WorkspaceMockFactory();
const projectMock = ProjectMockFactory();

describe('Settings > members', () => {
before(() => {
cy.login();
cy.visit('/');

void createWorkspaceRequest(workspace.name)
.then((responseCreateWorkspace) => {
return createFullProjectInWSRequest(
responseCreateWorkspace.body.id,
projectMock.name
);
})
.then((responseCreateProject) => {
projectMock.slug = responseCreateProject.body.slug;
projectMock.id = responseCreateProject.body.id;

const invitations = [
{ username: '2user', roleSlug: 'admin' },
{ username: '3user', roleSlug: 'admin' },
{ username: '4user', roleSlug: 'admin' },
{ username: '5user', roleSlug: 'general' },
{ username: '6user', roleSlug: 'general' },
{ username: '7user', roleSlug: 'general' },
];

invitations.forEach((invitation) => {
void inviteToProjectRequest(
responseCreateProject.body.id,
[invitation],
invitation.username
);
});
});
});

beforeEach(() => {
cy.login();
cy.visit('/');
cy.initAxe();
cy.getBySel('project-card').contains('Several Roles').click();

cy.visit(`/project/${projectMock.id}/${projectMock.slug}`);
cy.log(`/project/${projectMock.id}/${projectMock.slug}`);

navigateToSettings();
navigateToMembersSettings();
});

it('is a11y', () => {
cy.initAxe();
cy.tgCheckA11y();
});

Expand Down Expand Up @@ -112,16 +149,16 @@ describe('change role', () => {
.catch(console.error);
});

it.skip('change own admin role', () => {
it('change own admin role', () => {
cy.getBySel('project-card').contains('Several Roles').click();

navigateToSettings();
navigateToMembersSettings();
cy.tgCheckA11y();

cy.get('[data-test=1user]').should('be.visible');
cy.getBySel('1user').should('be.visible');
cy.getBySel('disabled-change-role').should('not.exist');
cy.get('[data-test=1user]').find('input').click();
cy.getBySel('1user').find('input').click();
cy.getBySel('permissions-warning').should('be.visible');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function getEmails(): Cypress.Chainable<
text: string;
html: string;
to: string;
subject: string;
}[];
}>
> {
Expand Down

0 comments on commit 78ce8b0

Please sign in to comment.