-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add shipstation tests & update previous tests * Add shipstation api tests * update command * Fix case mismatch * Update feature map * Fix a method
- Loading branch information
1 parent
3aa625c
commit 6ffe461
Showing
16 changed files
with
406 additions
and
79 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,35 @@ | ||
import { Page } from '@playwright/test'; | ||
import { VendorPage } from '@pages/vendorPage'; | ||
import { selector } from '@pages/selectors'; | ||
import { data } from '@utils/testData'; | ||
|
||
// selectors | ||
const settingsShipStation = selector.vendor.vShipStationSettings; | ||
|
||
export class ShipStationPage extends VendorPage { | ||
constructor(page: Page) { | ||
super(page); | ||
} | ||
|
||
// generate shipStation credentials | ||
async generateShipStationCredentials() { | ||
await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); | ||
await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.shipStation, settingsShipStation.generateCredentials, 201); | ||
await this.toBeVisible(settingsShipStation.generateSuccessMessage); | ||
|
||
await this.toBeVisible(settingsShipStation.revokeCredentials); | ||
await this.multipleElementVisible(settingsShipStation.credentials); | ||
} | ||
|
||
// revoke shipStation credentials | ||
async revokeShipStationCredentials() { | ||
await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); | ||
|
||
await this.click(settingsShipStation.revokeCredentials); | ||
await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.shipStation, settingsShipStation.confirmRevoke); | ||
await this.toBeVisible(settingsShipStation.revokeSuccessMessage); | ||
|
||
await this.toBeVisible(settingsShipStation.generateCredentials); | ||
await this.multipleElementNotVisible(settingsShipStation.credentials); | ||
} | ||
} |
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,69 @@ | ||
//COVERAGE_TAG: GET /dokan/v1/shipstation/credentials/(?P<id>[\d]+) | ||
//COVERAGE_TAG: POST /dokan/v1/shipstation/credentials/create | ||
//COVERAGE_TAG: DELETE /dokan/v1/shipstation/credentials/(?P<id>[\d]+) | ||
//COVERAGE_TAG: GET /dokan/v1/shipstation/order-statuses | ||
//COVERAGE_TAG: POST /dokan/v1/shipstation/order-statuses/(?P<id>[\d]+) | ||
//COVERAGE_TAG: DELETE /dokan/v1/shipstation/order-statuses/(?P<id>[\d]+) | ||
|
||
import { test, expect, request } from '@playwright/test'; | ||
import { ApiUtils } from '@utils/apiUtils'; | ||
import { endPoints } from '@utils/apiEndPoints'; | ||
import { payloads } from '@utils/payloads'; | ||
import { schemas } from '@utils/schemas'; | ||
|
||
const { VENDOR_ID } = process.env; | ||
|
||
test.describe('ShipStation api test', () => { | ||
test.skip(true, 'remove after pr is merged'); | ||
let apiUtils: ApiUtils; | ||
|
||
test.beforeAll(async () => { | ||
apiUtils = new ApiUtils(await request.newContext()); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await apiUtils.dispose(); | ||
}); | ||
|
||
test('create ShipStation credential', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.post(endPoints.createShipStationCredential, { data: { vendor_id: VENDOR_ID } }); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); | ||
}); | ||
|
||
test('get ShipStation credential', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.get(endPoints.getShipStationCredential(VENDOR_ID)); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); | ||
}); | ||
|
||
test('delete ShipStation credential', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.delete(endPoints.deleteShipStationCredential(VENDOR_ID)); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); | ||
}); | ||
|
||
test('create ShipStation order status settings', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.post(endPoints.createShipStationOrderStatusSettings, { data: { ...payloads.shipStationOrderStatusSettings, vendor_id: VENDOR_ID } }); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); | ||
}); | ||
|
||
test('get ShipStation order status settings', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.get(endPoints.getShipStationOrderStatusSettings(VENDOR_ID)); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); | ||
}); | ||
|
||
test('delete ShipStation order status settings', { tag: ['@pro'] }, async () => { | ||
const [response, responseBody] = await apiUtils.delete(endPoints.deleteShipStationOrderStatusSettings(VENDOR_ID)); | ||
expect(response.ok()).toBeTruthy(); | ||
expect(responseBody).toBeTruthy(); | ||
expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); | ||
}); | ||
}); |
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 @@ | ||
import { test, Page } from '@playwright/test'; | ||
import { ShipStationPage } from '@pages/shipStationPage'; | ||
import { data } from '@utils/testData'; | ||
|
||
test.describe('ShipStation test', () => { | ||
test.skip(true, 'remove after pr is merged'); | ||
let vendor: ShipStationPage; | ||
let vPage: Page; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
const vendorContext = await browser.newContext(data.auth.vendorAuth); | ||
vPage = await vendorContext.newPage(); | ||
vendor = new ShipStationPage(vPage); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await vPage.close(); | ||
}); | ||
|
||
// vendor | ||
|
||
test('vendor can generate ShipStation credentials', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { | ||
await vendor.generateShipStationCredentials(); | ||
}); | ||
|
||
test('vendor can revoke ShipStation credentials', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { | ||
await vendor.revokeShipStationCredentials(); | ||
}); | ||
}); |
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
Oops, something went wrong.