-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add connection settings tests and update related configurations
- Loading branch information
1 parent
7b94bc6
commit c4e7f1b
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,67 @@ | ||
import { test } from '../fixtures/test'; | ||
|
||
test.describe('Connection settings', () => { | ||
|
||
test('Disconnect', async ({ helper, connectionSettingsPage }) => { | ||
// Setup | ||
const { clear_config, dummy_config } = helper.webhooks; | ||
// await helper.executeWebhook({ webhook: clear_config }); // Clear the configuration. | ||
await helper.executeWebhook({ webhook: dummy_config }); // Setup for physical products. | ||
|
||
// Execution | ||
await connectionSettingsPage.goto(); | ||
await connectionSettingsPage.expectLoadingShowAndHide(); | ||
await connectionSettingsPage.disconnect(); | ||
}); | ||
|
||
test('Change', async ({ helper, page, connectionSettingsPage }) => { | ||
// Setup | ||
const { clear_config, dummy_config } = helper.webhooks; | ||
// await helper.executeWebhook({ webhook: clear_config }); // Clear the configuration. | ||
await helper.executeWebhook({ webhook: dummy_config }); // Setup for physical products. | ||
|
||
const credentials = { | ||
username: process.env.SQ_USER_NAME, | ||
password: process.env.SQ_USER_SECRET, | ||
env: 'sandbox' | ||
}; | ||
|
||
const credentialsForServices = { | ||
...credentials, | ||
username: process.env.SQ_USER_SERVICES_NAME, | ||
password: process.env.SQ_USER_SERVICES_SECRET | ||
}; | ||
|
||
const wrongSandboxCredentials = { ...credentials, password: '1234' }; | ||
const wrongLiveCredentials = { ...credentials, env: 'live' }; | ||
|
||
// Execution | ||
await connectionSettingsPage.goto(); | ||
await connectionSettingsPage.expectLoadingShowAndHide(); | ||
|
||
// Test cancellation of the changes | ||
await connectionSettingsPage.fillForm(wrongSandboxCredentials); | ||
await connectionSettingsPage.cancel(); | ||
await connectionSettingsPage.expectFormToHaveValues(credentials); | ||
|
||
// Test wrong values keeping env in sandbox. | ||
await connectionSettingsPage.fillForm(wrongSandboxCredentials); | ||
await connectionSettingsPage.save(); | ||
await connectionSettingsPage.expectCredentialsErrorToBeVisible(); | ||
|
||
// Test wrong values changing env to live. | ||
await page.reload(); | ||
await connectionSettingsPage.expectLoadingShowAndHide(); | ||
await connectionSettingsPage.fillForm(wrongLiveCredentials); | ||
await connectionSettingsPage.save({ expectLoadingShowAndHide: false }); | ||
await connectionSettingsPage.confirmModal(); | ||
await connectionSettingsPage.expectCredentialsErrorToBeVisible(); | ||
|
||
// Test valid values. | ||
await page.reload(); | ||
await connectionSettingsPage.expectLoadingShowAndHide(); | ||
await connectionSettingsPage.fillForm(credentialsForServices); | ||
await connectionSettingsPage.save({ expectLoadingShowAndHide: true }); | ||
await page.waitForURL(/#onboarding-countries/); | ||
}); | ||
}); |