Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
joeizang committed Dec 17, 2024
1 parent 977b073 commit af6e953
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 32 deletions.
3 changes: 2 additions & 1 deletion apps/remix-ide-e2e/src/commands/selectAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class SelectAccount extends EventEmitter {
command (this: NightwatchBrowser, account?: string): NightwatchBrowser {
if (account) {
this.api
.click(`*[data-id="runTabSelectAccount"] a:contains("${account}")`)
.click(`*[data-id="runTabSelectAccount"]`)
.click(`*[data-id="runTabSelectAccount"]`) // close dropdown
.perform(() => {
this.emit('complete')
})
Expand Down
58 changes: 29 additions & 29 deletions apps/remix-ide-e2e/src/commands/switchEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import EventEmitter from 'events'
class switchEnvironment extends EventEmitter {
command (this: NightwatchBrowser, provider: string): NightwatchBrowser {
this.api.useCss().waitForElementVisible('[data-id="settingsSelectEnvOptions"]')
.perform((done) => {
this.api.isPresent({ selector: `[data-id="selected-provider-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000}, (result) => {
if (result.value) {
done()
} else {
browser.perform(() => {
this.api
.click('[data-id="settingsSelectEnvOptions"] button') // open dropdown
.isPresent({ selector: `[data-id="dropdown-item-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000}, (result) => {
console.log(result)
this.api.click('[data-id="settingsSelectEnvOptions"] button') // close dropdown
if (!result.value) {
this.api.pinGrid(provider, true)
.click('[data-id="settingsSelectEnvOptions"] button')
.waitForElementVisible(`[data-id="dropdown-item-${provider}"]`)
.click(`[data-id="dropdown-item-${provider}"]`)
.perform(() => done())
} else {
browser.click('[data-id="settingsSelectEnvOptions"] button')
.waitForElementVisible(`[data-id="dropdown-item-${provider}"]`)
.click(`[data-id="dropdown-item-${provider}"]`)
.perform(() => done())
}
})
})
}
})
}).perform(() => this.emit('complete'))
.perform((done) => {
this.api.isPresent({ selector: `[data-id="selected-provider-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000 }, (result) => {
if (result.value) {
done()
} else {
browser.perform(() => {
this.api
.click('[data-id="settingsSelectEnvOptions"] button') // open dropdown
.isPresent({ selector: `[data-id="dropdown-item-${provider}"]`, suppressNotFoundErrors: true, timeout: 5000 }, (result) => {
console.log(result)
this.api.click('[data-id="settingsSelectEnvOptions"] button') // close dropdown
if (!result.value) {
this.api.pinGrid(provider, true)
.click('[data-id="settingsSelectEnvOptions"] button')
.waitForElementVisible(`[data-id="dropdown-item-${provider}"]`)
.click(`[data-id="dropdown-item-${provider}"]`)
.perform(() => done())
} else {
browser.click('[data-id="settingsSelectEnvOptions"] button')
.waitForElementVisible(`[data-id="dropdown-item-${provider}"]`)
.click(`[data-id="dropdown-item-${provider}"]`)
.perform(() => done())
}
})
})
}
})
}).perform(() => this.emit('complete'))

return this
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CustomToggle = React.forwardRef(
className={className.replace('dropdown-toggle', '')}
>
<div className="d-flex">
<div className="mr-auto text-nowrap text-truncate overflow-hidden">{children}</div>
<div className="mr-auto text-nowrap text-truncate overflow-hidden" data-id={`dropdown-content`}>{children}</div>
{icon && (
<div className="pr-1">
<i className={`${icon} pr-1`}></i>
Expand Down
3 changes: 2 additions & 1 deletion libs/remix-ui/run-tab/src/lib/components/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export function AccountUI(props: AccountProps) {
{props.accounts.isRequesting && <i className="fa fa-spinner fa-pulse ml-2" aria-hidden="true"></i>}
</label>
<div className="udapp_account">
<Dropdown className="udapp_selectExEnvOptions">
<Dropdown className="udapp_selectExEnvOptions" data-id="runTabSelectAccount">
<Dropdown.Toggle as={CustomToggle} icon={null} id="txorigin" data-id="runTabSelectAccount" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control">
{selectedAccount ? loadedAccounts[selectedAccount] : ''}
</Dropdown.Toggle>
Expand All @@ -248,6 +248,7 @@ export function AccountUI(props: AccountProps) {
onSelect={(e) => {
props.setAccount(value)
}}
data-id="txOriginSelectAccountItem"
>
<span className="">
{loadedAccounts[value]}
Expand Down

0 comments on commit af6e953

Please sign in to comment.