Skip to content

Commit

Permalink
test(*): fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Nov 27, 2023
1 parent b1bdfdb commit 38b6fa3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/playwright/commands/fillEntityForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ export const fillEntityForm = async (params: Params) => {
.click()

if (handleModal) {
await page.locator('.modal-dialog .k-button.primary').click()
await page.locator('.modal-dialog .k-modal-footer .k-button.primary').click()
}
}
10 changes: 5 additions & 5 deletions tests/playwright/specs/consumers/03-ConsumerPlugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test.describe('consumer plugins', () => {
await expect(page.locator('.autosuggest #consumer-id')).toHaveValue(new RegExp(`${mockConsumerName}\\s*-\\s*${uuid}`))
await withNavigation(
page,
async () => await page.locator('.entity-form .primary').click()
async () => await page.locator('.entity-form [data-testid="form-footer-actions"] .primary').click()
)
})

Expand All @@ -60,7 +60,7 @@ test.describe('consumer plugins', () => {
await withNavigation(
page,
async () => {
await page.locator('.entity-form .primary').click()
await page.locator('.entity-form [data-testid="form-footer-actions"] .primary').click()
await expect(page.locator('.k-modal-dialog.modal-dialog')).toBeVisible()
await page.locator('.k-prompt-action-buttons .primary').click()
}
Expand Down Expand Up @@ -94,7 +94,7 @@ test.describe('consumer plugins', () => {
await page.locator('#config-second').fill('30')
await withNavigation(
page,
async () => await page.locator('.entity-form .primary').click()
async () => await page.locator('.entity-form [data-testid="form-footer-actions"] .primary').click()
)
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Global')

Expand All @@ -108,7 +108,7 @@ test.describe('consumer plugins', () => {
await expect(page.locator('.k-select-item')).toContainText(mockConsumerName)
await page.click('.k-select-item')
await page.click(consumerListPage.$.submitButton)
await withNavigation(page, async () => await page.click('.k-modal .k-button.primary'))
await withNavigation(page, async () => await page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Consumer')
})

Expand All @@ -123,7 +123,7 @@ test.describe('consumer plugins', () => {
await page.waitForSelector('.entity-form')
await page.click('.selection-group .Global-check')
await page.click(consumerListPage.$.submitButton)
await withNavigation(page, async () => await page.click('.k-modal .k-button.primary'))
await withNavigation(page, async () => await page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Global')
})
})
8 changes: 4 additions & 4 deletions tests/playwright/specs/plugins/01-Plugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ test.describe('plugins', () => {

await withNavigation(
page,
async () => await page.locator('.plugin-form .primary').click()
async () => await page.locator('.plugin-form [data-testid="form-footer-actions"] .primary').click()
)
await expect(page.locator('.k-table tbody tr')).toHaveCount(1)
await expect(page.locator('td[data-testid="name"]')).toContainText('Basic Authentication')
Expand Down Expand Up @@ -199,7 +199,7 @@ test.describe('plugins', () => {

await withNavigation(
page,
async () => await page.locator('.plugin-form .primary').click()
async () => await page.locator('.plugin-form [data-testid="form-footer-actions"] .primary').click()
)
await expect(page.locator('.k-table tbody tr')).toHaveCount(1)
await expect(page.locator('td[data-testid="name"]')).toContainText('Basic Authentication')
Expand Down Expand Up @@ -228,7 +228,7 @@ test.describe('plugins', () => {
await expect(page.locator('.autosuggest #consumer-id')).toHaveValue(new RegExp(`${mockConsumerName}\\s*-\\s*${uuid}`))
await withNavigation(
page,
async () => await page.locator('.plugin-form .primary').click()
async () => await page.locator('.plugin-form [data-testid="form-footer-actions"] .primary').click()
)
await expect(page.locator('.k-table tbody tr')).toHaveCount(1)
await expect(page.locator('td[data-testid="name"]')).toContainText('Datadog')
Expand Down Expand Up @@ -307,7 +307,7 @@ test.describe('plugins', () => {

await withNavigation(
page,
async () => await page.locator('.plugin-form .primary').click()
async () => await page.locator('.plugin-form [data-testid="form-footer-actions"] .primary').click()
)
await withNavigation(page, async () => await clickEntityListAction(page, 'view'))

Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/specs/routes/02-RoutesPlugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test.describe('routes plugins', () => {

await withNavigation(
page,
async () => await page.locator('.plugin-form .primary').click()
async () => await page.locator('.plugin-form [data-testid="form-footer-actions"] .primary').click()
)
await expect(page.locator('.k-table tbody tr')).toHaveCount(1)
await expect(page.locator('td[data-testid="name"]')).toContainText('Basic Authentication')
Expand Down Expand Up @@ -144,7 +144,7 @@ test.describe('routes plugins', () => {
await expect(page.locator('.k-select-item')).toContainText(mockRouteName)
await page.click('.k-select-item')
await page.click(routeListPage.$.submitButton)
await withNavigation(page, () => page.click('.k-modal .k-button.primary'))
await withNavigation(page, () => page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Route')
})

Expand All @@ -156,7 +156,7 @@ test.describe('routes plugins', () => {
await page.waitForSelector('.entity-form')
await page.click('.selection-group .Global-check')
await page.click(routeListPage.$.submitButton)
await withNavigation(page, () => page.click('.k-modal .k-button.primary'))
await withNavigation(page, () => page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Global')
})
})
4 changes: 2 additions & 2 deletions tests/playwright/specs/services/03-ServicePlugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test.describe('service plugins', () => {
await expect(page.locator('.k-select-item')).toContainText('test_service')
await page.click('.k-select-item')
await page.click(serviceListPage.$.submitButton)
await withNavigation(page, () => page.click('.k-modal .k-button.primary'))
await withNavigation(page, () => page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Service')
})

Expand All @@ -142,7 +142,7 @@ test.describe('service plugins', () => {
await page.waitForSelector('.entity-form')
await page.click('.selection-group .Global-check')
await page.click(serviceListPage.$.submitButton)
await withNavigation(page, () => page.click('.k-modal .k-button.primary'))
await withNavigation(page, () => page.click('.k-modal .k-modal-footer .k-button.primary'))
await expect(page.locator('.kong-ui-entities-plugins-list [data-testid="appliedTo"] .k-badge')).toContainText('Global')
})
})

0 comments on commit 38b6fa3

Please sign in to comment.