Skip to content

Commit

Permalink
PR file fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JonSpight committed Oct 29, 2024
1 parent 0531951 commit 6bb5166
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/factory/move_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode
defaultShow = *cMove.Show
}
defaultLocator := models.GenerateLocator()

move := models.Move{
Orders: order,
OrdersID: order.ID,
Expand Down
141 changes: 141 additions & 0 deletions playwright/tests/my/mymove/mobileHome.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { test, expect } from '../../utils/my/customerTest';

const multiMoveEnabled = process.env.FEATURE_FLAG_MULTI_MOVE;

test.describe('Mobile Home shipment', () => {
test.skip(multiMoveEnabled === 'true', 'Skip if MultiMove workflow is enabled.');

test('A customer can create a Mobile Home shipment', async ({ page, customerPage }) => {
// Generate a new onboarded user with orders and log in
const move = await customerPage.testHarness.buildMoveWithOrders();
const userId = move.Orders.ServiceMember.user_id;
await customerPage.signInAsExistingCustomer(userId);

// Navigate to create a new shipment
await customerPage.waitForPage.home();
await page.getByTestId('shipment-selection-btn').click();
await customerPage.waitForPage.aboutShipments();
await customerPage.navigateForward();
await customerPage.waitForPage.selectShipmentType();

// Create an Mobile Home shipment
await page.getByText('Move a Mobile Home').click();
await customerPage.navigateForward();

// Fill in form to create Mobile Home shipment
await customerPage.waitForPage.mobileHomeShipment();
await page.getByLabel('Year').fill('2022');
await page.getByLabel('Make').fill('make');
await page.getByLabel('Model').fill('model');
await page.getByTestId('lengthFeet').fill('22');
await page.getByTestId('widthFeet').fill('22');
await page.getByTestId('heightFeet').fill('22');
await page.getByRole('button', { name: 'Continue' }).click();

await expect(page.getByTestId('tag')).toContainText('Mobile Home');

await expect(page.getByText('Pickup info')).toBeVisible();
await page.getByLabel('Preferred pickup date').fill('25 Dec 2022');
await page.getByLabel('Preferred pickup date').blur();
await page.getByText('Use my current address').click();
await page.getByLabel('Preferred delivery date').fill('25 Dec 2022');
await page.getByLabel('Preferred delivery date').blur();
await page.getByRole('button', { name: 'Save & Continue' }).click();
await customerPage.waitForPage.reviewShipments();
});
});

test.describe('(MultiMove) Mobile Home shipment', () => {
test.skip(multiMoveEnabled === 'false', 'Skip if MultiMove workflow is not enabled.');

test('A customer can create a Mobile Home shipment', async ({ page, customerPage }) => {
// Generate a new onboarded user with orders and log in
const move = await customerPage.testHarness.buildMoveWithOrders();
const userId = move.Orders.ServiceMember.user_id;
await customerPage.signInAsExistingCustomer(userId);

// Navigate from MM Dashboard to Move
await customerPage.navigateFromMMDashboardToMove(move);

// Navigate to create a new shipment
await customerPage.waitForPage.home();
await page.getByTestId('shipment-selection-btn').click();
await customerPage.waitForPage.aboutShipments();
await customerPage.navigateForward();
await customerPage.waitForPage.selectShipmentType();

// Create an Mobile Home shipment
await page.getByText('Move a mobile home').click();
await customerPage.navigateForward();

// Fill in form to create Mobile Home shipment
await customerPage.waitForPage.mobileHomeShipment();
await page.getByLabel('Year').fill('2022');
await page.getByLabel('Make').fill('make');
await page.getByLabel('Model').fill('model');
await page.getByTestId('lengthFeet').fill('22');
await page.getByTestId('widthFeet').fill('22');
await page.getByTestId('heightFeet').fill('22');
await page.getByRole('button', { name: 'Continue' }).click();

await expect(page.getByTestId('tag')).toContainText('Mobile Home');

await expect(page.getByText('Pickup info')).toBeVisible();
await page.getByLabel('Preferred pickup date').fill('25 Dec 2022');
await page.getByLabel('Preferred pickup date').blur();
await page.getByText('Use my current address').click();
await page.getByLabel('Preferred delivery date').fill('25 Dec 2022');
await page.getByLabel('Preferred delivery date').blur();
await page.getByRole('button', { name: 'Save & Continue' }).click();
await customerPage.waitForPage.reviewShipments();
});

test('Is able to delete a Mobile Home shipment', async ({ page, customerPage }) => {
// Generate a new onboarded user with orders and log in
const move = await customerPage.testHarness.buildMoveWithOrders();
const userId = move.Orders.ServiceMember.user_id;
await customerPage.signInAsExistingCustomer(userId);

// Navigate from MM Dashboard to Move
await customerPage.navigateFromMMDashboardToMove(move);

// Navigate to create a new shipment
await customerPage.waitForPage.home();
await page.getByTestId('shipment-selection-btn').click();
await customerPage.waitForPage.aboutShipments();
await customerPage.navigateForward();
await customerPage.waitForPage.selectShipmentType();

// Create an Mobile Home shipment
await page.getByText('Move a mobile home').click();
await customerPage.navigateForward();

// Fill in form to create Mobile Home shipment
await customerPage.waitForPage.mobileHomeShipment();
await page.getByLabel('Year').fill('2022');
await page.getByLabel('Make').fill('make');
await page.getByLabel('Model').fill('model');
await page.getByTestId('lengthFeet').fill('22');
await page.getByTestId('widthFeet').fill('22');
await page.getByTestId('heightFeet').fill('22');
await page.getByRole('button', { name: 'Continue' }).click();

await expect(page.getByTestId('tag')).toContainText('Mobile Home');

await expect(page.getByText('Pickup info')).toBeVisible();
await page.getByLabel('Preferred pickup date').fill('25 Dec 2022');
await page.getByLabel('Preferred pickup date').blur();
await page.getByText('Use my current address').click();
await page.getByLabel('Preferred delivery date').fill('25 Dec 2022');
await page.getByLabel('Preferred delivery date').blur();
await page.getByRole('button', { name: 'Save & Continue' }).click();
await customerPage.waitForPage.reviewShipments();

await expect(page.getByRole('heading', { name: 'Mobile Home 1' })).toBeVisible();
await page.getByTestId('deleteShipmentButton').click();
await expect(page.getByRole('heading', { name: 'Delete this?' })).toBeVisible();
await page.getByText('Yes, Delete').click();

await expect(page.getByRole('heading', { name: 'Mobile Home 1' })).not.toBeVisible();
});
});

0 comments on commit 6bb5166

Please sign in to comment.