text: 'use strict';
  
  const { describe, it } = require('../../../../helpers/mocha');
  const { expect } = require('../../../../helpers/chai');
  const { setUpWebDriver } = require('../../../lifecycle');
  const Browser = require('../..');
  const Server = require('../../../../helpers/server');
  const { promisify } = require('util');
  const tmpDir = promisify(require('tmp').dir);
  const writeFile = promisify(require('fs').writeFile);
  const path = require('path');
  
  describe(Browser.prototype.getText, function() {
    setUpWebDriver.call(this, {
      shareWebdriver: true,
      keepBrowserOpen: true,
      overrides: {
        waitforTimeout: 0,
      },
    });
  
    let fixturesPath;
  
    before(function() {
      this.createPage = function(Page) {
        return new Page(this.browser);
      };
  
      this.open = async function(pathname) {
        await this.browser.url(`http://localhost:${this.port}/${pathname}`);
      };
  
      this.writeFixture = async function(filename, fixtureData) {
        await writeFile(path.join(fixturesPath, filename), fixtureData);
      };
    });
  
    beforeEach(async function() {
      fixturesPath = await tmpDir();
  
      this.server = new Server(fixturesPath);
  
      this.port = await this.server.start();
    });
  
    afterEach(async function() {
      if (this.server) {
        await this.server.stop();
      }
    });
  
    it('is as flawed as we expect', async function() {
      await this.writeFixture('index.html', `
        <div class="foo" style="text-transform: uppercase">
          foo
        </div>
      `);
  
      await this.open('index.html');
  
      let element = await this.browser.$('.foo');
  
      expect(await element.getText()).to.equal('FOO');
  
      expect(await this.browser.getText(element)).to.equal('foo');
    });
  });
  