<commit_before>context('Scenarios', () => {
  before(() => {
    cy.fixture('regions/scratch.json').as('region')
    cy.setupProject('scratch')
  })

  beforeEach(() => {
    // open the scenarios panel, if closed
    cy.findByText(/Scenarios/)
      .parent()
      .as('scenarioPanel')
    cy.get('@scenarioPanel').then((pan) => {
      if (!pan.text().includes('Create a scenario')) {
        cy.get('@scenarioPanel').click()
      }
    })
  })

  it('start with baseline and default', () => {
    cy.get('@scenarioPanel')
      .contains(/Baseline/)
      .findByTitle(/Delete this scenario/)
      .should('not.exist')
    cy.get('@scenarioPanel')
      .contains(/Default/)
      .findByTitle(/Rename this scenario/)
      .should('exist')
  })

  it('can be created and deleted', function () {
    let scenarioName = 'scenario ' + Date.now()
    // stub the prompt
    cy.window().then((win) => {
      cy.stub(win, 'prompt').returns(scenarioName)
    })
    // create
    cy.findByRole('link', {name: 'Create a scenario'}).click()
    // confirm creation and delete
    cy.get('@scenarioPanel')
      .contains(scenarioName)
      .findByTitle(/Delete this scenario/)
      .click()
    cy.findByText(scenarioName).should('not.exist')
  })

  it('can be created and renamed', () => {
    // TODO
  })
})<commit_msg>trying to stub second call<commit_after>context('Scenarios', () => {
  before(() => {
    cy.fixture('regions/scratch.json').as('region')
    cy.setupProject('scratch')
  })

  beforeEach(() => {
    // identify and open the scenarios panel, if closed
    cy.findByText(/Scenarios/)
      .parent()
      .as('scenarioPanel')
    cy.get('@scenarioPanel').then((pan) => {
      if (!pan.text().includes('Create a scenario')) {
        cy.get('@scenarioPanel').click()
      }
    })
  })

  it('start with "baseline" and "default"', () => {
    cy.get('@scenarioPanel')
      .contains(/Baseline/)
      .findByTitle(/Delete this scenario/)
      .should('not.exist')
    cy.get('@scenarioPanel')
      .contains(/Default/)
      .findByTitle(/Rename this scenario/)
      .should('exist')
  })

  it('can be created and deleted', function () {
    let scenarioName = 'scenario ' + Date.now()
    cy.window().then((win) => {
      let stub = cy
        .stub(win, 'prompt')
        .onFirstCall()
        .returns(scenarioName)
        .onSecondCall()
        .returns(scenarioName + ' altered')
    })
    cy.findByRole('link', {name: 'Create a scenario'}).click()
    // TODO stub not returning altered value on second call
    //cy.get('@scenarioPanel')
    //  .contains(scenarioName)
    //  .findByTitle(/Rename/)
    //  .click()
    cy.get('@scenarioPanel')
      .contains(scenarioName)
      .findByTitle(/Delete this scenario/)
      .click()
    cy.get('@scenarioPanel').findByText(scenarioName).should('not.exist')
  })
})
{'fraction_non_alphanumeric': 0.18579426172148356, 'fraction_numerical': 0.0, 'mean_word_length': 2.6420382165605094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2477421', 'n_tokens_mistral': 922, 'n_tokens_neox': 909, 'n_words': 165}