-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fa2f16
commit d82bd31
Showing
6 changed files
with
125 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
portal-ui/tests/permissions/test-fix-ui-crash-for-policy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// This file is part of MinIO Console Server | ||
// Copyright (c) 2022 MinIO, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import { Role, Selector } from "testcafe"; | ||
import { readFileSync } from "fs"; | ||
|
||
const data = readFileSync(__dirname + "/../constants/timestamp.txt", "utf-8"); | ||
const $TIMESTAMP = data.trim(); | ||
|
||
let testDomainUrl = "http://localhost:9090"; | ||
|
||
let insAllowedAccKey = `prefix-policy-ui-crash-${$TIMESTAMP}`; | ||
let insAllowedSeckey = "poluicrashfix1234"; | ||
|
||
/* Begin Local Testing config block */ | ||
|
||
// For local Testing Create users and assign policies then update here. | ||
// Command to invoke the test locally: testcafe chrome tests/permissions/inspect.ts | ||
/*testDomainUrl = "http://localhost:5005"; | ||
insAllowedAccKey = `prefix-policy-ui-crash`; | ||
insAllowedSeckey = "poluicrashfix1234";*/ | ||
/* End Local Testing config block */ | ||
|
||
const loginUrl = `${testDomainUrl}/login`; | ||
const bucketsScreenUrl = `${testDomainUrl}/buckets`; | ||
|
||
const loginSubmitBtn = Selector("form button"); | ||
|
||
export const bucketsSidebarEl = Selector(".MuiPaper-root") | ||
.find("ul") | ||
.child("#buckets"); | ||
|
||
export const menuListchildren = Selector("#tools-children"); | ||
export const bucketsEl = menuListchildren | ||
.find("a") | ||
.withAttribute("href", "/buckets"); | ||
|
||
export const inspectAllowedRole = Role( | ||
loginUrl, | ||
async (t) => { | ||
await t | ||
.typeText("#accessKey", insAllowedAccKey) | ||
.typeText("#secretKey", insAllowedSeckey) | ||
.click(loginSubmitBtn); | ||
}, | ||
{ preserveUrl: true } | ||
); | ||
|
||
fixture("For user with Bucket Prefix permissions") | ||
.page(testDomainUrl) | ||
.beforeEach(async (t) => { | ||
await t.useRole(inspectAllowedRole); | ||
}); | ||
|
||
test("Bucket page can be opened", async (t) => { | ||
await t.navigateTo(bucketsScreenUrl); | ||
}); | ||
test("Buckets sidebar item exists", async (t) => { | ||
await t.expect(bucketsSidebarEl.exists).ok(); | ||
}); | ||
|
||
/** | ||
* Without the fix UI crashes with | ||
* TypeError: simpleResources is not iterable (if fixed -> ) | ||
* TypeError: scopes is not iterable (if fixed -> ) | ||
* TypeError: values is not iterable | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Deny", | ||
"Action": [ | ||
"admin:*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetBucketLocation", | ||
"s3:ListBucket" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::*testcafe/*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject", | ||
"s3:ListBucket" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::*testcafe/write/*" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters