-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add playwright tests for channel change
- Loading branch information
Florian Hines
committed
Aug 6, 2024
1 parent
a19443b
commit 3961a04
Showing
7 changed files
with
135 additions
and
0 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
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,29 @@ | ||
apiVersion: kots.io/v1beta1 | ||
kind: License | ||
metadata: | ||
name: github-action | ||
spec: | ||
appSlug: change-channel | ||
channelID: 2k6j62KPRQLjO0tF9zZB6zJJukg | ||
channelName: Automated | ||
channels: | ||
- channelID: 2k6j62KPRQLjO0tF9zZB6zJJukg | ||
channelName: Automated | ||
channelSlug: automated | ||
endpoint: https://replicated.app | ||
isDefault: true | ||
customerName: github-action | ||
endpoint: https://replicated.app | ||
entitlements: | ||
expires_at: | ||
description: License Expiration | ||
signature: {} | ||
title: Expiration | ||
value: "" | ||
valueType: String | ||
isKotsInstallEnabled: true | ||
isNewKotsUiEnabled: true | ||
licenseID: 2k6jempcB6aQyddcIEBSTj0Bvvv | ||
licenseSequence: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2JsSlBZak5yTldSR1ZuRlRXRkpUVmpGSmVtRnJNVmRWUkZwUllsVTRkMWRYVWt4UFNFMTZWMWRhVldOdVRrOWlibWgxV2pGUk1WWlZUVEZhVkVKM1UxVTVWMXBYVGpOVlZrSkhWa2hqZGxSc1dsQmlSVnBxWVRCS05rOUlRbHBsVjBaTVpESlZNbE5YZEhWT1EzUndVbXBDVTJSVVVsQk9NalZDWVRBNGNsRnNhR3BUYlZZeldYcGtRMVZVUms5bFJXUmhVV3hGTkU1VmR6VmtSM2N4WTBaa2NsTkZUbmRMTWxadFVqSkpNV1J1UmpKU1NFcHRWVlZhZEdNelJrWlhVemxIV1dwYVVWZFliSE5OYlU1RVZucHNSVmx1YUhWWFIzUnJZbFpqTVU5VVdsWlhiVkV6VDFadmNsZFlVbmRNTVdSdFpWZEtlVlpHYnpOaVIxSnpaRzVzYjJNd05XaGpTRlpYWTFST1VrNXNiSFZhTVdoMFRXNXdOVnBIWXpsUVUwbHpTVzFrYzJJeVNtaGlSWFJzWlZWc2EwbHFiMmxaYlZKc1dsUlZNazVVV1hkWk1scHBUa1JPYWs5WFNYbFBSMHB0VDFSb2JGbFhUbWhhYlVVeVRrUlphV1pSUFQwaWZRPT0ifQ== |
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,58 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { login, uploadLicense } from '../shared'; | ||
|
||
const CUSTOMER_ID = '2k6jemHbYgZFqtwgyjqiVfjRQqi'; | ||
const APP_ID = '2k6j65t0STtrZ1emyP5PUqBIQ23'; | ||
const AUTOMATED_CHANNEL_ID = '2k6j62KPRQLjO0tF9zZB6zJJukg'; | ||
const ALTERNATE_CHANNEL_ID = '2k6j61j49IPyDyQlbmRZJsxy3TP'; | ||
|
||
test('change channel', async ({ page }) => { | ||
test.slow(); | ||
await changeChannel(AUTOMATED_CHANNEL_ID); | ||
await login(page); | ||
await uploadLicense(page, expect); | ||
await page.getByRole('button', { name: 'Deploy' }).click(); | ||
await expect(page.locator('#app')).toContainText('Automated'); | ||
await changeChannel(ALTERNATE_CHANNEL_ID); | ||
|
||
await page.getByText('Sync license').click(); | ||
|
||
await expect(page.getByLabel('Next step')).toContainText('License synced', { timeout: 10000 }); | ||
await page.getByRole('button', { name: 'Ok, got it!' }).click(); | ||
|
||
await expect(page.locator('#app')).toContainText('Alternate'); | ||
await expect(page.locator('#app')).toContainText('1.0.3', { timeout: 10000 }); | ||
await expect(page.locator('#app')).toContainText('Upstream Update', { timeout: 10000 }); | ||
|
||
await page.getByRole('button', { name: 'Deploy', exact: true }).click(); | ||
await page.getByRole('button', { name: 'Yes, Deploy' }).click(); | ||
|
||
await expect(page.locator('#app')).toContainText('Currently deployed version', { timeout: 15000 }); | ||
await expect(page.getByText('v1.0.0')).not.toBeVisible(); | ||
await expect(page.getByText('1.0.3')).toBeVisible(); | ||
}); | ||
|
||
async function changeChannel(channelId: string) { | ||
await fetch(`https://api.replicated.com/vendor/v3/customer/${CUSTOMER_ID}`, { | ||
method: 'PUT', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': process.env.REPLICATED_API_TOKEN, | ||
}, | ||
body: JSON.stringify({ | ||
"app_id": APP_ID, | ||
"name": "github-action", // customer name | ||
"channels": [ | ||
{ | ||
"channel_id": channelId, | ||
"pinned_channel_sequence": null, | ||
"is_default_for_customer": true | ||
} | ||
] | ||
}) | ||
}).then(response => { | ||
if (!response.ok) { | ||
throw new Error(`Unexpected status code: ${response.status}`); | ||
} | ||
}); | ||
} |