docbrown/cypress/e2e/seededFlows/listingFlows/deleteListing.spec.js
dependabot[bot] deb86efb0d
Bump cypress and @knapsack-pro/cypress (#18025)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-06 17:53:13 -04:00

39 lines
1 KiB
JavaScript

describe('Delete listing', () => {
beforeEach(() => {
cy.testSetup();
cy.viewport('macbook-16');
cy.enableFeatureFlag('listing_feature');
cy.fixture('users/adminUser.json').as('user');
cy.get('@user').then((user) => {
cy.loginAndVisit(user, '/listings/dashboard');
});
});
it('deletes a listing', () => {
cy.findByRole('main')
.findByRole('heading', { name: 'Listing title' })
.should('exist');
cy.findByRole('link', { name: 'Delete' }).click();
// Wait until the confirmation page loads
cy.findByRole('heading', {
name: 'Are you sure you want to delete this listing?',
});
cy.findByRole('main')
.findByRole('button', { name: /^Delete$/i })
.click();
// Wait for the form to submit and the user to be returned to the dashboard
cy.findByRole('heading', {
name: 'Are you sure you want to delete this listing?',
}).should('not.exist');
cy.findByRole('main')
.findByRole('heading', { name: 'Listing title' })
.should('not.exist');
});
});