Skip to content

Commit

Permalink
Add importYaml helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
kravciak committed Nov 20, 2023
1 parent 6e760d9 commit cf04cf7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/e2e/components/rancher-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,28 @@ export class RancherUI {
await this.page.keyboard.insertText(jsyaml.dump(cmYaml))
}

@step
async importYaml(yaml: YAMLPatch) {
// Open import dialog
const dialog = this.page.getByRole('dialog')
await this.page.locator('header').locator('button').filter({ has: this.page.locator('i.icon-upload') }).click()
await expect(dialog.getByRole('heading', { name: 'Import YAML', exact: true })).toBeVisible()

// Paste yaml
await this.editYaml(yaml)
await this.button('Import').click()
await expect(dialog.getByRole('heading', { name: /^Applied \d+ Resources?$/ })).toBeVisible()

// Wait until all resources are active
await dialog.getByTestId('sortable-cell-0-0').waitFor()
for (const e of await dialog.getByTestId(/sortable-cell-\d+-0/).all()) {
await expect(e).toHaveText('Active', { timeout: 60_000 })
}

// Close dialog
await this.button('Close').click()
}

/**
* Call ui.withReload(async()=> { <code> }, 'Reason')
*/
Expand Down

0 comments on commit cf04cf7

Please sign in to comment.