mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
refactor(test): fix integration test
This commit is contained in:
parent
d582fdf284
commit
d97b86175d
2 changed files with 32 additions and 47 deletions
|
@ -81,7 +81,7 @@ describe('M2M RBAC', () => {
|
|||
text: `The API resource ${apiResourceName} has been successfully created`,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div[class$=name]', {
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div', {
|
||||
text: apiResourceName,
|
||||
});
|
||||
});
|
||||
|
@ -108,7 +108,7 @@ describe('M2M RBAC', () => {
|
|||
text: `The permission ${permissionName} has been successfully created`,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('table tbody tr td div[class$=name]', {
|
||||
await expect(page).toMatchElement('table tbody tr td div', {
|
||||
text: permissionName,
|
||||
});
|
||||
});
|
||||
|
@ -164,10 +164,9 @@ describe('M2M RBAC', () => {
|
|||
text: 'Permissions',
|
||||
});
|
||||
|
||||
const permissionRow = await expect(page).toMatchElement(
|
||||
'table tbody tr:has(td div[class$=name])',
|
||||
{ text: permissionName }
|
||||
);
|
||||
const permissionRow = await expect(page).toMatchElement('table tbody tr:has(td div)', {
|
||||
text: permissionName,
|
||||
});
|
||||
await expect(permissionRow).toClick('td[class$=deleteColumn] button');
|
||||
|
||||
await expectConfirmModalAndAct(page, {
|
||||
|
@ -188,7 +187,7 @@ describe('M2M RBAC', () => {
|
|||
await expectModalWithTitle(page, 'Assign permissions');
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=title] div[class$=name]',
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=title] div',
|
||||
{
|
||||
text: apiResourceName,
|
||||
}
|
||||
|
@ -207,7 +206,7 @@ describe('M2M RBAC', () => {
|
|||
text: 'The selected permissions were successfully assigned to this role',
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('table tbody tr:has(td div[class$=name])', {
|
||||
await expect(page).toMatchElement('table tbody tr:has(td div)', {
|
||||
text: permissionName,
|
||||
});
|
||||
});
|
||||
|
@ -253,12 +252,9 @@ describe('M2M RBAC', () => {
|
|||
text: rbacTestAppname,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement(
|
||||
'div[class$=header] > div[class$=metadata] div[class$=name]',
|
||||
{
|
||||
text: rbacTestAppname,
|
||||
}
|
||||
);
|
||||
await expect(page).toMatchElement('div[class$=header] > div[class$=metadata] div', {
|
||||
text: rbacTestAppname,
|
||||
});
|
||||
|
||||
// Go to roles tab
|
||||
await expect(page).toClick('nav div[class$=item] div[class$=link] a', {
|
||||
|
@ -290,7 +286,7 @@ describe('M2M RBAC', () => {
|
|||
await expectModalWithTitle(page, `Assign roles to ${rbacTestAppname}`);
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=rolesTransfer] div[class$=item] div[class$=name]',
|
||||
'.ReactModalPortal div[class$=rolesTransfer] div[class$=item] div',
|
||||
{
|
||||
text: roleName,
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ describe('RBAC', () => {
|
|||
text: `The API resource ${apiResourceName} has been successfully created`,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div[class$=name]', {
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div', {
|
||||
text: apiResourceName,
|
||||
});
|
||||
});
|
||||
|
@ -98,7 +98,7 @@ describe('RBAC', () => {
|
|||
text: `The permission ${permissionName} has been successfully created`,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('table tbody tr td div[class$=name]', {
|
||||
await expect(page).toMatchElement('table tbody tr td div', {
|
||||
text: permissionName,
|
||||
});
|
||||
});
|
||||
|
@ -153,12 +153,9 @@ describe('RBAC', () => {
|
|||
});
|
||||
|
||||
// Assign permission
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=title] div[class$=name]',
|
||||
{
|
||||
text: apiResourceName,
|
||||
}
|
||||
);
|
||||
await expect(page).toClick('.ReactModalPortal div[class$=resourceItem] div[class$=title] div', {
|
||||
text: apiResourceName,
|
||||
});
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=sourceScopeItem] div[role=button]',
|
||||
|
@ -176,7 +173,7 @@ describe('RBAC', () => {
|
|||
await expectModalWithTitle(page, 'Assign users');
|
||||
await expectToClickModalAction(page, 'Skip for now');
|
||||
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div[class$=name]', {
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div', {
|
||||
text: roleName,
|
||||
});
|
||||
});
|
||||
|
@ -186,10 +183,9 @@ describe('RBAC', () => {
|
|||
text: 'Permissions',
|
||||
});
|
||||
|
||||
const permissionRow = await expect(page).toMatchElement(
|
||||
'table tbody tr:has(td div[class$=name])',
|
||||
{ text: permissionName }
|
||||
);
|
||||
const permissionRow = await expect(page).toMatchElement('table tbody tr:has(td div)', {
|
||||
text: permissionName,
|
||||
});
|
||||
await expect(permissionRow).toClick('td[class$=deleteColumn] button');
|
||||
|
||||
await expectConfirmModalAndAct(page, {
|
||||
|
@ -209,12 +205,9 @@ describe('RBAC', () => {
|
|||
|
||||
await expectModalWithTitle(page, 'Assign permissions');
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=title] div[class$=name]',
|
||||
{
|
||||
text: apiResourceName,
|
||||
}
|
||||
);
|
||||
await expect(page).toClick('.ReactModalPortal div[class$=resourceItem] div[class$=title] div', {
|
||||
text: apiResourceName,
|
||||
});
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=resourceItem] div[class$=sourceScopeItem] div[role=button]',
|
||||
|
@ -229,7 +222,7 @@ describe('RBAC', () => {
|
|||
text: 'The selected permissions were successfully assigned to this role',
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('table tbody tr:has(td div[class$=name])', {
|
||||
await expect(page).toMatchElement('table tbody tr:has(td div)', {
|
||||
text: permissionName,
|
||||
});
|
||||
});
|
||||
|
@ -304,12 +297,9 @@ describe('RBAC', () => {
|
|||
|
||||
await expectModalWithTitle(page, `Assign roles to ${rbacTestUsername}`);
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=rolesTransfer] div[class$=item] div[class$=name]',
|
||||
{
|
||||
text: roleName,
|
||||
}
|
||||
);
|
||||
await expect(page).toClick('.ReactModalPortal div[class$=rolesTransfer] div[class$=item] div', {
|
||||
text: roleName,
|
||||
});
|
||||
|
||||
await expectToClickModalAction(page, 'Assign roles');
|
||||
|
||||
|
@ -347,7 +337,7 @@ describe('RBAC', () => {
|
|||
text: roleName,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div[class$=name]', {
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div', {
|
||||
text: roleName,
|
||||
});
|
||||
|
||||
|
@ -380,7 +370,7 @@ describe('RBAC', () => {
|
|||
text: apiResourceName,
|
||||
});
|
||||
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div[class$=name]', {
|
||||
await expect(page).toMatchElement('div[class$=header] div[class$=info] div', {
|
||||
text: apiResourceName,
|
||||
});
|
||||
|
||||
|
@ -388,10 +378,9 @@ describe('RBAC', () => {
|
|||
await expect(page).toClick('nav div[class$=item] div[class$=link] a', {
|
||||
text: 'Permissions',
|
||||
});
|
||||
const permissionRow = await expect(page).toMatchElement(
|
||||
'table tbody tr:has(td div[class$=name])',
|
||||
{ text: permissionName }
|
||||
);
|
||||
const permissionRow = await expect(page).toMatchElement('table tbody tr:has(td div)', {
|
||||
text: permissionName,
|
||||
});
|
||||
await expect(permissionRow).toClick('td[class$=deleteColumn] button');
|
||||
|
||||
await expectConfirmModalAndAct(page, { title: 'Reminder', actionText: 'Delete' });
|
||||
|
|
Loading…
Add table
Reference in a new issue