Skip to content

Commit

Permalink
select another dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Oct 15, 2024
1 parent ecace8e commit f09735e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
14 changes: 1 addition & 13 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { defineConfig } = require("cypress");
const baseUrl = process.env.BASE_URL || "https://opensource-demo.orangehrmlive.com/web/index.php/"
const apiURL = process.env.API_URL || "https://opensource-demo.orangehrmlive.com/web/index.php/api/v2/"
// const dbHost = process.env.DBHOST || "localhost"
// const dbPassword = process.env.DBPASSWORD || "password"


module.exports = defineConfig({
Expand All @@ -27,15 +25,5 @@ module.exports = defineConfig({
//numTestsKeptInMemory: 0
testIsolation: false,
experimentalMemoryManagement: true
},
env: {
apiUrl: apiURL,
// db: {
// user: "user",
// host: dbHost,
// database: "postgres",
// password: dbPassword,
// port: 5432
// }
},
}
})
7 changes: 3 additions & 4 deletions cypress/e2e/users.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ describe('Login Functionality', () => {


context('User register', () => {
it('Should register an new user sucessfully', () => {
it('Should register an new user Admin sucessfully', () => {
cy.goToPage('admin/viewSystemUsers', 'System Users')
cy.get('button.oxd-button').contains('Add').click()
staticDropdowns.selectDropdownsElement('div.oxd-select-text-input', '0')
// staticDropdowns.selectDropdownsElement('div.oxd-select-text-input', '1')
staticDropdowns.selectDropdownsElement('div.oxd-select-text-input', '0', 'Admin')
staticDropdowns.selectDropdownsElement('div.oxd-select-text-input', '1', 'Enabled')
})
})

})
16 changes: 8 additions & 8 deletions cypress/support/utils/static-dropdowns.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class StaticDropdown {

selectDropdownsElement(selector, index) {
if (index) {
cy.get(selector, { timeout: 6000 }).eq(index).click()
} else {
cy.get(selector, { timeout: 6000 }).click()
}
class StaticDropdown {

selectDropdownsElement(selector, index = 0, option) {
cy.get(selector).eq(index).should('be.visible').click()
cy.get('div[role="option"]', { timeout: 10000 }).each(function ($ele) {
if ($ele.text().includes(option)) {
cy.wrap($ele).click()
}
})
}

}

export default new StaticDropdown()

0 comments on commit f09735e

Please sign in to comment.