-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vadym Yarosh
committed
Aug 17, 2023
1 parent
a3fd444
commit 07fcb4b
Showing
8 changed files
with
88 additions
and
22 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
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,30 @@ | ||
import { test as setup } from '@playwright/test'; | ||
import { api } from '@api/api'; | ||
import { portalHelper } from '@helpers/portalHelper'; | ||
import { fileHelper } from '@helpers/fileHelper'; | ||
import { Constants } from '@helpers/Constants'; | ||
|
||
/** | ||
* Extension point: before Portal tests. | ||
* Note that there are only 2 ways to pass any artifacts to tests: environment variables and files | ||
*/ | ||
setup('Setup Portal tests', async ({ baseURL }) => { | ||
await setup.step('Add pmm-server settings', async () => { | ||
await api.pmm.settingsV1.changeSettings({ | ||
pmm_public_address: baseURL!.replace(/(^\w+:|^)\/\//, ''), | ||
}); | ||
}); | ||
await setup.step('Remove old credentials file if it\'s there', async () => { | ||
if (fileHelper.fileExists(Constants.portal.credentialsFile)) { | ||
console.log('Found file with Portal test users! Removing...'); | ||
await fileHelper.removeFile(Constants.portal.credentialsFile); | ||
} | ||
}); | ||
await setup.step('Generate new users and save to file', async () => { | ||
const [firstAdmin, secondAdmin, technicalUser, freeUser] = await portalHelper.createNewUsers(); | ||
fileHelper.writeToFile( | ||
Constants.portal.credentialsFile, | ||
JSON.stringify([firstAdmin, secondAdmin, technicalUser, freeUser]), | ||
); | ||
}); | ||
}); |