-
Notifications
You must be signed in to change notification settings - Fork 31
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
823d3cf
commit dccd266
Showing
9 changed files
with
203 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import CruResourcePo from '@/utils/components/cru-resource.po'; | ||
import { MANAGEMENT } from '@/constants/types' | ||
import LabeledSelectPo from '@/utils/components/labeled-select.po'; | ||
|
||
export default class UserPo extends CruResourcePo { | ||
constructor() { | ||
super({ | ||
type: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING | ||
}); | ||
} | ||
|
||
public selectMember() { | ||
return new LabeledInputPo('.labeled-input', `:contains("Select Member")`) | ||
} | ||
|
||
public newPassword() { | ||
return new LabeledInputPo('.labeled-input', `:contains("New Password")`) | ||
} | ||
|
||
public confirmPassword() { | ||
return new LabeledInputPo('.labeled-input', `:contains("Confirm Password")`) | ||
} | ||
|
||
public setValue(value: any) { | ||
this.username().input(value?.username) | ||
this.newPassword().input(value?.newPassword) | ||
this.confirmPassword().input(value?.confirmPassword) | ||
} | ||
|
||
public create(value: any, urlWithNamespace?: boolean) { | ||
cy.visit(`/c/local/auth/${this.type}/create`) | ||
|
||
this.setValue(value) | ||
|
||
this.save() | ||
} | ||
|
||
public save({ | ||
buttonText = 'save', | ||
edit, | ||
} : { | ||
buttonText?:string, | ||
edit?: boolean; | ||
} = {}) { | ||
cy.intercept('POST', `/v3/users`).as('create'); | ||
|
||
this.clickFooterBtn(buttonText) | ||
cy.wait('@create').then(res => { | ||
expect(res.response?.statusCode, `Create ${this.type} success`).to.equal(201); | ||
}) | ||
} | ||
} |
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,52 @@ | ||
import CruResourcePo from '@/utils/components/cru-resource.po'; | ||
import { MANAGEMENT } from '@/constants/types' | ||
import LabeledInputPo from '@/utils/components/labeled-input.po'; | ||
|
||
export default class UserPo extends CruResourcePo { | ||
constructor() { | ||
super({ | ||
type: MANAGEMENT.USER | ||
}); | ||
} | ||
|
||
public username() { | ||
return new LabeledInputPo('.labeled-input', `:contains("Username")`) | ||
} | ||
|
||
public newPassword() { | ||
return new LabeledInputPo('.labeled-input', `:contains("New Password")`) | ||
} | ||
|
||
public confirmPassword() { | ||
return new LabeledInputPo('.labeled-input', `:contains("Confirm Password")`) | ||
} | ||
|
||
public setValue(value: any) { | ||
this.username().input(value?.username) | ||
this.newPassword().input(value?.newPassword) | ||
this.confirmPassword().input(value?.confirmPassword) | ||
} | ||
|
||
public create(value: any, urlWithNamespace?: boolean) { | ||
cy.visit(`/c/local/auth/${this.type}/create`) | ||
|
||
this.setValue(value) | ||
|
||
this.save() | ||
} | ||
|
||
public save({ | ||
buttonText = 'save', | ||
edit, | ||
} : { | ||
buttonText?:string, | ||
edit?: boolean; | ||
} = {}) { | ||
cy.intercept('POST', `/v3/users`).as('create'); | ||
|
||
this.clickFooterBtn(buttonText) | ||
cy.wait('@create').then(res => { | ||
expect(res.response?.statusCode, `Create ${this.type} success`).to.equal(201); | ||
}) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { RancherPageUrl } from "@/constants/constants"; | ||
import UserPage from "@/pageobjects/rancher/user.po"; | ||
|
||
const user = new UserPage(); | ||
|
||
describe("Setup users", () => { | ||
it("Setup users", () => { | ||
cy.login({ | ||
username: "admin", | ||
}); | ||
|
||
user.create({ | ||
username: "cluster-owner", | ||
newPassword: "password1234", | ||
confirmPassword: "password1234" | ||
}) | ||
|
||
user.create({ | ||
username: "cluster-member", | ||
newPassword: "password1234", | ||
confirmPassword: "password1234" | ||
}) | ||
|
||
user.create({ | ||
username: "project-owner", | ||
newPassword: "password1234", | ||
confirmPassword: "password1234" | ||
}) | ||
|
||
user.create({ | ||
username: "project-member", | ||
newPassword: "password1234", | ||
confirmPassword: "password1234" | ||
}) | ||
}) | ||
|
||
it.only('Add users to cluster', () => { | ||
cy.login({ | ||
username: "admin", | ||
}); | ||
}) | ||
}) |
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