Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B 21328 review weights button #13882

Merged
merged 7 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions playwright/tests/office/txo/tioFlows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ test.describe('TIO user', () => {
await expect(page.getByTestId('serviceItemAmount')).toContainText('$324.00');

// Review Weights
await page.locator(weightSection).getByText('Review weights').click();
await page.locator(weightSection).getByText('Review shipment weights').click();
await officePage.waitForLoading();
await expect(page.getByText('Edit max billable weight')).toBeVisible();
await page.locator('[data-testid="closeSidebar"]').click();
Expand Down Expand Up @@ -739,7 +739,7 @@ test.describe('TIO user', () => {
await expect(page.locator(prSection)).not.toContainText('Rejected');

// Review Weights
const reviewWeightsBtn = page.locator('#billable-weights').getByText('Review weights');
const reviewWeightsBtn = page.locator('#billable-weights').getByText('Review shipment weights');
await tioFlowPage.waitForLoading();
await reviewWeightsBtn.click();

Expand Down Expand Up @@ -790,7 +790,7 @@ test.describe('TIO user', () => {
await expect(page.getByTestId('MovePaymentRequests')).toBeVisible();

// Review Weights
await page.locator('#billable-weights').getByText('Review weights').click();
await page.locator('#billable-weights').getByText('Review shipment weights').click();
await tioFlowPage.waitForLoading();
await page.locator('[data-testid="closeSidebar"]').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test.describe('TIO user', () => {
await expect(page.getByTestId('MovePaymentRequests')).toBeVisible();

// Review Weights
const reviewWeightsBtn = page.locator('#billable-weights').getByText('Review weights');
const reviewWeightsBtn = page.locator('#billable-weights').getByText('Review shipment weights');
await reviewWeightsBtn.click();

await page.getByRole('heading', { name: 'Review weights' }).waitFor({ state: 'visible' });
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/office/txo/tooFlows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ test.describe('TOO user', () => {
.press('Enter');
await page.getByTestId('locator-0').click();
await page.getByRole('link', { name: 'Payment requests' }).click();
await page.getByRole('button', { name: 'Review weights' }).click();
await page.getByRole('button', { name: 'Review shipment weights' }).click();
await page.getByRole('button', { name: 'Review shipment weights' }).click();
await page.getByRole('button', { name: 'Back' }).click();
await page.getByRole('link', { name: 'Payment requests' }).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export default function BillableWeightCard({
<Button
onClick={onReviewWeights}
secondary={secondaryReviewWeightsBtn}
style={{ maxWidth: '160px' }}
style={{ maxWidth: '240px' }}
disabled={!shipments.length > 0 || isMoveLocked}
>
Review weights
Review shipment weights
</Button>
</Restricted>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('BillableWeightCard', () => {
expect(screen.getByText(formatWeight(shipments[2].calculatedBillableWeight))).toBeInTheDocument();
});

it('implements the review weights handler when the review weights button is clicked', async () => {
it('implements the review weights handler when the review shipment weights button is clicked', async () => {
const shipments = [
{
id: '0001',
Expand All @@ -87,7 +87,7 @@ describe('BillableWeightCard', () => {
];
renderWithPermission({ shipments });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });

await userEvent.click(reviewWeights);

Expand All @@ -96,17 +96,17 @@ describe('BillableWeightCard', () => {
});
});

it('should disable review weights button if no shipments are present', async () => {
it('should disable review shipment weights button if no shipments are present', async () => {
const shipments = [];
renderWithPermission({ shipments });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });

expect(reviewWeights).toHaveAttribute('disabled');
expect(reviewWeights).toBeDisabled();
});

it('should disable review weights button if the move is locked', async () => {
it('should disable review shipment weights button if the move is locked', async () => {
const shipments = [
{
id: '0001',
Expand All @@ -120,7 +120,7 @@ describe('BillableWeightCard', () => {
const isMoveLocked = true;
renderWithPermission({ shipments, isMoveLocked });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });

expect(reviewWeights).toHaveAttribute('disabled');
expect(reviewWeights).toBeDisabled();
Expand All @@ -139,7 +139,7 @@ describe('BillableWeightCard', () => {
];
renderWithPermission({ shipments, secondaryReviewWeightsBtn: true });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).toHaveClass('usa-button--secondary');
});

Expand All @@ -155,7 +155,7 @@ describe('BillableWeightCard', () => {
];
renderWithPermission({ shipments });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toHaveClass('usa-button--secondary');
});

Expand All @@ -175,7 +175,7 @@ describe('BillableWeightCard', () => {
</MockProviders>,
);

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toHaveClass('usa-button--secondary');
});

Expand All @@ -191,7 +191,7 @@ describe('BillableWeightCard', () => {
];
renderWithPermission({ shipments });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toHaveClass('usa-button--secondary');
});

Expand All @@ -216,7 +216,7 @@ describe('BillableWeightCard', () => {
];
renderWithPermission({ ...props, shipments });

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toHaveClass('usa-button--secondary');
});

Expand Down Expand Up @@ -286,7 +286,7 @@ describe('BillableWeightCard', () => {
expect(screen.getByText('4,500 lbs')).toBeInTheDocument();
});

it('does not show the review weights button with no permission', () => {
it('does not show the review shipment weights button with no permission', () => {
const shipments = [
{
id: '0001',
Expand All @@ -299,7 +299,7 @@ describe('BillableWeightCard', () => {
];
render(<BillableWeightCard {...defaultProps} shipments={shipments} />);

const reviewWeights = screen.queryByRole('button', { name: 'Review weights' });
const reviewWeights = screen.queryByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ describe('MovePaymentRequests', () => {
jest.spyOn(console, 'error').mockImplementation(() => {});
renderMovePaymentRequests(testProps);

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });

await userEvent.click(reviewWeights);

Expand Down Expand Up @@ -659,28 +659,28 @@ describe('MovePaymentRequests', () => {
});
});

describe('a move that does not have a billableWeightsReviewedAt timestamp displays a primary styled Review Weights btn', () => {
describe('a move that does not have a billableWeightsReviewedAt timestamp displays a primary styled Review shipment weights btn', () => {
beforeEach(() => {
useMovePaymentRequestsQueries.mockReturnValue(moveShipmentMissingReweighWeight);
});

it('shows the max billable weight warning tag in sidebar', async () => {
renderMovePaymentRequests(testProps);

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).not.toHaveClass('usa-button--secondary');
});
});

describe('a move that has a billableWeightsReviewedAt timestamp displays a secondary styled Review Weights btn', () => {
describe('a move that has a billableWeightsReviewedAt timestamp displays a secondary styled Review shipment weights btn', () => {
beforeEach(() => {
useMovePaymentRequestsQueries.mockReturnValue(returnWithBillableWeightsReviewed);
});

it('shows the max billable weight warning tag in sidebar', async () => {
renderMovePaymentRequests(testProps);

const reviewWeights = screen.getByRole('button', { name: 'Review weights' });
const reviewWeights = screen.getByRole('button', { name: 'Review shipment weights' });
expect(reviewWeights).toHaveClass('usa-button--secondary');
});
});
Expand Down
Loading